Справочник Пользователя для National Instruments IMAQTM

Скачать
Страница из 121
Chapter 5
Performing Machine Vision Tasks
© National Instruments Corporation
5-15
Background Information
Unique background information in a template improves search 
performance and accuracy.
Figure 5-10.  Background Information
Training the Pattern Matching Algorithm
After you create a good template image, the pattern matching 
algorithm has to learn the important features of the template. Use 
CWIMAQVision.LearnPattern2
 to learn the template. The learning 
process depends on the type of matching that you expect to perform. If you 
do not expect the instance of the template in the image to rotate or change 
its size, the pattern matching algorithm has to learn only those features 
from the template that are necessary for shift-invariant matching. However, 
if you want to match the template at any orientation, the learning mode 
must consider the possibility of arbitrary orientations. To specify 
which type of learning mode to use, pass the learn mode to 
the
LearnPatternOptions
 parameter of 
CWIMAQVision.LearnPattern2
. You also can set the 
LearnMode
 
property of a CWIMAQLearnPatternOptions object and pass this object 
for the 
LearnPatternOptions
 parameter of 
CWIMAQVision.LearnPattern2
.
The learning process is usually time intensive because the algorithm 
attempts to find unique features of the template that allow for fast, accurate 
matching. The learning mode you choose also affects the speed of the 
learning process. Learning the template for shift-invariant matching is 
faster than learning for rotation-invariant matching. You also can save time 
by training the pattern matching algorithm offline, and then saving the 
template image with 
CWIMAQVision.WriteImageAndVisionInfo
.
a
Pattern with Insufficient Background Information
b
Pattern with Sufficient Background Information
a.
b.