Contrast stretching filter.

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


public class ContrastStretch : BaseInPlacePartialFilter


Contrast stretching (or as it is often called normalization) is a simple image enhancement technique that attempts to improve the contrast in an image by 'stretching' the range of intensity values it contains to span a desired range of values, e.g. the full range of pixel values that the image type concerned allows. It differs from the more sophisticated histogram equalization in that it can only apply a linear scaling function to the image pixel values.

The result of this filter may be achieved by using ImageStatistics class, which allows to get pixels' intensities histogram, and LevelsLinear filter, which does linear correction of pixel's intensities.

The filter accepts 8 bpp grayscale and 24 bpp color images.

Sample usage:

// create filter
ContrastStretch filter = new ContrastStretch( );
// process image
filter.ApplyInPlace( sourceImage );

Source image:

Result image:

Inheritance Hierarchy


See Also