Friday, December 16, 2011

Geometric Template Matching in LabVIEW

In NI's IMAQ Vision Concepts Manual, geometric template matching is described as follows. Geometric matching locates regions in a grayscale image that match a model, or template, of a reference pattern. Geometric matching is specialized to locate templates that are characterized by distinct geometric or shape information. When using geometric matching, a template is created that represents the object to be searched. Machine vision application then searches for instances of the template in each inspection image and calculates a score for each match. The score relates how closely the template resembles the located matches. Geometric matching finds template matches regardless of lighting variation, blur, noise, occlusion, and geometric transformations such as shifting, rotation, or scaling of the template.
The VIs such as IMAQ Find CoordSys (Pattern) 2 are used to locate the model. The template for the model is created as discussed in the following steps.
Open Template Editor in Windows by clicking Start -> All Programs -> National Instruments -> Vision -> Template Editor. Click File menu->New Template.... Select Geometric Matching Template (Edge Based) and browse an image to extract the template from. In the Select Template Region tab, define a region. For example, start at (200,300) and drag the mouse cursor to (232,332) and release it. Then, you can move the selection to the desired location. In the Define curves tab, specify curve parameters, e.g., Extraction mode to normal, Edge Threshold to 32, Edge Filter size to Fine, Minimum Length to 5, Row Search Step Size to 1 and Column Search Step size to 1. The setting in Customize Scoring and Specify Match Options tabs are set as default. Save the template by clicking File -> Save Template....
As an example, I have created a few VIs at the following link.

Geometric Template Matching on GitHub

Initialization for the VI inputs is shown below.

No comments:

Post a Comment

Comments are moderated and don't be surprised if your comment does not appear promptly.