CogHistogramResult GetMinimumWGVThreshold Method (Int32, Int32, Double )Cognex VisionPro 9.8
Returns a threshold using data from the given range of this histogram. The computed threshold is appropriate for segmenting an image into object and background pixels and is often used to compute a segmentation threshold for blob analysis. The threshold computation includes the left index value but excludes the right index value. This range must include at least two nonzero bins. The returned threshold will be within the range. This threshold divides the histogram data into two groups such that the combined variance within the groups is a minimum.

Namespace: Cognex.VisionPro.ImageProcessing
Assembly: Cognex.VisionPro.ImageProcessing (in Cognex.VisionPro.ImageProcessing.dll) Version: 75.1.0.0
Syntax

public int GetMinimumWGVThreshold(
	int leftIndex,
	int rightIndex,
	out double score
)

Parameters

leftIndex
Type: System Int32
The index of the lower bound of the partial histogram range for which to compute a threshold.
rightIndex
Type: System Int32
The index of the upper bound of the partial histogram range for which to compute a threshold. Specify a value of -1 to use the upper bound of the histogram as the upper bound of the range.
score
Type: System Double 
An output value into which a score in the range 0.0 through 1.0 is placed. Higher scores indicate better separation between the two groups determined by the threshold.

Return Value

Type: Int32
The computed threshold value.
Exceptions

ExceptionCondition
InvalidOperationExceptionIf the analyzed range of the histogram contains only empty bins.
ArgumentOutOfRangeExceptionIf either index is less than zero or greater than the length of the histogram. Or if leftIndex is greater than or equal to rightIndex.
See Also