ProgramWindowJava

Image

I want to "transform" a image according to this:

http://homepages.inf.ed.ac.uk/rbf/HIPR2/dilate.htm

How can i do that? THNX!

I tried that but it doesn't work:

public static BufferedImage dilatation(BufferedImage aImage)
{
// i use a black&white picture
BufferedImage tmpBufImage = aImage;
int rgb;
rgb = 0x00000000; //black ; i consider the background white
//and the object that i want to dilate black

for (int i = 0; i < aImage.getHeight(); i++)
{
for (int j = 0; j < aImage.getWidth(); j++)
{
if ((i - 1) % 3 == 0 && i > 0 && (j - 1) % 3 == 0 && j > 0)
// with this condition i don't want to go out of the "matrix"; i don't think is good
{
try
{
Color c = new Color(aImage.getRGB(i, j));

if(c.getBlue()==0) //if the pixel is black,the blue is 0
{

//here i try to make all the pixel around the black pixel, black
tmpBufImage.setRGB(i, j, rgb);
tmpBufImage.setRGB(i - 1, j, rgb);
tmpBufImage.setRGB(i, j - 1, rgb);
tmpBufImage.setRGB(i, j + 1, rgb);
tmpBufImage.setRGB(i + 1, j, rgb);
tmpBufImage.setRGB(i - 1, j - 1, rgb);
tmpBufImage.setRGB(i + 1, j - 1, rgb);
tmpBufImage.setRGB(i - 1, j + 1, rgb);
tmpBufImage.setRGB(i + 1, j + 1, rgb);
}
}
catch (Exception ex)
{
ex.printStackTrace(System.out);
}
}
}
}
return tmpBufImage;
}



Java

Java Swing JTree update content
Write objects to file using Externalizable
image displaying in jsp
Oracle VARRAY always returns '???' through JDBC
Changing Content in Container
Big troubles
clone an object without change class?
Loop converting to hex - please help
How to make http connection using java
code to create XML for content management
subtracting days from GregorianCalendar
Please! Help me...
Painting Problem
List<Sring> problem
Retrieve Japanese Characters from Database
Evaluate Sybase return code
file I/O on clients computer using JSP??
Help newbie,please!
Naming a tree node
EJB problem