imaqMatchColorPattern

NI Vision for LabWindows/CVI Function

imaqMatchColorPattern

Usage

PatternMatch* imaqMatchColorPattern(const Image* image, Image* pattern, const MatchColorPatternOptions* options, Rect searchRect, int* numMatches);

Purpose

Searches for areas in an image that match a given color template image.

Image Types Supported

IMAQ_IMAGE_RGB, IMAQ_IMAGE_HSL

Parameters

Name

Type

Description

image const Image* The image in which the function finds matches to the color template image.
pattern Image* The color template image to find in the image. NI Vision must learn this template image in imaqLearnColorPattern() before using it in this function.
options const MatchColorPatternOptions* Describes how to search for the color template image.
searchRect Rect Specifies a rectangle in the image in which to search for the template image. Set this parameter to IMAQ_NO_RECT to search for the pattern image in the entire image.
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 return value, dispose of the pointer by calling imaqDispose().

Parameter Discussion

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

matchMode IMAQ_MATCH_SHIFT_INVARIANT
featureMode IMAQ_COLOR_AND_SHAPE
minContrast 0
subpixelAccuracy FALSE
angleRanges NULL (all angles allowed)
numRanges 0
colorScoreWeight 500
colorSensitivity IMAQ_SENSITIVITY_LOW
searchStrategy IMAQ_CONSERVATIVE
numMatchesRequested 1
minMatchScore 800