C# Class Accord.Imaging.Filters.YCbCrReplaceChannel

Replace channel of YCbCr color space.

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: BaseInPlacePartialFilter
Show file Open project: accord-net/framework Class Usage Examples

Public Methods

Method Description
YCbCrReplaceChannel ( short channel ) : System

Initializes a new instance of the YCbCrReplaceChannel class.

YCbCrReplaceChannel ( short channel, Bitmap channelImage ) : System

Initializes a new instance of the YCbCrReplaceChannel class.

YCbCrReplaceChannel ( short channel, UnmanagedImage channelImage ) : System

Initializes a new instance of the YCbCrReplaceChannel class.

Protected Methods

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

Process the filter on the specified image.

Private Methods

Method Description
YCbCrReplaceChannel ( ) : System

Method Details

ProcessFilter() protected method

Process the filter on the specified image.
Channel image was not specified. Channel image size does not match source /// image size.
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

YCbCrReplaceChannel() public method

Initializes a new instance of the YCbCrReplaceChannel class.
public YCbCrReplaceChannel ( short channel ) : System
channel short YCbCr channel to replace.
return System

YCbCrReplaceChannel() public method

Initializes a new instance of the YCbCrReplaceChannel class.
public YCbCrReplaceChannel ( short channel, Bitmap channelImage ) : System
channel short YCbCr channel to replace.
channelImage System.Drawing.Bitmap Channel image to use for replacement.
return System

YCbCrReplaceChannel() public method

Initializes a new instance of the YCbCrReplaceChannel class.
public YCbCrReplaceChannel ( short channel, UnmanagedImage channelImage ) : System
channel short YCbCr channel to replace.
channelImage UnmanagedImage Unmanaged channel image to use for replacement.
return System