Blur Filters

Blur Box Kernel Filter

         By filling the kernel matrix with uniform elements and ensuring a total sum of 1, you can determine the average value of the surrounding pixel area with a size of 5x5. The resulting pixel value is then computed as the sum of 1/25 values from all surrounding pixels. This particular kernel matrix is recognized as a 'Blur Box'. Increasing the dimensions of the matrix will intensify the blurring effect.

// Blur Box 5x5 kernel
double[,] customKernel = new double[,]
{
    { 0.04, 0.04, 0.04, 0.04, 0.04,},
    { 0.04, 0.04, 0.04, 0.04, 0.04,},
    { 0.04, 0.04, 0.04, 0.04, 0.04,},
    { 0.04, 0.04, 0.04, 0.04, 0.04,},
    { 0.04, 0.04, 0.04, 0.04, 0.04,},
};

         This process results in a gradual transition between neighboring pixel values, effectively blurring the image, helping eliminate noise, reducing sharpness and creating a smooth, vague appearance.

Original image
Blur filter
Original photo before emboss filter
Blur Box 5x5 kernel filter
Blur Box kernel filter

C# code example

         The following C# code example illustrates the usage of the Aspose.Imaging .NET API. You can employ the `ConvolutionFilter` class, which offers predefined kernel filters such as GetBlurBox() with size settings. Additionally, you have the flexibility to create your custom kernel matrix. In this example, image templates in PNG and SVG formats are loaded from the "templates" folder, and filters are applied from a predefined list.