Color remapping.

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

Syntax

C#
public class ColorRemapping : BaseInPlacePartialFilter

Remarks

The filter allows to remap colors of the image. Unlike LevelsLinear filter the filter allow to do non-linear 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. For example, if pixel's RGB value equals to (32, 96, 128), the filter will change it to (RedMap[32], GreenMap[96], BlueMap[128]).

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

Sample usage:

CopyC#
// 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 );

Initial image:

Result image:

Inheritance Hierarchy

System..::.Object
  AForge.Imaging.Filters..::.BaseInPlacePartialFilter
    AForge.Imaging.Filters..::.ColorRemapping

See Also