Link to home
Start Free TrialLog in
Avatar of Yoohoo
Yoohoo

asked on

Image Manipulation Filter

I want to manipulate an image--pixel by pixel--so that when I apply the filter to the image, the resulting image is different from the original.

For one filter, I want to create a watercolor effect to the image. For another, I want to greyscale the image. However, I don't really know how to do either....

I have something like this:

public class EffectFilter implements Filter {
 
  public void filter(PixelImage pi) {
    Pixel[][] data = pi.getData();
   
    for (int row = 0; row < pi.getWidth(); row++) {
      for (int col = 0; col < pi.getHeight(); col++) {
        /** Create an effect for every pixel of the image */
      }
    }
  }
   
This is for an intro java programming class, so I'm a beginner.

Any help appreciated. Thanks!

Avatar of akshayxx
akshayxx
Flag of United States of America image

Hi Yoohoo,
Water color effect will require lot of mathemetics,
though converting to gray scale is pretty stright forward.
take the R, G, B values and take the 'average' and then set each of the R,G,B to the average value..
many people dont take just simple average .. rather a weighted average .. but the key is that whatever calculation you do .. set the newpixel.R=newpixel.G=newpixel.B=new average value
if u take simple arithmetic mean .. it will also give decent result..
and when u r done with changing the pixel values .. save it to the new image.. ( create the new Image with new pixel values)
and for the water color effect . .. check google for the mathemetical operations required for that.

Cheers!
Avatar of Yoohoo
Yoohoo

ASKER

I'm confused with 'newpixel'. What is that?
Avatar of Yoohoo

ASKER

I'm confused with 'newpixel'. What is that?
ASKER CERTIFIED SOLUTION
Avatar of akshayxx
akshayxx
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Avatar of Mick Barry
Mick Barry
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Yoohoo:
This old question needs to be finalized -- accept an answer, split points, or get a refund.  For information on your options, please click here-> http:/help/closing.jsp#1 
EXPERTS:
Post your closing recommendations!  No comment means you don't care.
split  betwn me and objects
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:

- Split points between akshayxx and objects

Please leave any comments here within the next seven days.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

girionis
EE Cleanup Volunteer