imaqFindPattern

NI Vision for LabWindows/CVI Function

imaqFindPattern

Usage

PatternMatch* imaqFindPattern(Image* image, Image* pattern, RotatedRect searchRect, const FindPatternOptions* options, const CoordinateTransform2* transform, int* numMatches);

Purpose

Searches for a template image in a rectangular search area of the image.

Image Types Supported

IMAQ_IMAGE_U8

Parameters

Name

Type

Description

image Image* The image in which the function finds matches to the template image.
pattern Image* The template image which the function attempts to locate. Attach pattern matching information to this image using imaqLearnPattern(). If you have not attached pattern matching information to the image, the function learns the pattern and appends the pattern matching information to the image. If you attach pattern matching information to the image that does not contain the information specified by the mode element of the options parameter, the function generates an error.
searchRect RotatedRect The coordinate location of the rectangular search area the function looks in for the pattern. The function searches the bounding rectangle of searchRect. To search the entire image, set this parameter to IMAQ_NO_ROTATED_RECT.
options const FindPatternOptions* Describes how you want the function to search for the template image and the information the function overlays to the image. To use default options, set this parameter to NULL.
transform const CoordinateTransform2* An optional specification of the coordinate transform for searchRect. This parameter specifies how to transform the location of the pattern search based on the difference between the reference coordinate system and the measurement coordinate system. Set this parameter to NULL if you do not need to transform searchRect.
numMatches int* On return, the number of matches to the template image that the function found. Set this parameter to NULL if you do not need this information.

Return Value

Type

Description

PatternMatch* On success, this function returns an array of information about each match found. On failure, this function returns NULL. To get extended error information, call imaqGetLastError(). When you are finished with the information, dispose of it by calling imaqDispose().

Parameter Discussion

options—Set the options parameter to NULL to use the default options, as follows:

mode IMAQ_MATCH_SHIFT_INVARIANT
numMatchesRequested 1
minMatchScore 800
subpixelAccuracy FALSE
angleRanges NULL
numRanges 0
showSearchArea FALSE
showResult TRUE