C# Class Accord.Imaging.Filters.Threshold

Threshold binarization.

The filter does image binarization using specified threshold value. All pixels with intensities equal or higher than threshold value are converted to white pixels. All other pixels with intensities below threshold value are converted to black pixels.

The filter accepts 8 and 16 bpp grayscale images for processing.

Since the filter can be applied as to 8 bpp and to 16 bpp images, the ThresholdValue value should be set appropriately to the pixel format. In the case of 8 bpp images the threshold value is in the [0, 255] range, but in the case of 16 bpp images the threshold value is in the [0, 65535] range.

Sample usage:

// create filter Threshold filter = new Threshold( 100 ); // apply the filter filter.ApplyInPlace( image );

Initial image:

Result image:

Inheritance: BaseInPlacePartialFilter
显示文件 Open project: accord-net/framework Class Usage Examples

Protected Properties

Property Type Description
threshold int

Public Methods

Method Description
Threshold ( ) : System

Initializes a new instance of the Threshold class.

Threshold ( int threshold ) : System

Initializes a new instance of the Threshold class.

Protected Methods

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

Process the filter on the specified image.

Method Details

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

Threshold() public method

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

Threshold() public method

Initializes a new instance of the Threshold class.
public Threshold ( int threshold ) : System
threshold int Threshold value.
return System

Property Details

threshold protected_oe property

Threshold value.
protected int threshold
return int