/Users/lyon/j4p/src/j2d/filters/BlurFilter.java
|
1 // BlurFilter.java
2 // Blurfilter is an Java2DImageFilter that blurs a BufferedImage.
3 package j2d.filters;
4
5 import j2d.ImageUtils;
6 import ip.transforms.BufferedImageProcessor;
7
8 import java.awt.image.BufferedImage;
9
10 public class BlurFilter implements BufferedImageProcessor {
11
12 // apply blurring filter to BufferedImage
13 public BufferedImage process(BufferedImage bi) {
14 // array used to blur BufferedImage
15 float[][] blurMatrix = {
16 {1.0f / 9.0f, 1.0f / 9.0f, 1.0f / 9.0f},
17 {1.0f / 9.0f, 1.0f / 9.0f, 1.0f / 9.0f},
18 {1.0f / 9.0f, 1.0f / 9.0f, 1.0f / 9.0f}};
19
20 return ImageUtils.convolve(bi, blurMatrix);
21
22 } // end method processImage
23
24 }