LineMaxOperator ClassCognex VisionPro 9.21

This class provides functionality for finding lines in images. It will return candidate lines that meet the requirements specified by its properties.

Inheritance Hierarchy

System Object
  Cognex.Vision ShareableBase
    Cognex.Vision ChangedEventShareableBase
      Cognex.Vision.LineMax.Implementation LineMaxOperatorBase
        Cognex.Vision.LineMax LineMaxOperator

Namespace: Cognex.Vision.LineMax
Assembly: Cognex.Vision.LineMax.Net (in Cognex.Vision.LineMax.Net.dll) Version: 9.21.0.0
Syntax

public sealed class LineMaxOperator : LineMaxOperatorBase, 
	IObject

The LineMaxOperator type exposes the following members.

Constructors

  NameDescription
Public methodLineMaxOperator

Constructs a new instance of this class.

Top
Methods

  NameDescription
Public methodEquals
Compares the equality of this object with another.
(Overrides LineMaxOperatorBase Equals(Object).)
Public methodExecute(IImage, IRegion)

Performs line finding on the supplied image. The inspection results are stored in a LineMaxResults object.

(Overrides LineMaxOperatorBase Execute(IImage, IRegion).)
Public methodExecute(IImageCollection, IRegionCollection)

Performs line finding on the supplied image. The inspection results are stored in a LineMaxResults object.

(Overrides LineMaxOperatorBase Execute(IImageCollection, IRegionCollection).)
Public methodExecute(IImage, IRegion, Image8Grey, Int32, Int32)

Performs line finding on the supplied image. The inspection results are stored in a LineMaxResults object.

(Overrides LineMaxOperatorBase Execute(IImage, IRegion, Image8Grey, Int32, Int32).)
Public methodExecute(IImageCollection, IRegionCollection, Image8GreyCollection, Int32Collection, Int32Collection)

Performs line finding on the supplied image. The inspection results are stored in a LineMaxResults object.

(Overrides LineMaxOperatorBase Execute(IImageCollection, IRegionCollection, Image8GreyCollection, Int32Collection, Int32Collection).)
Public methodGetHashCode
Returns the hash code of this object.
(Overrides LineMaxOperatorBase GetHashCode .)
Public methodGetType
Gets the Type of the current instance.
(Inherited from Object.)
Public methodGetTypeMeta

Get the TypeMeta that describes the type of this object.

(Overrides ShareableBase GetTypeMeta .)
Public methodResumeAndRaiseChangedEvent

Re-enables raising of the ChangedEvent after SuspendChangedEvent has been called, and raises the ChangedEvent if the ChangedEventSuspended count is reduced to zero and any changes were made while events were suspended. Must be called once for each call to SuspendChangedEvent.

(Overrides ChangedEventShareableBase ResumeAndRaiseChangedEvent .)
Public methodSuspendChangedEvent

Temporarily suspends the raising of the ChangedEvent. May be called more than once, and a corresponding call to ResumeAndRaiseChangedEvent must be made for each call to SuspendChangedEvent.

(Overrides ChangedEventShareableBase SuspendChangedEvent .)
Public methodToString

Returns a human readable string that represents the object.

(Overrides Object ToString .)
Top
Operators

  NameDescription
Public operatorStatic memberEquality
Compares the equality of two LineMaxOperator objects.
Public operatorStatic memberInequality
Compares the inequality of two LineMaxOperator objects.
Top
Properties

  NameDescription
Public propertyAssurance (Overrides LineMaxOperatorBase Assurance.)
Public propertyChangedEventSuspended

Indicates if raising the ChangedEvent has been suspended.

(Overrides ChangedEventShareableBase ChangedEventSuspended.)
Public propertyCoverageThreshold (Overrides LineMaxOperatorBase CoverageThreshold.)
Public propertyDistanceTolerance (Overrides LineMaxOperatorBase DistanceTolerance.)
Public propertyEdgeAngleTolerance (Overrides LineMaxOperatorBase EdgeAngleTolerance.)
Public propertyEdgeDetectionParams (Overrides LineMaxOperatorBase EdgeDetectionParams.)
Public propertyExpectedLineNormal (Overrides LineMaxOperatorBase ExpectedLineNormal.)
Public propertyFittingMode (Overrides LineMaxOperatorBase FittingMode.)
Public propertyHandle (Overrides LineMaxOperatorBase Handle.)
Public propertyLengthThreshold (Overrides LineMaxOperatorBase LengthThreshold.)
Public propertyLineAngleTolerance (Overrides LineMaxOperatorBase LineAngleTolerance.)
Public propertyMaxNumLines (Overrides LineMaxOperatorBase MaxNumLines.)
Public propertyPolarity (Overrides LineMaxOperatorBase Polarity.)
Public propertyRegionMode (Overrides LineMaxOperatorBase RegionMode.)
Public propertyTimeout (Overrides LineMaxOperatorBase Timeout.)
Public propertyTimeoutEnabled (Overrides LineMaxOperatorBase TimeoutEnabled.)
Top
Events

  NameDescription
Public eventChanged

The actual event.

(Overrides ChangedEventShareableBase Changed.)
Top
Remarks

Line finding is accomplished in two phases. The first phase, edge detection, finds edge points within the image(s). The second phase, line fitting, creates lines from roughly collinear subsets of the found edge points.

The first phase, edge detection, finds edge points within the image(s) using parameters defined in the LineMaxEdgeDetectionParams class. First, the input image is smoothed and decimated, using GradientKernelSizeInPixels. Gradient vectors are then computed for each pixel in the decimated image. Both the gradient vectors and the input image are projected over many caliper-like projection regions, using ProjectionLengthInPixels. A pixel is considered a candidate edge point if its projected gradient magnitude exceeds ContrastThreshold and if the ratio of its projected gradient magnitude and its intensity exceeds NormalizedContrastThreshold. Only edge points with gradient directions sufficiently consistent with ExpectedLineNormal can possibly constitute the expected lines at the angle ExpectedLineNormal (where the gradient direction consistency is determined by LineAngleTolerance and EdgeAngleTolerance). Therefore, only such edge points are included in the line fitting phase. Edge points with inconsistent gradient directions are excluded from the line fitting phase and placed into the UnconsideredOutliers collection.

The second phase, line fitting, creates lines from roughly collinear subsets of the found edge points, using parameters defined in the LineMaxOperatorBase class. Lines are evaluated using a RANSAC or an Exhaustive point selection methodology, depending on the FittingMode setting. Under RANSAC mode, the user may adjust Assurance to fit the desired result optimality and operation speed. Line fitting is performed by iteratively evaluating candidate lines created from the found edge points. During each iteration two points are randomly selected from the found edge points, a candidate line is modeled from the selected points, and the candidate line inliers are determined. An edge point is assigned to the inlier list of a candidate line only if it is in the proximity of the candidate line (determined by DistanceTolerance ) and if its gradient direction is consistent with the angle of the candidate line (determined by EdgeAngleTolerance ). Each edge point can only be assigned to the inlier list of a single line and each line is only allowed to contain at most one edge point from each projection region. When the RANSAC iterations reach the maximum, the inliers of the best found line candidate will be identified. Then the found line will be refined using a least squares regression fit to the inliers, and the set of inliers will be re-evaluated using the refined line. The refinement will be repeated a maximum of three times until the number of inliers ceases to further increase. Any edge points that are not inliers of the found line are placed into the ConsideredOutliers collection.

See Also