Back to Adaptive Vision Studio website

You are here: Start » Filter Reference » Image Thresholding » SelectThresholdValue

SelectThresholdValue


Selects best threshold value using the image histogram.

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.

Applications

Usually used before a thresholding filter when the image brightness is variable. Use with care.

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

SelectThresholdValue performed on the sample image (on the left) with inMethod = ClusteringKittler yields outThresholdValue = 189.5. Pixels of the input image brighter than 189.5 are presented on the right.

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.

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.