Chapter5 MachineVision
IMAQVision for LabWindows/CVI User Manual 5-18 ni.com
Testingthe Search Algorithm on Test Images
To determine if your selected template or reference pattern is appropriate
foryour machine visi ona pplication, test the template on a few test images
by using imaqMatchPattern().These test images should reflect the
imagesgenerated by your machinevision application during true operating
conditions.I fthe pattern matching algorithm locates the reference pattern
in all cases,yo u have selected a good template. Otherwise, refine the
currentt emplate, orselect a better template until both training and testing
are successful.
Using a Ranking Method to Verify Results
Themanner 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
locationof the best match. Use the position and corner elements of the
Pattern Matchstructure to get the po sition and the bounding rectangle
ofa match.
Ininspection applications, such as optical character verification (OCV), the
scoreof the best match is more useful. The score of a match returned by the
pattern matching algorithm isan indicator of the closeness between the
originalpattern and the match found in the image. A high score indicates a
veryclose match, while a low score indicates a poor match. The score can
beused as a gauge to determine whether a printed character is acceptable.
Use the scoreelement of the Pattern Match structureto getthe score
corresponding to am atch.
Finding Points Using Color Pattern Matching
Color pattern matching algorithms provide a quick way to locate objects
when colori spresent. U secolor pattern matching if:
The object you wantto locate has color information that is very
differentfrom the background , and you wantto find a very precise
location of the object in the image.
The object to locate has grayscalep roperties thatare very difficultto
characterizeor 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
otherobjects in the scene, color provides the machine vision software
with the additional information to locate the object.