CogLineMax LineAngleTolerance Property Cognex VisionPro 9.7
Gets or sets the maximum allowable angle between the normal of a line and the ExpectedLineNormal value. Lines 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 LineAngleTolerance { get; set; }

Property Value

Type: Double
The bilateral angle in radians.
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 PI/2.
Remarks

An iterative pruning step is applied if a candidate line does not meet the line angle constraint after RANSAC iterations and refinement. Each pruning iteration attempts to remove one outmost inlier, choosing between two outmost inliers at two ends of the found line segment:

  • If only one of two outmost inliers, once removed, uniquely results in the found line satisfying the LineAngleTolerance constraint, that outmost inlier is removed and the pruning iterations are terminated.
  • If the outmost inliers, once removed, both result in the found line satisfying the LineAngleTolerance constraint, the outmost inlier in the starting end of the found line segment is removed and the pruning iterations are terminated.
  • If none of the two outmost inliers, once removed, results in the found line satisfying the LineAngleTolerance constraint, both outmost inliers are removed and the pruning iterations are continued.

In practice, the LineAngleTolerance-based pruning loops continue until the pruned line result satisfies the line angle constraint or until the number of remaining inliers becomes fewer than two and no valid line results can be found.

After pruning for LineAngleTolerance, an updated line will be recomputed from the 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 CoverageThreshold constraint to see if it is necessary to prune for coverage again.

If the found line angle still does not satisfy the LineAngleTolerance constraint when only two inliers are left, no line is considered to be found for the current candidate and all associated inliers are placed into the considered outliers collection; line finding resumes using the the updated considered outliers collection.

A larger LineAngleTolerance means the found lines are allowed to deviate more from the ExpectedLineNormal, while a smaller LineAngleTolerance means less deviation is allowed. When looking for lines that are strictly parallel to each other, a smaller LineAngleTolerance is advised. When looking for lines at different directions at the same time, a larger LineAngleTolerance is advised.

See Also