Solved

# Image Manipulation Filter

Posted on 2003-03-11
Medium Priority
191 Views
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!

0
Question by:Yoohoo
[X]
###### Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

• Help others & share knowledge
• Earn cash & points

LVL 8

Expert Comment

ID: 8116681
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!
0

Author Comment

ID: 8116815
I'm confused with 'newpixel'. What is that?
0

Author Comment

ID: 8116856
I'm confused with 'newpixel'. What is that?
0

LVL 8

Accepted Solution

akshayxx earned 100 total points
ID: 8116857
well new pixel is nothing but another pixel array ,
Pixel[][] newpixel;
this i wud recommend, if u want to keep ur original image intact.
so make save the changes to this new pixel array , and make new image out of it..

0

LVL 92

Assisted Solution

objects earned 100 total points
ID: 8117001
Java already provides classes for filtering images.
Here's an example:

http://javaalmanac.com/egs/java.awt.image/FilterRgb.html
0

Expert Comment

ID: 9058758
Yoohoo:
EXPERTS:
Post your closing recommendations!  No comment means you don't care.
0

LVL 8

Expert Comment

ID: 9063772
split  betwn me and objects
0

LVL 35

Expert Comment

ID: 9714297
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

girionis
EE Cleanup Volunteer
0

## Featured Post

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
###### Suggested Courses
Course of the Month9 days, 11 hours left to enroll