Deconvolution Filters

Deconvolution Kernel Filter

         Deconvolution serves as the inverse matrix operation to a convolution filter. If a convolution transformation is applied, such as with the Gaussian blur kernel filter, attempting to reverse this operation cannot fully restore the original image due to the averaging of pixel values and the loss of some details. However, deconvolution is valuable for image restoration and deblurring.

         In the example below we apply the Gaussian blur convolution filter and then restore the original image with Deconvolution filer:

// gaussian 3x3 convolution kernel
{
  {1, 2, 1,},
  {2, 4, 2,},
  {1, 2, 1,},
};
DeconvolutionFilterOptions(ConvolutionFilter.GetGaussian(Size, Sigma))

         The restored image is not identical to the original, but it exhibits more details after the deblurring process.

Original image
Deconvolution filter
Original landscape image
Deconvolution Gaussian blur kernel filter
Deconvolution kernel filter

C# code example

         The full C# code example below shows the usage of the Aspose.Imaging .NET API. You can utilize the `ConvolutionFilter` class with "GetGaussian" blurring method and subsequently deblur using the DeconvolutionFilterOptions. In this example, image templates in PNG and SVG formats are loaded from the "templates" folder, and filters are applied from a predefined list.