skytreader
July 26th, 2011, 09:17 AM
Hello. I'm trying out some simple image blurring in Java. I currently have the following code:
public class ImageBlurring{
public static void main(String[] args) throws Exception{
float[] kernelData = {0.111f, 0.111f, 0.111f,
0.111f, 0.111f, 0.111f,
0.111f, 0.111f, 0.111f};
ConvolveOp bio = new ConvolveOp(new Kernel(3, 3, kernelData));
BufferedImage forBlurring = ImageIO.read(new File("testimages/blurtest.JPG"));
BufferedImage blurred = ImageIO.read(new File("testimages/blurred.JPG"));
BufferedImage blurOut = bio.filter(forBlurring, blurred);
}
}
Uhmm...I'm really new here so my set-up is like this: blurtest.JPG is the image I want to blur; blurred.JPG is an exact copy of blurtest.JPG---I wish it to contain the blurred version of blurtest.JPG but it is not yet blurred.
So, I run my little command line program and all seem to go fine. However, I can't find the my blurred image anywhere. blurred.JPG is not blurred and nothing happened to blurtest.JPG as well . So...where do I find it?
P.S. Maybe my image is too textured for me to notice the blur that took place? I'm using an image of a coral. Does the image's texture affect blurring?
public class ImageBlurring{
public static void main(String[] args) throws Exception{
float[] kernelData = {0.111f, 0.111f, 0.111f,
0.111f, 0.111f, 0.111f,
0.111f, 0.111f, 0.111f};
ConvolveOp bio = new ConvolveOp(new Kernel(3, 3, kernelData));
BufferedImage forBlurring = ImageIO.read(new File("testimages/blurtest.JPG"));
BufferedImage blurred = ImageIO.read(new File("testimages/blurred.JPG"));
BufferedImage blurOut = bio.filter(forBlurring, blurred);
}
}
Uhmm...I'm really new here so my set-up is like this: blurtest.JPG is the image I want to blur; blurred.JPG is an exact copy of blurtest.JPG---I wish it to contain the blurred version of blurtest.JPG but it is not yet blurred.
So, I run my little command line program and all seem to go fine. However, I can't find the my blurred image anywhere. blurred.JPG is not blurred and nothing happened to blurtest.JPG as well . So...where do I find it?
P.S. Maybe my image is too textured for me to notice the blur that took place? I'm using an image of a coral. Does the image's texture affect blurring?