FindCoordTransformUsingPattern Method

NI Vision for Visual Basic

FindCoordTransformUsingPattern Method

Syntax

CWMachineVision.FindCoordTransformUsingPattern SearchImage, Pattern, FirstRun, CoordinateTransformation [, SearchRectangle] [, FindCTUsingPatternOptions] [, MainAxisLine] [, SecondaryAxisLine]

Return Type

Long

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

Purpose

Searches for a template image in a rectangular search area of the input Image. The method uses the location and orientation of the template found to create the reference coordinate system or to update the measurement coordinate system. This method can overlay, on the image returned, the position of the search area and the location and orientation of the coordinate system found.

Remarks

Use this method with U8 images.

Parameters

SearchImage As CWIMAQImage

The image in which the coordinate system is to be located.

Pattern As CWIMAQImage

The image to be located during the match process. The template image is the image obtained from the output of the CWIMAQVision.LearnPattern. If the template has not been learned, this method first goes through the learning process.

FirstRun As Boolean

Indicates whether this is the first time that FindCoordTransformUsingPattern is run. If it is, this method uses the coordinate system it finds as the reference and measurement coordinate system. Otherwise, it updates the MeasurementSystem and leaves the ReferenceSystem unchanged.

CoordinateTransformation As CWMVCoordinateTransformation

On return, this parameter contains the reference coordinate system and measurement coordinate system.

SearchRectangle As Variant

[Optional] A CWIMAQRotatedRectangle object that specifies the region within an image to search. If you do not supply this parameter, the entire image is examined.

FindCTUsingPatternOptions As Variant

[Optional] A CWMVFindCTUsingPatternOptions object defining the parameters of the algorithm that detects the template locations and the information that are overlaid to the result image.

MainAxisLine As Variant

[Optional] On return, a CWIMAQLine object specifying the coordinates of the edge corresponding to the main axis. The first point is bottom-left corner of the bounding rectangle of the match. The second point is bottom-right corner of the bounding rectangle of the match.

SecondaryAxisLine As Variant

[Optional] On return, a CWIMAQLine object specifying the coordinates of the edge corresponding to the secondary axis. The first point is bottom-left corner of the bounding rectangle of the match. The second point is top-left corner of the bounding rectangle of the match.

Example

Battery Clamp Inspection Example

See Also

FindCoordTransformUsingRect

FindCoordTransformUsingTwoRects

CWIMAQVision.MatchPattern2

CWIMAQVision.LearnPattern2

TransformRegions

CWIMAQRotatedRectangle

CWMVFindCTUsingPatternOptions

CWIMAQLine