![]()
Color channels manipulationsAForge.NET framework provides different filters for extraction and replacement of images’ color channels. Source image RGB color space // 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 );
YCbCr color space
// 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 );
|
|||||||