Start » Filter Reference » Image » Image Thresholding » SelectThresholdValue
Module: | FoundationBasic |
---|
Selects best threshold value using the image histogram.
Applications
Usually used before a thresholding filter when the image brightness is variable. Use with care.
Name | Type | Description | |
---|---|---|---|
inImage | Image | Input image | |
inRoi | Region* | Range of pixels to be processed | |
inMethod | ThresholdSelectionMethod | Method used to select the best threshold | |
outThresholdValue | Real | Best threshold separating background pixels from foreground pixels | |
diagThresholdRatings | RealArray | Contains ratings gained if that threshold would be chosen | |
diagBackgroundPixelsFraction | RealArray | Fraction of pixels that are darker than the index value | |
diagForegroundPixelsFraction | RealArray | Fraction of pixels that are brighter than the index value |
Requirements
For input inImage only pixel formats are supported: uint8.
Read more about pixel formats in Image documentation.
Description
The operation estimates an intensity threshold value that discriminates foreground pixels from background pixels in inImage.
Note that to provide meaningful results it is required that the image in fact consists of foreground and background components that strongly differ in brightness.
Hints
- Choose inMethod that works best in your application. None of the methods is perfect, but ClusteringOtsu is the most universal one.
Examples
Errors
This filter can throw an exception to report error. Read how to deal with errors in Error Handling.
List of possible exceptions:
Error type | Description |
---|---|
DomainError | Region exceeds an input image in SelectThresholdValue. |
DomainError | Not supported inImage pixel format in SelectThresholdValue. Supported formats: UInt8. |
Complexity Level
This filter is available on Advanced Complexity Level.
See Also
- ThresholdImage – Transforms each pixel value to maximum or minimum depending on whether they belong to the specified range.