AForge.NET

Testimonials
Features
Samples
Tools
Documentation
License
Downloads
Sources
Discussions
Partners
Projects
Members
Donate

AForge.NET Framework
2.2.5 version is available!

Convolution filters

AForge.NET framework provides convolution filter and a set of derived filters, which allow to perform image convolution with common kernels.

Below is the list of implemented convolution filters and the result of their application to the below source image.

Source image
Source image

Convolution
The filter implements convolution operator, which calculates each pixel of the result image as weighted sum of the correspond pixel and its neighbors in the source image.

// define emboss kernel
int[,] kernel = {
            { -2, -1,  0 },
            { -1,  1,  1 },
            {  0,  1,  2 } };
// create filter
Convolution filter = new Convolution( );
// apply the filter
filter.ApplyInPlace( image );
Convolution filter with emboss kernel
(Note: The image was grayscaled before applying convolution)

Blur
The filter performs convolution filter using a blur kernel.
Blur filter

Sharpen
The filter performs convolution filter using a sharpen kernel.
Sharpen filter

Edges
The filter performs convolution filter using a edges kernel.
Edges filter

Gaussian Blur
The filter performs convolution filter using a blur kernel, which is calculate with the help of Kernel2D(Int32) method.

// create filter with kernel size equal to 11
// and Gaussia sigma value equal to 4.0
GaussianBlur filter = new GaussianBlur( 4, 11 );
// apply the filter
filter.ApplyInPlace( image );
Gaussian Blur filter

Gaussian Sharpen
The filter performs convolution filter using a sharpen kernel, which is calculate with the help of Kernel2D(Int32) method.

// create filter with kernel size equal to 11
// and Gaussia sigma value equal to 4.0
GaussianSharpen filter = new GaussianSharpen( 4, 11 );
// apply the filter
filter.ApplyInPlace( image );
Gaussian Sharpen filter