National Instruments IMAQ Vision for LabWindows TM /CVI Network Card User Manual


 
Chapter 5 Performing Machine Vision Tasks
IMAQ Vision for LabWindows/CVI User Manual 5-18 ni.com
Minimum Contrast
The pattern matching algorithm ignores all image regions in which contrast
values fall below a set minimum contrast value. Contrast is the difference
between the smallest and largest pixel values in a region. Set the
minContrast element of the imaqMatchPattern2() options parameter
control to slightly below the contrast value of the search area with the
lowest contrast.
You can set the minimum contrast to potentially increase the speed of the
pattern matching algorithm. If the search image has high contrast overall
but contains some low contrast regions, set a high minimum contrast value
to exclude all areas of the image with low contrast. Excluding these areas
significantly reduces the area in which the pattern matching algorithm must
search. However, if the search image has low contrast throughout, set a low
minimum contrast to ensure that the pattern matching algorithm looks for
the template in all regions of the image.
Rotation Angle Ranges
If you know that the pattern rotation is restricted to a certain range, such as
between –15° to 15°, provide this restriction information to the pattern
matching algorithm in the
angleRanges element of the
imaqMatchPattern2() options parameter. This information improves
your search time because the pattern matching algorithm looks for the
pattern at fewer angles. Refer to Chapter 12, Pattern Matching, of the
IMAQ Vision Concepts Manual for information about pattern matching.
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
imaqMatchPattern2(). 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.