CogOCRMaxSegmenter ForegroundThresholdFrac Property Cognex VisionPro
A modifier in the range [0, 1] that is used to compute the binarization threshold, in the normalized image, that binarizes between foreground and background.

Namespace: Cognex.VisionPro.OCRMax
Assembly: Cognex.VisionPro.OCRMax (in Cognex.VisionPro.OCRMax.dll) Version: 65.1.0.0
Syntax

public double ForegroundThresholdFrac { get; set; }

Property Value

Type: Double
The ForegroundThresholdFrac value. The default value is 0.5.
Events

Event TypeReason
ICogChangedEvent Changed

Fires when this property changes.

The following state flag may be affected:

  • SfForegroundThresholdFrac
Exceptions

ExceptionCondition
ArgumentOutOfRangeException Thrown if set to a value less than 0.0 or greater than 1.0
Remarks

When the input character polarity is LightOnDark:

Threshold = round(max((1 - ForegroundThresholdFrac) * 255, 1))

Invert = false

A value of zero results in a binarization threshold value of 255, indicating that only the pixels with value 255 (considered most certain to be foreground) should be treated as foreground. A value of one gives a binarization threshold value of 1, indicating that all pixels should be treated as foreground except for those with the value 0 (considered most certain to be background) should be treated as background.

When the input character polarity is DarkOnLight:

Threshold = round(max(ForegroundThresholdFrac * 255, 1))

Invert = true

A value of zero results in a binarization threshold value of 1, indicating that only the pixels with value 0 (considered most certain to be foreground) should be treated as foreground. A value of one gives a threshold value of 255, indicating that all pixels should be treated as foreground except for those with the value 255 (considered most certain to be background) should be treated as background.

In summary, a value of zero indicates that only the pixels considered most certain to be foreground should be treated as foreground, and a value of one indicates that all pixels should be treated as foreground except for those considered most certain to be background.

Stage: Binarize

See Also