C# Class AForge.Imaging.Filters.ChannelFiltering

Channels filters.

The filter does color channels' filtering by clearing (filling with specified values) values, which are inside/outside of the specified value's range. The filter allows to fill certain ranges of RGB color channels with specified value.

The filter is similar to ColorFiltering, but operates with not entire pixels, but with their RGB values individually. This means that pixel itself may not be filtered (will be kept), but one of its RGB values may be filtered if they are inside/outside of specified range.

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

Sample usage:

// create filter ChannelFiltering filter = new ChannelFiltering( ); // set channels' ranges to keep filter.Red = new IntRange( 0, 255 ); filter.Green = new IntRange( 100, 255 ); filter.Blue = new IntRange( 100, 255 ); // apply the filter filter.ApplyInPlace( image );

Initial image:

Result image:

Inheritance: BaseInPlacePartialFilter
Show file Open project: holisticware-admin/MonoVersal.AForgeNET Class Usage Examples

Public Methods

Method Description
ChannelFiltering ( ) : System

Initializes a new instance of the ChannelFiltering class.

ChannelFiltering ( IntRange red, IntRange green, IntRange blue ) : System

Initializes a new instance of the ChannelFiltering class.

Protected Methods

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

Process the filter on the specified image.

Private Methods

Method Description
CalculateMap ( IntRange range, byte fill, bool fillOutsideRange, byte map ) : void

Calculate filtering map.

Method Details

ChannelFiltering() public method

Initializes a new instance of the ChannelFiltering class.
public ChannelFiltering ( ) : System
return System

ChannelFiltering() public method

Initializes a new instance of the ChannelFiltering class.
public ChannelFiltering ( IntRange red, IntRange green, IntRange blue ) : System
red AForge.IntRange Red channel's filtering range.
green AForge.IntRange Green channel's filtering range.
blue AForge.IntRange Blue channel's filtering range.
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