CogLineMax CoverageThreshold Property Cognex VisionPro 9.7
Gets or sets the minimum acceptable proportion of inliers relative to the number of intersected projection regions. Line segments must meet this constraint to become results.

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

public double CoverageThreshold { get; set; }

Property Value

Type: Double
The coverage threshold.
Events

Event TypeReason
ICogChangedEvent Changed

Fires when this property changes.

The following state flag may be affected:

Exceptions

ExceptionCondition
ArgumentOutOfRangeException Thrown when you assign a value less than zero or greater than one.
Remarks

Use this property to ignore small gaps in lines or to consolidate collinear lines.

A value of 0.5 means allow for gaps, spans where edges were expected but not detected, along fifty percent of a line. Whereas 1.0 means find only lines having no gaps.

Since only one inlier is allowed per projection region, the maximum possible number of inliers is defined by the number of projection regions intersected by the found line segment. I.e. maximum inliers is the number of projection regions under the total span of the found line segment. The coverage threshold respects masks; therefore, only edge points and projection regions in "care" regions effect the coverage measurement.

An iterative pruning step is applied if a candidate line does not meet the coverage threshold after RANSAC iterations and refinement. Projection regions under the span of the candidate line are grouped into runs (consecutive projection regions with inliers are encoded into runs of 1, and consecutive projection regions without inliers are encoded into runs of 0). Each pruning iteration attempts to remove one 1-run, choosing between two 1-runs at two ends of the found line segment:

  • If only one of two 1-runs, once removed, uniquely increases the coverage score to above CoverageThreshold, that 1-run is removed and the pruning iterations are terminated.
  • If the two 1-runs, once removed, both increase the coverage score to above CoverageThreshold, the shorter 1-run is removed and the pruning iterations are terminated.
  • If none of the two 1-runs, once removed, increases the coverage score to above CoverageThreshold, the 1-run resulting in a higher coverage score is removed and the pruning iterations are continued.

For example, consider a candidate line with 10 projection regions with three separate 1-runs: 1000010011 (where 1 indicates a projection region with one inlier and 0 indicates a projection region with no inliers). Its initial coverage score would be (1 + 1 + 2) / 10 = 4 / 10 = 0.4. If the CoverageThreshold is set to 0.5, pruning will be performed on the candidate line. The first pruning iteration looks at the 1-run at the left end and the 1-run at the right end (note the two ends of a found line segment should always be projection regions with inliers, i.e., 1's):

  • If the left 1-run is removed, the line becomes 10011 and the coverage score becomes (1 + 2) / 5 = 3 / 5 = 0.6.
  • If the right 1-run is removed, the line becomes 100001 and the coverage score becomes (1 + 1) / 6 = 2 / 6 = 0.333.

With the CoverageThreshold set to 0.5, the left 1-run will be removed and the corresponding pruned line will be returned with coverage score of 0.6. In practice, the CoverageThreshold-based pruning loops continue until the pruned line result satisfies the CoverageThreshold constraint or until the number of remaining inliers becomes fewer than two and no valid line results can be found.

After exiting the CoverageThreshold-based pruning loops, an updated line model will be re-computed from remaining inliers. The edge point subset will be compared against the updated line model to obtain an updated inlier list and the edge point runs are re-encoded. Based on the updated line model, the inlier/outlier point subset will also be updated to discard points outside the span of the updated line segment. The updated line result is then examined against the LineAngleTolerance constraint to see if it is necessary to prune for LineAngleTolerance.

If the coverage score is still lower than CoverageThreshold after all 1-runs are removed, no line is considered found and all associated inliers are placed into ConsideredOutliers; then line finding resumes using the updated considered outliers collection.

A larger CoverageThreshold results in lines with more inliers under its span, i.e., more 'solid' lines. The found lines may appear shorter in length, due to the internal pruning process in order to meet the CoverageThreshold requirement. A smaller CoverageThreshold allows lines with fewer inliers under its span. The found lines may appear longer in length but may sometimes be undesired lines consisting of very few inliers (e.g., only two or three inliers). It is advised that the user adjust the CoverageThreshold and LengthThreshold simultaneously to meet the line finding requirements.

See Also