Calculate binarization threshold for the given image.

Namespace:  AForge.Imaging.Filters
Assembly:  AForge.Imaging (in AForge.Imaging.dll) Version: 2.2.5.0 (2.2.5.0)

Syntax

C#
public int CalculateThreshold(
	BitmapData image,
	Rectangle rect
)

Parameters

image
Type: System.Drawing.Imaging..::.BitmapData
Image to calculate binarization threshold for.
rect
Type: System.Drawing..::.Rectangle
Rectangle to calculate binarization threshold for.

Return Value

Returns binarization threshold.

Remarks

The method is used to calculate binarization threshold only. The threshold later may be applied to the image using Threshold image processing filter.

Exceptions

ExceptionCondition
AForge.Imaging..::.UnsupportedImageFormatExceptionSource pixel format is not supported by the routine. It should 8 bpp grayscale (indexed) or 16 bpp grayscale image.

See Also