Blur Filters

Blur Box Kernel Filter in Java

         By setting the average value of a 3x3 pixel neighborhood, you can fill the kernel matrix with uniform elements, ensuring a cumulative sum of 1. The resulting pixel value is calculated by summing up 1/9 of the values from all adjacent pixels. This specific kernel matrix is commonly identified as a `Blur Box`. The blurring effect can be heightened by enlarging the matrix dimensions.

// Blur Box 3x3 kernel
{
  { 0.111, 0.111, 0.111 },
  { 0.111, 0.111, 0.111 },
  { 0.111, 0.111, 0.111 },
};

         This procedure leads to a gradual shift in pixel values between neighboring elements, effectively inducing a blur in the image. It aids in noise reduction, diminishes sharpness, and produces a soft, indistinct appearance.

Original image
Blur filter
Original photo before kernel filter
Blur Box 3x3 kernel filter in Java
Blur Box kernel filter

Java code example

         Illustrating the utilization of the Aspose.Imaging API for Java, the subsequent code example showcases the use of the `ConvolutionFilter` class. This class provides pre-defined kernel filters, including GetBlurBox() with adjustable size settings. Moreover, you retain the option to craft your personalized kernel matrix. In this instance, templates in PNG and SVG formats are loaded from the "templates" folder, and a set of filters is applied from a predefined list.