Back to Adaptive Vision Library website
You are here: Start » Function Reference » Image Thresholding » SelectThresholdValue
SelectThresholdValue
Selects best threshold value using the image histogram.
Syntax
C++
C#
void avl::SelectThresholdValue ( const avl::Image& inImage, atl::Optional<const avl::Region&> inRoi, avl::ThresholdSelectionMethod::Type inMethod, float& outThresholdValue, atl::Array<float>& diagThresholdRatings, atl::Array<float>& diagBackgroundPixelsFraction, atl::Array<float>& diagForegroundPixelsFraction )
Parameters
Name | Type | Default | Description | |
---|---|---|---|---|
inImage | const Image& | Input image | ||
inRoi | Optional<const Region&> | NIL | Range of pixels to be processed | |
inMethod | ThresholdSelectionMethod::Type | Method used to select the best threshold | ||
outThresholdValue | float& | Best threshold separating background pixels from foreground pixels | ||
diagThresholdRatings | Array<float>& | Contains ratings gained if that threshold would be chosen | ||
diagBackgroundPixelsFraction | Array<float>& | Fraction of pixels that are darker than the index value | ||
diagForegroundPixelsFraction | Array<float>& | Fraction of pixels that are brighter than the index value |
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.