Chapter 5
Performing Machine Vision Tasks
IMAQ Vision for Visual Basic User Manual
5-24
ni.com
Use one of the following four search strategies:
•
Very aggressive—Uses the largest step size, the most sub-sampling
and only the dominant color from the template to search for the
template. Use this strategy when the color in the template is almost
uniform, the template is well contrasted from the background and there
is a good amount of separation between different occurrences of the
template in the image. This strategy is the fastest way to find templates
in an image.
•
Aggressive—Uses a large step size, a large amount of subsampling,
and all the color spectrum information from the template.
•
Balanced—Uses values in between the aggressive and conservative
strategies.
•
Conservative—Uses a very small step size, the least amount of
subsampling, and all the color information present in the template. The
conservative strategy is the most reliable method to look for a template
in any image at potentially reduced speed.
Note
Use the 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.
Use
CWIMAQMatchColorPatternOptions.SearchStrategy
to select
a search strategy.
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 color information is superior to
its shape information, set the weight higher. For example, if you use a
weight of 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 the weight is 0, the matches are ranked based
entirely on only their shape scores. Use the
CWIMAQMatchColorPatternOptions.ColorScoreWeight
property to set the color score weight.