BufferedImage

Is there another way to get the RGB values of an image using another class instead of BufferedImage class? When this class (BufferedImage) loads an image (ex. saved in bitmap format) does is apply any compression algorithm?

I磎 having prblens with a sequence of grayscale images, which brightness is growing frame to frame but when I calculate the average pixels brightness of an image and then subtract this value from the avverage pixels intensity of the first frame (image) of the sequnece, the returnded values sometimes are negative. It shouldn磘 be happening because the brightess is growing.

Does nayone know why does it happens? Is this true that the BufferedImage class uses compression and doesn磘 returns the real value of the pixels? If it磗 true, do you know another way to deal with images and get their RGB values?

Thanks a lot for the attention to my problem.

Let韈ia

[911 byte] By [lets_pandora1a] at [2007-10-3 3:53:22]
# 1

Can you post some sample code?

This could be bug in your code or known JDK problem.

What type of images are you working with?

In particular - how do you load images? All in the same manner?

Do you get all values using getRGB()?

Are you getting values from loaded images or you are painting some of them

first?

neigora at 2007-7-14 21:51:12 > top of Java-index,Security,Cryptography...
# 2

I'm working with grayscale imagens in bitmap format because I need the real value of the RGB. The code I'm using to read the images and get the RGB value is:

BufferedImage bi = ImageIO.read(new File( "/home/leticia/workdir/Terapia/src/terapia/tools/Frame#1.bmp")); // reads the image

Color c2 = new Color (bi.getRGB(173,179));//yes, I use getRGB(x,y);

float pixel2 = c2.getBlue(); //since R=G=B in grayscale images...

System.err.println("Pixel value in position (173,179): " + pixel2);

All the images I'm working with I'm loading the same maner and I just want to get the pixel value. I'm not setting a value.

For testing if the pixel value that java returns has the same value as ACDSee, Gimp, Matlab and other softwares returns, I preapeared this code, but the values are really different. Matlab and the other softwares return the value "39" and this code returns the value "109". This difference is crucial for me, because I need the real value that is supposed to be "39".

Thanks for the reply. :)

Let韈ia.

lets_pandora1a at 2007-7-14 21:51:12 > top of Java-index,Security,Cryptography...