Example Code

Scaled Invariant Pattern Matching

Code and Documents

Attachment

Description

Overview

NI Vision implements two pattern matching methods - pyramidal matching and image understanding (low discrepancy sampling). Both methods use normalized cross-correlation as a core technique.

The pattern matching process consists of two stages: learning and matching. During the learning stage, the algorithm extracts gray value and/or edge gradient information from the template image. The algorithm organizes and stores the information in a manner that facilitates faster searching in the inspection image. In NI Vision, the information learned during this stage is stored as part of the template image.

During the matching stage, the pattern matching algorithm extracts gray value and/or edge gradient information from the inspection image (corresponding to the information learned from the template). Then, the algorithm finds matches by locating regions in the inspection image where the highest cross-correlation is observed.

Normalized cross-correlation is a good technique for finding patterns in an image when the patterns in the image are not scaled or rotated. Typically, cross-correlation can detect patterns of the same size up to a rotation of 5° to 10°. Extending correlation to detect patterns that are invariant to scale changes and rotation is difficult.

For scale-invariant matching, you must repeat the process of scaling or resizing the template and then perform the correlation operation. This adds a significant amount of computation to your matching process.

 

Take a look to the document

Pattern Matching Techniques

Description

 

This is an example of Scaled Invariant Geometric Matching.

It has been developed using LabVIEW 2013 and IMAQ functions. Inside the zip file you can find the code and you can test it using images inside "images" folder.

"Gauges 00.tif" and "Gauges 10.tif" differentiate each other only by the object in the left down corner; the one in the "Gauges 10.tif" is obtained by the one in "Gauges 00.tif" through a 112% scale procedure.

 

The attached zip file provides also the Template image used within the Geometric Matching algorithm.

 

Steps to Implement or Execute Code

  1. Run the "Scaled Invariant Geometric Matching.vi"

 

Requirements

Software

 

LabVIEW 2013

NI-IMAQ 4.7.3/ NI-IMAQdx 4.3 (driver version used to develop the example)

 

Additional Images or Video

screenshoot.jpg

 

 

Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.