Chapter 5
Machine Vision
©
National Instruments Corporation
5-19
IMAQ Vision for LabWindows/CVI User Manual
Color pattern matching returns the location of the center of the template and
the template orientation. Follow these general steps to find features in an
image using color pattern matching:
1.
Define a reference or fiducial pattern in the form of a template image.
2.
Use the reference pattern to train the color pattern matching algorithm
with
imaqLearnColorPattern()
.
3.
Define an image or an area of an image as the search area. A small
search area reduces the time to find the features.
4.
Set the
featureMode
element of the
imaqMatchColorPattern()
options
parameter to
IMAQ_COLOR_AND_SHAPE_FEATURES
.
5.
Set the tolerances and parameters to specify how the algorithm
operates at run time using the
options
parameter of
imaqMatchColorPattern()
.
6.
Test the search algorithm on test images using
imaqMatchColorPattern()
.
7.
Verify the results using a ranking method.
Defining and Creating Good Color Template Images
The selection of a good template image plays a critical part in obtaining
accurate results with the color pattern matching algorithm. Because the
template image represents the color and the pattern that you want to find,
make sure that all the important and unique characteristics of the pattern are
well defined in the image.
Several factors are critical in creating a template image. These critical
factors include color information, symmetry, feature detail, positional
information, and background information.
Color Information
A template with colors that are unique to the pattern provides better results
than a template that contains many colors, especially colors found in the
background or other objects in the image.
Symmetry
A rotationally symmetric template in the luminance plane is less sensitive
to changes in rotation than one that is rotationally asymmetric.