Results 1 to 3 of 3
Thread: Processing an Image with csimage
- 01-27-2009, 04:03 AM #1
Member
- Join Date
- Jan 2009
- Posts
- 5
- Rep Power
- 0
Processing an Image with csimage
Hi, I was wondering if anyone can help me out. Here is what I need to do:
I have attached csimage_beta1.jar (in a zip file) if anyone is willing to helpUsing the UberImage and UberColor classes from csimage_beta1.jar, write a program that applies the following transformation to any JPEG or PNG file:
Convert all pixels in the image that are within distance D of pure red (i.e. UberColor.RED) to a shade of gray that is proportional to the brightness of the image’s red value.
Experiment with different values for the distance D to find out what values produce what effects. Run your program on real images.
Some helpful hints:
• In RGB, there are 256 shades of gray denoted by triples of the form (c, c, c), where 0 <= c < 256.
• The distance D between two RGB colors (a, b, c) and (x, y, z) is given by D = sqrt((a − x)2 + (b − y)2 + (c − z))^2.
This is what I have so far in my code:
The next part should do something for each x,y coordinate in the image. I know I need to check the distance between the RGB value at x,y and the RGB value of UberColor.RED, but I am having trouble specifically with how to do this.Java Code:package csimage; public class ImgRead { public static void main(String[] args) { UberImage img = UberImage.fromURL(args[0]); for(int x = 0; x < img.getWidth(); x++) for(int y = 0; y < img.getHeight(); y++) } }
Any ideas?
Thank you!
- 01-27-2009, 05:49 AM #2
- Join Date
- Jul 2007
- Location
- Colombo, Sri Lanka
- Posts
- 11,374
- Blog Entries
- 1
- Rep Power
- 18
You are using different jar file that the default one in JDK package. From where you find that? Did you find the doc related to that jar file? May be that doc explain clearly about all methods.
- 01-27-2009, 08:21 AM #3
Member
- Join Date
- Jan 2009
- Posts
- 5
- Rep Power
- 0
Well, I am only using the UberImage.java and UberColor.java classes and I have looked through both and I am pretty sure I have to use the UberColor getColor method.
This is the problem I have as I do not know how to separate the r,g,b values into variables so that I can compare it with another color. For example, the output of the getColor method returns: csimage.UberColor[r=255,g=255,b=255]
Similar Threads
-
Image Processing
By Josh_FL in forum Advanced JavaReplies: 4Last Post: 12-30-2008, 02:45 AM -
image processing
By sathish natrajan in forum Java 2DReplies: 2Last Post: 11-06-2008, 05:13 PM -
want to make a menu bar for image processing
By vidhi in forum Java 2DReplies: 1Last Post: 01-15-2008, 07:12 PM -
Converting multiple banded image into single banded image... Image enhancement
By archanajathan in forum Advanced JavaReplies: 0Last Post: 01-08-2008, 05:29 PM -
Image Processing in J2ME
By mobeenkhan in forum CLDC and MIDPReplies: 1Last Post: 08-02-2007, 05:30 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks