Replace RGB channel of color imgae.

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

Syntax

C#
public class ReplaceChannel : BaseInPlacePartialFilter

Remarks

Replaces specified RGB channel of color image with specified grayscale image.

The filter is quite useful in conjunction with ExtractChannel filter (however may be used alone in some cases). Using the ExtractChannel filter it is possible to extract one of RGB channel, perform some image processing with it and then put it back into the original color image.

The filter accepts 24, 32, 48 and 64 bpp color images for processing.

Sample usage:

CopyC#
// extract red channel
ExtractChannel extractFilter = new ExtractChannel( RGB.R );
Bitmap channel = extractFilter.Apply( image );
// threshold channel
Threshold thresholdFilter = new Threshold( 230 );
thresholdFilter.ApplyInPlace( channel );            
// put the channel back
ReplaceChannel replaceFilter = new ReplaceChannel( RGB.R, channel );
replaceFilter.ApplyInPlace( image );

Initial image:

Result image:

Inheritance Hierarchy

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

See Also