Chapter5 MachineVision
©NationalInstruments Corporation 5-19 IMAQVision for LabWindows/CVI User Manual
Colorpattern matching returns the location of the center of the template an d
the template orientation. Followthese general steps to find features in an
image using color pattern matching:
1. Definea reference or fiducial pattern in the form of a template image.
2. Usethe reference pattern to train the col or pattern matching algorithm
withimaqLearnColorPattern().
3. Definean image or an area of an image as the search area. A small
search area reducesthe timeto find the features.
4. Set the featureModeelement oft he imaqMatchColorPattern()
options parameter to IMAQ_COLOR_AND_SHAPE_FEATURES.
5. Sett he tolerances and parametersto specify how the algorithm
operates atr un time using the options parameter of
imaqMatchColorPattern().
6. Testthe search algorithm on test images using
imaqMatchColorPattern().
7. Verifythe results using a ranking method.
Defining and Creating Good Color TemplateImages
The selection of a good template image plays a critical part in obtaining
accurateresults with the color pattern matching algorithm. Because the
templateimage represents the color and the pattern that you want to find,
makesure that all the important and unique characteristics of the pattern are
welldefined in the image.
Severalfactors are critical in creating a template image. These critical
factorsinclude color information, symmetry,feature detail, positional
information, and background information.

Color Information

Atemplate with colors that are unique to the pat ternp rovides better results
than a templatethat contains manycolors, especially colors found in the
background or other objects in the image.

Symmetry

Ar otationally symmetric template in the luminance plane is less sensitive
to changes in rotation than one that is rotationally asymmetric.