SelectThresholdValue


Selects best threshold value using the image histogram.

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

Syntax

C++
C#
Python
 
def SelectThresholdValue(
	inImage: Image,
	/,
	*,
	inRoi: Region | None = None,
	inMethod: ThresholdSelectionMethod = ThresholdSelectionMethod.ClusteringKittler
)
-> (
	outThresholdValue: float,
	diagThresholdRatings: list[float],
	diagBackgroundPixelsFraction: list[float],
	diagForegroundPixelsFraction: list[float]
)

Parameters

Name Type Default Description
Input value inImage Image Input image
Input value inRoi Region | None None Range of pixels to be processed
Input value inMethod ThresholdSelectionMethod ThresholdSelectionMethod.ClusteringKittler Method used to select the best threshold
Output value outThresholdValue float Best threshold separating background pixels from foreground pixels
Diagnostic input diagThresholdRatings list[float] Contains ratings gained if that threshold would be chosen
Diagnostic input diagBackgroundPixelsFraction list[float] Fraction of pixels that are darker than the index value
Diagnostic input diagForegroundPixelsFraction list[float] Fraction of pixels that are brighter than the index value