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: