FindCircularEdge Method

NI Vision for Visual Basic

FindCircularEdge Method

Syntax

CWMachineVision.FindCircularEdge SourceImage, SearchAnnulus, ScanDirection, FindCircularEdgeReport [, FindCircularEdgeOptions] [, CoordinateTransformation]

Return Type

Long

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

Purpose

Locates a circular edge in a search area. This method locates the intersection points between a set of search lines defined by a spoke 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 circle is calculated through the points found. The method returns the coordinates of the circle found as well as its roundness. FindCircularEdge can overlay results on the image returned: the position of the search area, the search lines, the edges found, and the resulting circle.

Parameters

SourceImage As CWIMAQImage

The input image.

SearchAnnulus As CWIMAQAnnulus

The annular search area.

ScanDirection As CWIMAQSpokeScanDirections

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

FindCircularEdgeReport As CWMVFindCircularEdgeReport

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

FindCircularEdgeOptions As Variant

[Optional] A CWMVFindCircularEdgeOptions 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 CWMVFindCircularEdgeOptions
    Dim Transformation As New CWMVCoordinateTransformation
    
    'Output objects
    Dim Report As New CWMVFindCircularEdgeReport
    
    'Get the currently selected annulus from the viewer
    CWMachineVision1.GetSelectedAnnulusFromViewer CWIMAQViewer1, SearchAnnulus
                                                           
    ' Find objects on the Viewer image in the selected rectangle
    CWMachineVision1.FindCircularEdge CWIMAQViewer1.Image, SearchAnnulus, cwimaqScanOutsideToInside, _
                                      Report, Options, Transformation
End Sub

Battery Clamp Inspection Example

See Also

CWIMAQVision.Spoke

CWMVFindCircularEdgeOptions

GetSelectedAnnulusFromViewer