FindConcentricEdge Method

NI Vision for Visual Basic

FindConcentricEdge Method

Syntax

CWMachineVision.FindConcentricEdge SourceImage, SearchAnnulus, ScanDirection, FindConcentricEdgeReport [, CommonEdgeOptions] [, CoordinateTransformation]

Return Type

Long

On success, this method returns 0. On failure, this function returns a negative number.

Purpose

Locates a straight edge in a circular search area. This method locates the intersection points between a set of concentric search lines and the edge of an object. The intersection points are determined based on their contrast and slope.

Remarks

Use this method with U8, I16, and SGL images.

A best-fit line is calculated through the points found. The method returns the coordinates of the edge found as well as its straightness. FindConcentricEdge can overlay on the image returned the position of the search area, the search lines, the edges found, and the resulting line.

Parameters

SourceImage As CWIMAQImage

The input image.

SearchAnnulus As CWIMAQAnnulus

The annular search area.

ScanDirection As CWIMAQConcentricRakeScanDirections

Specifies the direction in which the search lines are scanned for edges.

FindConcentricEdgeReport As CWMVFindConcentricEdgeReport

On return, a report containing information about the edge that was found.

CommonEdgeOptions As Variant

[Optional] A CWMVCommonEdgeOptions object that contains additional options for this function. If not supplied, the defaults are used.

CoordinateTransformation As Variant

[Optional] A CWMVCoordinateTransformation object. If supplied, the input search area is transformed using this parameter.

Example

Private Sub Run_Click()
    'Input objects
    Dim SearchAnnulus As New CWIMAQAnnulus
    Dim Options As New CWMVCommonEdgeOptions
    Dim Transformation As New CWMVCoordinateTransformation
    
    'Output objects
    Dim Report As New CWMVFindConcentricEdgeReport
    
    'Get the currently selected annulus from the viewer
    CWMachineVision1.GetSelectedAnnulusFromViewer CWIMAQViewer1, SearchAnnulus
                                                           
    ' Find objects on the Viewer image in the selected rectangle
    CWMachineVision1.FindConcentricEdge CWIMAQViewer1.Image, SearchAnnulus, _
                                        cwimaqScanCounterClockwise, Report, Options, Transformation
End Sub

See Also

CWIMAQVision.ConcentricRake

CWMVCommonEdgeOptions

GetSelectedAnnulusFromViewer