AForge.NET

Testimonials
Features
Samples
Tools
Documentation
License
Downloads
Sources
Discussions
Partners
Projects
Members
Donate

AForge.NET Framework
2.2.5 version is available!

Nonlinear color correction filters

AForge.NET framework provides set of filters, which perform nonlinear correction of pixels' values mainly for RGB and grayscale images.

Source image #1
Source image

Contrast stretch
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 the full range of pixel values that the image type concerned allows.
Contrast stretch

Histogram equalization
The filter does histogram equalization increasing local contrast in images.
Histogram equalization


Source image #2
Source image

Color remapping
For each pixel of specified image the filter changes its values (value of each color plane) to values, which are stored in remapping arrays by corresponding indexes.

// create map
byte[] map = new byte[256];
for ( int i = 0; i < 256; i++ )
{
    map[i] = (byte) Math.Min( 255, Math.Pow( 2, (double) i / 32 ) );
}
// create filter
ColorRemapping filter = new ColorRemapping( map, map, map );
// apply the filter
filter.ApplyInPlace( image );
Color remapping

Gamma correction
The filter performs gamma correction of specified image in RGB color space.

// create filter
GammaCorrection filter = new GammaCorrection( 0.5 );
// apply the filter
filter.ApplyInPlace( image );
Gamma correction