Chapter5 MachineVision
IMAQVision for LabWindows/CVI User Manual 5-24 ni.com
Note Use the IMAQ_CONSERVATIVEstr ategyif you have multiple targets located very
close toeach other in the image.
Decide on the best strategyby experimenting with the different options.

Color Score Weight

Whenyou search for a template using both color and shape information, the
colorand 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
matchingscore. If the templates color in formation is superior to its shape
information, set the weight higher. For example, if you set colorWeight
to 1000, the algorithm finds each match byusing both color and shape
informationand then ranks the matches based entirely on their color scores.
If you set colorWeight to0, the m atches are ranked basedentirely on
their shape scores.

Minimum Contrast

Use the minContrastelement to increase the color pattern matching
algorithmsspeed . The color pattern matching algorithm ignores all image
regions where grayscalecontrast 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° to15°), provid eth is restriction information to
the pattern matching algorithm by setting the angleRanges element. This
informationimproves your search time because the color pattern matching
algorithm looks for the pattern at fewer angles. See Chapter 12, Pattern
Matching,intheIMAQ Vision Concepts Manual for more information on
pattern matching.
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 imaqMatchColorPattern().These test images should reflect
the images generated by yourmachine visionapplication during true
operating conditions. If the pattern matching algorithm locates the