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(
	UnmanagedImage image,
	Rectangle rect
)

Parameters

image
Type: AForge.Imaging..::.UnmanagedImage
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