Java Utililty Methods Image Blur

List of utility methods to do Image Blur

Description

The list of methods to do Image Blur are organized into topic(s).

Method

BufferedImageblur(BufferedImage image, Kernel kernel)
Apply blur filter to the given image.
final int width = image.getWidth();
final int height = image.getHeight();
BufferedImage result = new BufferedImage(width, height, image.getType());
int[] in = new int[width * height];
int[] out = new int[width * height];
image.getRGB(0, 0, width, height, in, 0, width);
convolve(kernel, in, out, width, height);
convolve(kernel, out, in, height, width);
...
voidblur(int[] srcPixels, int[] dstPixels, int width, int height, float[] kernel, int radius)

Blurs the source pixels into the destination pixels.

float a;
float r;
float g;
float b;
int ca;
int cr;
int cg;
int cb;
...
BufferedImageblurImage(BufferedImage image, float blurValue)
Blurs an image.
float middle = blurValue;
float value = (1.f - middle) / 8f;
float[] BLUR = new float[] { value, value, value, value, middle, value, value, value, value };
ConvolveOp vBlurOp = new ConvolveOp(new Kernel(3, 3, BLUR));
return vBlurOp.filter(image, null);
BufferedImageblurImage(BufferedImage img, BufferedImage dest)
blur Image
Kernel kernel = new Kernel(3, 3,
        new float[] { 1f / 9f, 1f / 9f, 1f / 9f, 1f / 9f, 1f / 9f, 1f / 9f, 1f / 9f, 1f / 9f, 1f / 9f });
ConvolveOp cop = new ConvolveOp(kernel);
return cop.filter(img, dest);
voidblurPass(int[] srcPixels, int[] dstPixels, int width, int height, int radius)

Blurs the source pixels into the destination pixels.

final int windowSize = radius * 2 + 1;
final int radiusPlusOne = radius + 1;
int sumRed;
int sumGreen;
int sumBlue;
int sumAlpha;
int srcIndex = 0;
int dstIndex;
...
BufferedImageblurredImage(BufferedImage source, double radius)
Applies a gaussian blur of the given radius to the given BufferedImage using a kernel convolution.
if (radius == 0) {
    return source;
final int r = (int) Math.ceil(radius);
final int rows = r * 2 + 1;
final float[] kernelData = new float[rows * rows];
final double sigma = radius / 3;
final double sigma22 = 2 * sigma * sigma;
...