AddTemplate Method
Syntax
CWIMAQMultipleGeometricTemplate.AddTemplate Template, Label
Purpose
Adds a geometric matching template image with an associated label.
Remarks
Use one of the following methods of configuring the template image you want to use with this method:
- Load a previously saved template image that you created using the NI Vision Template Editor using CWIMAQVision.ReadImageAndVisionInfo.

Note To use the NI Vision Template Editor to configure a template image, click Start»All Programs»National Instruments»Vision»Template Editor. - Use CWIMAQVision.LearnGeometricPattern to learn the template image.
Parameters
Template As CWIMAQImage
The geometric matching template.
Label As String
The label that identifies this template image.
Example
Dim MultipleTemplate As New CWIMAQMultipleGeometricTemplate
Private Sub Learn_Click()
Dim Template1 As New CWIMAQImage
Dim Template1MatchOptions As New CWIMAQMatchGeometricPatternOptions
Dim Template2 As New CWIMAQImage
Dim Template2MatchOptions As New CWIMAQMatchGeometricPatternOptions
' Read the templates
CWIMAQVision1.ReadImageAndVisionInfo Template1, Template1Path
CWIMAQVision1.ReadImageAndVisionInfo Template2, Template2Path
' Initialize the match options
' Add the templates to the multiple template and
' set the match options
MultipleTemplate.AddTemplate Template1, "Template 1"
MultipleTemplate.SetMatchOptions "Template 1", Template1MatchOptions
MultipleTemplate.AddTemplate Template2, "Template 2"
MultipleTemplate.SetMatchOptions "Template 2", Template2MatchOptions
' Learn the multiple template
CWIMAQVision1.LearnMultipleGeometricPatterns MultipleTemplate
End Sub
Private Sub Match_Click()
Dim Target As New CWIMAQImage
Dim Report As New CWIMAQGeometricPatternMatchReport
' Read the target image
CWIMAQVision1.ReadImage Target, TargetPath
' Match the multiple template to the target
CWIMAQVision1.MatchMultipleGeometricPatterns Target, _
MultipleTemplate, _
Report
End Sub