C# Class AForge.Imaging.Filters.ContrastCorrection

Contrast adjusting in RGB color space.

The filter operates in RGB color space and adjusts pixels' contrast value by increasing RGB values of bright pixel and decreasing RGB values of dark pixels (or vise versa if contrast needs to be decreased). The filter is based on LevelsLinear filter and simply sets all input ranges to (Factor, 255-Factor) and all output range to (0, 255) in the case if the factor value is positive. If the factor value is negative, then all input ranges are set to (0, 255 ) and all output ranges are set to (-Factor, 255_Factor).

See LevelsLinear documentation forr more information about the base filter.

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

Sample usage:

// create filter ContrastCorrection filter = new ContrastCorrection( 15 ); // apply the filter filter.ApplyInPlace( image );

Initial image:

Result image:

Inheritance: BaseInPlacePartialFilter
Show file Open project: holisticware-admin/MonoVersal.AForgeNET Class Usage Examples

Public Methods

Method Description
ContrastCorrection ( ) : System

Initializes a new instance of the ContrastCorrection class.

ContrastCorrection ( int factor ) : System

Initializes a new instance of the ContrastCorrection class.

Protected Methods

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

Process the filter on the specified image.

Method Details

ContrastCorrection() public method

Initializes a new instance of the ContrastCorrection class.
public ContrastCorrection ( ) : System
return System

ContrastCorrection() public method

Initializes a new instance of the ContrastCorrection class.
public ContrastCorrection ( int factor ) : System
factor int Contrast adjusting factor.
return System

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