Chapter 5 Performing Machine Vision Tasks
© National Instruments Corporation 5-19 IMAQ Vision for LabWindows/CVI User Manual
Using a Ranking Method to Verify ResultsThe manner in which you interpret the pattern matching algorithm depends
on your application. For typical alignment applications, such as finding a
fiducial on a wafer, the most important information is the position and
location of the best match. Use the position and corner elements of the
PatternMatch structure to get the position and the bounding rectangle of
a match.
In inspection applications, such as optical character verification, the score
of the best match is more useful. The score of a match returned by the
pattern matching algorithm is an indicator of the closeness between the
original pattern and the match found in the image. A high score indicates a
very close match, while a low score indicates a poor match. The score can
be used as a gauge to determine whether a printed character is acceptable.
Use the score element of the PatternMatch structure to get the score
corresponding to a match.
Finding Points Using Color Pattern MatchingColor pattern matching algorithms provide a quick way to locate objects
when color is present. Use color pattern matching if your images have the
following qualities:
• The object you want to locate has color information that is very
different from the background, and you want to find a very precise
location of the object in the image.
• The object to locate has grayscale properties that are very difficult to
characterize or that are very similar to other objects in the search
image. In such cases, grayscale pattern matching can give inaccurate
results. If the object has color information that differentiates it from the
other objects in the scene, color provides the machine vision software
with the additional information to locate the object.
Color pattern matching returns the location of the center of the template and
the template orientation. Complete the following general steps to find
features in an image using color pattern matching:
1. Define a template image that contains a reference or fiducial pattern.
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.