Chapter 5
IMAQ Vision for LabWindows/CVI User Manual
5-18
ni.com
Testing the Search Algorithm on Test Images
To determine if your selected template or reference pattern is appropriate
for your machine vision application, test the template on a few test images
by using
imaqMatchPattern()
. These test images should reflect the
images generated by your machine vision application during true operating
conditions. If the pattern matching algorithm locates the reference pattern
in all cases, you have selected a good template. Otherwise, refine the
current template, or select a better template until both training and testing
are successful.
Using a Ranking Method to Verify Results
The 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
Pattern Match
structure to get the position and the bounding rectangle
of a match.
In inspection applications, such as optical character verification (OCV), 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
Pattern Match
structure to get the score
corresponding to a match.
Finding Points Using Color Pattern Matching
Color pattern matching algorithms provide a quick way to locate objects
when color is present. Use color pattern matching if:
•
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.