C# Class AForge.Imaging.Filters.ColorRemapping

Color remapping.

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:

// 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: BaseInPlacePartialFilter
Show file Open project: holisticware-admin/MonoVersal.AForgeNET

Public Methods

Method Description
ColorRemapping ( ) : System

Initializes a new instance of the ColorRemapping class.

Initializes the filter without any remapping. All pixel values are mapped to the same values.

ColorRemapping ( byte grayMap ) : System

Initializes a new instance of the ColorRemapping class.

This constructor is supposed for grayscale images.

ColorRemapping ( byte redMap, byte greenMap, byte blueMap ) : System

Initializes a new instance of the ColorRemapping class.

Protected Methods

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

Process the filter on the specified image.

Method Details

ColorRemapping() public method

Initializes a new instance of the ColorRemapping class.
Initializes the filter without any remapping. All pixel values are mapped to the same values.
public ColorRemapping ( ) : System
return System

ColorRemapping() public method

Initializes a new instance of the ColorRemapping class.
This constructor is supposed for grayscale images.
public ColorRemapping ( byte grayMap ) : System
grayMap byte Gray map.
return System

ColorRemapping() public method

Initializes a new instance of the ColorRemapping class.
public ColorRemapping ( byte redMap, byte greenMap, byte blueMap ) : System
redMap byte Red map.
greenMap byte Green map.
blueMap byte Blue map.
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