C# Class AForge.Imaging.Filters.OrderedDithering

Binarization with thresholds matrix.

Idea of the filter is the same as idea of Threshold filter - change pixel value to white, if its intensity is equal or higher than threshold value, or to black otherwise. But instead of using single threshold value for all pixel, the filter uses matrix of threshold values. Processing image is divided to adjacent windows of matrix size each. For pixels binarization inside of each window, corresponding threshold values are used from specified threshold matrix.

The filter accepts 8 bpp grayscale images for processing.

Sample usage:

// create binarization matrix byte[,] matrix = new byte[4, 4] { { 95, 233, 127, 255 }, { 159, 31, 191, 63 }, { 111, 239, 79, 207 }, { 175, 47, 143, 15 } }; // create filter OrderedDithering filter = new OrderedDithering( matrix ); // 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
OrderedDithering ( ) : System

Initializes a new instance of the OrderedDithering class.

OrderedDithering ( byte matrix ) : System

Initializes a new instance of the OrderedDithering class.

Protected Methods

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

Process the filter on the specified image.

Method Details

OrderedDithering() public method

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

OrderedDithering() public method

Initializes a new instance of the OrderedDithering class.
public OrderedDithering ( byte matrix ) : System
matrix byte Thresholds matrix.
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