Replace channel of YCbCr color space.

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


public class YCbCrReplaceChannel : BaseInPlacePartialFilter


Replaces specified YCbCr channel of color image with specified grayscale imge.

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

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

Sample usage:

// create YCbCrExtractChannel filter for channel extracting
YCbCrExtractChannel extractFilter = new YCbCrExtractChannel(
                                    YCbCr.CbIndex );
// extract Cb channel
Bitmap cbChannel = extractFilter.Apply( image );
// invert the channel
Invert invertFilter = new Invert( );
invertFilter.ApplyInPlace( cbChannel );
// put the channel back into the source image
YCbCrReplaceChannel replaceFilter = new YCbCrReplaceChannel(
                                    YCbCr.CbIndex, cbChannel );
replaceFilter.ApplyInPlace( image );

Initial image:

Result image:

Inheritance Hierarchy


See Also