Blur Filters

Blur Box Kernel Filter in Python

         Filling the kernel matrix with uniform elements and maintaining a cumulative sum of 1 allows for the calculation of the average value within the surrounding pixel area, utilizing a 5x5 matrix. The resulting pixel value is determined by summing the 1/25 values or 4% from all adjacent pixels. This specific kernel matrix is identified as a 'Blur Box.' The augmentation of matrix dimensions enhances the blurring effect proportionally.

# Blur Box 5x5 uniform kernel
[
    [ 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 initiates a gradual change in pixel values among neighboring elements, effectively introducing a blur to the image. It assists in reducing noise, lowering sharpness, and yielding a soft, indistinct visual outcome.

Original image
Blur filter
Original vector image
Blur Box 5x5 uniform kernel filter in Python
Blur Box kernel filter

Python code example

         The provided Python code example demonstrates the utilization of the Aspose.Imaging Python API. Utilize the `ConvolutionFilter` class, which provides pre-defined kernel filters, including get_blur_box() with adjustable size settings. Furthermore, you retain the flexibility to craft your custom kernel matrix. In this example, image templates in raster PNG and vector SVG formats are loaded from the "templates" folder, and a set of filters are applied from a predefined list.