CogPMRedLineRunParams ContrastFractionThreshold Property Cognex VisionPro 9.7
Gets or sets the threshold for the contrast fraction of a result. Only instances of the pattern that have a contrast fraction greater than or equal to this threshold are accepted. Valid range is from zero to one.

Namespace: Cognex.VisionPro.PMRedLine
Assembly: Cognex.VisionPro.PMRedLine (in Cognex.VisionPro.PMRedLine.dll) Version: 73.0.0.0
Syntax

public double ContrastFractionThreshold { get; set; }

Property Value

Type: Double
The threshold for the contrast fraction. Default value is zero.
Events

Event TypeReason
ICogChangedEvent Changed Fires when this property changes. The following state flag may be affected:
Exceptions

ExceptionCondition
ArgumentOutOfRangeException The supplied value is less than zero or greater than one.
Remarks

The contrast fraction is a number between zero and one. It is computed by dividing the average contrast of the matching image features by the average contrast of the trained pattern features. If this ratio exceeds one it is reported as exactly one.

You can discard results with very low contrast (relative to the pattern) by setting the ContrastFractionThreshold. You should supply a non-zero value that is lower than the lowest contrast fraction you ever expect to receive from a true instance of your pattern.

There are several parameters that affect how PMRedLine reports results. If the ReturnAllResults property of CogPMRedLineRunParams is "false", every returned result will have its Accepted property set to "true", and a result will be returned only if all of the following conditions are met:

If, however, ReturnAllResults is "true", additional pattern instances may be reported as results. You can use the value of Accepted to determine why the additional result was excluded initially.

If Accepted is "true" the additional result was excluded solely because the NumberToFind was set too low. This could happen, for example, if your input image contains five instances of the pattern but you set NumberToFind to only find three. In this case you might get two additional results that meet all of the acceptance conditions listed above, but were excluded from the results solely because they were not among the three highest-scoring instances.

If Accepted is "false" the additional result was excluded because it has one or more of the following:

See Also