|
-
Oct 19th, 2007, 06:57 AM
#1
Thread Starter
Hyperactive Member
Extracting RGB
Hello,
I've developing an application which needs to extract RGB for each pixel in an image then later do some calculations with chromaticityu using some formulae.
I can do d calculations but i do not know where to start. I can save an image onto the computer's memory but im stuck as i dnt knw how to extract pixels and RGB...
can anyone help?
Thanks in advance
-
Oct 19th, 2007, 08:42 PM
#2
Re: Extracting RGB
I think the class java.awt.image.BufferedImage is the answer to your problem.
take a look at it, it has a method called "getRGB" that requires x,y in offsets and returns an integer representation for the RGB color in that pixel.
"I'm not normally a praying man, but if you're up there, save me... Superman!" - Homer Simpson
My Blog
-
Oct 26th, 2007, 05:16 AM
#3
Thread Starter
Hyperactive Member
Re: [Solved] Extracting RGB
I've actually found two ways to extract it and save its values to an array.
These two methods are using Raster and using the following:
int red = (pixel >> 16) & 0xff;
int green = (pixel >> 8) & 0xff;
int blue = (pixel) & 0xff;
where pixel = getPixel(image.getRGB(x,y))
I've used the latter one but I heard that the Raster method is quicker.
Thanks for the advice tho
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|