Chapter 5
Performing Machine Vision Tasks
©
National Instruments Corporation
5-19
IMAQ Vision for Visual Basic User Manual
Using a Ranking Method to Verify Results
The manner in which you interpret the pattern matching results depends
on the application. For typical alignment applications, such as finding
a fiducial on a wafer, the most important information is the
position and bounding rectangle of the best match. Use
CWIMAQPatternMatchReportItem.Position
and
CWIMAQPatternMatchReportItem.BoundingPoints
to get
the position and location 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 method 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 if a printed character is acceptable. Use
CWIMAQPatternMatchReportItem.Score
to get a match score.
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 under the following
circumstances:
•
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. 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
CWIMAQVision.LearnColorPattern
.
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
CWIMAQMatchColorPatternOptions.FeatureMode
to
cwimaqFeatureAll
.