ConcentricRake Method

NI Vision for Visual Basic

ConcentricRake Method

Syntax

CWIMAQVision.ConcentricRake SourceImage, Regions, ScanDirection, EdgeCoordinatesReport [, EdgeOptions] [, Process = cwimaqEdgeProcessAll] [, StepSize = 5] [, ArcCoordinates]

Return Type

Long

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

Purpose

Finds edges along concentric circular or angular paths in the image. Edges are determined based on their contrast and slope.

Parameters

SourceImage As CWIMAQImage

The input image.

Regions As CWIMAQRegions

Regions describes the bounding circular or annular region within which the concentric paths are defined.

ScanDirection As CWIMAQConcentricRakeScanDirections

Specifies the direction in which the method searches for edges along the concentric paths. You can search in either a clockwise or counterclockwise direction.

EdgeCoordinatesReport As CWIMAQEdgeCoordinatesReport

On return, a report containing information about the edges detected.

EdgeOptions As Variant

[Optional] A CWIMAQEdgeOptions object defining the characteristics the method uses to find the edges and the parameters it needs for subpixel analysis of the edges.

Process As Variant

[Optional] Determines the type of search. The method can return the first edge, both the first and the last edge, or all edges found along each concentric path.

This parameter has a default value of cwimaqEdgeProcessAll.

StepSize As Variant

[Optional] StepSize is the radial distance in pixels between the concentric paths.

This parameter has a default value of 5.

ArcCoordinates As Variant

[Optional] If this parameter is supplied, it must be a CWIMAQArcs object that on return contains the arcs that the method used for edge detection.

Example

'This routine assumes that you have an annulus selected on the viewer
Private Sub Run_Click()
    'Declarations
    Dim EdgeCoordinatesReport As New CWIMAQEdgeCoordinatesReport
    Dim EdgeOptions As New CWIMAQEdgeOptions
    Dim ArcCoordinates As New CWIMAQArcs
    Dim I As Integer
    
    'Perform a concentric rake operation with subpixel accuracy of one-tenth. Find only
    'the first edge along each line.
    EdgeOptions.SubPixelAccuracy = cwimaqSubPixelOneTenth
    CWIMAQVision1.ConcentricRake CWIMAQViewer1.Image, CWIMAQViewer1.Regions, cwimaqScanClockwise, _
                                 EdgeCoordinatesReport, EdgeOptions, cwimaqEdgeProcessFirst, 10, _
                                 ArcCoordinates
                       
    'Overlay the search arcs
    For I = 1 To ArcCoordinates.Count
        CWIMAQViewer1.Image.Overlays(1).DrawArc ArcCoordinates(I), cwimaqOverlayModeFrame, vbBlue
    Next I
    
    'Overlay edge points found
    With EdgeCoordinatesReport.FirstEdgePoints
        For I = 1 To .Count
            CWMachineVision1.DrawCircularPoint CWIMAQViewer1.Image.Overlays(1), .Item(I), 5, _
                                               cwimaqOverlayModePaint, vbRed
        Next I
    End With
End Sub