Bilateral filter implementation - edge preserving smoothing and noise reduction that uses chromatic and spatial factors.

Namespace:  AForge.Imaging.Filters
Assembly:  AForge.Imaging (in AForge.Imaging.dll) Version: (


public class BilateralSmoothing : BaseUsingCopyPartialFilter


Bilateral filter conducts "selective" Gaussian smoothing of areas of same color (domains) which removes noise and contrast artifacts while preserving sharp edges.

Two major parameters SpatialFactor and ColorFactor define the result of the filter. By changing these parameters you may achieve either only noise reduction with little change to the image or get nice looking effect to the entire image.

Although the filter can use parallel processing large KernelSize values (greater than 25) on high resolution images may decrease speed of processing. Also on high resolution images small KernelSize values (less than 9) may not provide noticeable results.

More details on the algorithm can be found by following this link.

The filter accepts 8 bpp grayscale images and 24/32 bpp color images for processing.

Sample usage:

// create filter
BilateralSmoothing filter = new BilateralSmoothing( );
filter.KernelSize    = 7;
filter.SpatialFactor = 10;
filter.ColorFactor   = 60;
filter.ColorPower    = 0.5;
// apply the filter
filter.ApplyInPlace( image );

Initial image:

Result image:

Inheritance Hierarchy


See Also