C# Class Accord.Imaging.Filters.ContrastStretch

Contrast stretching filter.

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: BaseInPlacePartialFilter
ファイルを表示 Open project: accord-net/framework Class Usage Examples

Public Methods

Method Description
ContrastStretch ( ) : Accord

Initializes a new instance of the ContrastStretch class.

Protected Methods

Method Description
ProcessFilter ( UnmanagedImage image, Rectangle rect ) : void

Process the filter on the specified image.

Method Details

ContrastStretch() public method

Initializes a new instance of the ContrastStretch class.
public ContrastStretch ( ) : Accord
return Accord

ProcessFilter() protected method

Process the filter on the specified image.
protected ProcessFilter ( UnmanagedImage image, Rectangle rect ) : void
image UnmanagedImage Source image data.
rect System.Drawing.Rectangle Image rectangle for processing by the filter.
return void