Chapter 5
IMAQ Vision for LabWindows/CVI User Manual
5-24
ni.com
Note
Use the
IMAQ_CONSERVATIVE
strategy if you have multiple targets located very
close to each other in the image.
Decide on the best strategy by experimenting with the different options.
Color Score Weight
When you search for a template using both color and shape information, the
color and shape scores generated during the match process are combined to
generate the final color pattern matching score. The color score weight
determines the contribution of the color score to the final color pattern
matching score. If the template’s color information is superior to its shape
information, set the weight higher. For example, if you set
colorWeight
to 1000, the algorithm finds each match by using both color and shape
information and then ranks the matches based entirely on their color scores.
If you set
colorWeight
to 0, the matches are ranked based entirely on
their shape scores.
Minimum Contrast
Use the
minContrast
element to increase the color pattern matching
algorithm’s speed. The color pattern matching algorithm ignores all image
regions where grayscale contrast values fall beneath a set minimum
contrast value. See the
Setting Matching Parameters and Tolerances
section of this chapter for more information about minimum contrast.
Rotation Angle Ranges
If you know that the pattern rotation is restricted to a certain range (for
example, between –15
°
to 15
°
), provide this restriction information to
the pattern matching algorithm by setting the
angleRanges
element. This
information improves your search time because the color pattern matching
algorithm looks for the pattern at fewer angles. See Chapter 12,
Pattern
Matching
, in the
IMAQ Vision Concepts Manual
for more information on
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
imaqMatchColorPattern()
. These test images should reflect
the images generated by your machine vision application during true
operating conditions. If the pattern matching algorithm locates the