Chapter 5 Performing Machine Vision Tasks
IMAQ Vision for Visual Basic User Manual 5-18 ni.com
Minimum Contrast
Contrast is the difference between the smallest and largest pixel values in a
region. You can set the minimum contrast to potentially increase the speed
of the pattern matching algorithm. The pattern matching algorithm ignores
all image regions where contrast values fall beneath a set minimum contrast
value. If the search image has high contrast but contains some low contrast
regions, you can set a high minimum contrast value. Using a high minimum
contrast value excludes all areas in the image with low contrast,
significantly reducing the region in which the pattern matching algorithm
must search. If the search image has low contrast throughout, set a low
minimum contrast parameter to ensure that the pattern matching
algorithm looks for the template in all regions of the image. Use
CWIMAQMatchPatternOptions.MinimumContrast to set the
minimum contrast.
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
CWIMAQMatchPatternOptions.RotationAngleRanges property.
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 the selected template or reference pattern is appropriate for
the machine vision application, test the template on a few test images.
These test images should reflect the images generated by the 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.