Chapter5 MachineVision
IMAQVision for LabWindows/CVI User Manual 5-20 ni.com
Feature Detail
A templatewith relatively coarse features is less sensitive to variations in
sizeand rotation than a model with fine features. However, the model must
contain enough detail to identify it.
Positional Information
A templatewith strong edges in both the x and y directions is easier to
locate.
Background Information
Unique background information ina templateimproves search
performanceand accuracy during the grayscale pattern matching phase.
This requirement could conflict with the “color information”requirement
becauseb ackground colors may not be desirable during the color location
phase.A void this problem by choosing a template with sufficient
background information for grayscale pattern matching whilespecifying
the exclusion of the background color during the color location phase.
Refer to the Training the Color Pattern Matching Algorithm section for
more information about how to ignore colors.
Trainingthe Color Pattern Matching AlgorithmAfteryou have created a good template image, the color pattern
matching algorithm learns the important features of the template. Use
imaqLearnColorPattern()to learn the template.The learning process
depends on the type of matching that you expect to perform. By default,
the color pattern matching algorithm learns only those features from the
templatethat are necessaryfor shift-invariant m atching. However, if you
want to match the template at any orientation, the learning process must
consider the possibility of arbitrary orientations. Use the learnMode
elementof t he imaqLearnColorPattern()options parameter to
specify which type of learning mode to use.
Exclude colors in the template that you are not interested in using during
the search phase. Typicallyyou should ignore colors that either belong to
thebackground of the object or are not unique to th e template, reducing the
potential for incorrect matches during the color location phase. Youcan
ignore certain predefinedcolor susin g the ignoreModeelement of the
options parameter.To ignore other colors, first learn the colors to ignore
usingimaqLearnColor(). Then set the colorsToIgnore element of the
options parameter to the resulting ColorInformation structure from
imaqLearnColor().