Chapter5 MachineVision
©NationalInstruments Corporation 5-17 IMAQVision for LabWindows/CVI User Manual
However, there may be applications in which the assumptions used in the
algorithmare not optimal. Knowing your particular application and the
imagesyou want to process is useful in selecting the pattern matching
parameters. The following are parameters the influence the IMAQ Vision
pattern matching algorithm.
Match Mode
Youcan set the match mode to control how t he pattern matching algorithm
treatsthe template at different orientations. If you expect the orientation of
validmatches to vary less than ±5°from the template, set the mode element
ofthe options parameter to IMAQ_MATCH_SHIFT_INVARIANT.Otherwise,
setthe mode element to IMAQ_MATCH_ROTATION_INVARIANT.
Shift-invariantm atching is faster than rotation-invariant matching.
Minimum Contrast
You can set the minimum contrast to potentially increase the pattern
matchingalgorithms speed. Contrast is the difference between the smallest
andlargest pixel values in a region. The pattern matching algorithm ignores
allimage 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. By using a high
minimum contrast value, you exclude all areas in the image with low
contrast, significantly reducing the region in which the pattern matching
algorithmmust search. If the search image has low contrast throughout, set
al ow minimum contrast parameter to ensure that the pattern matching
algorithm looks for the template in all regions of the image. Use the
minContrastelement of the imaqMatchPattern() options parameter
to set the minimum contrast.
Rotation Angle Ranges
Formatching objects that may rotate in the image, the pattern matching
algorithm,by default, allows any orientation between 0°to 360°.Ifthe
pattern rotation in your application is restrictedt o acertain range (for
example,from 15°to 15°), you can provide this information to the pattern
matching algorithm by setting the angleRanges element of the
imaqMatchPattern()options parame ter. This information improves
your search time because the pattern matching algorithm looks for the
pattern at fewer angles.