National Instruments IMAQ Vision for LabWindows TM /CVI User Manual

Page 58

Advertising
background image

Chapter 5

Performing Machine Vision Tasks

IMAQ Vision for LabWindows/CVI User Manual

5-6

ni.com

Using Pattern Matching to Build a Coordinate Transform

You can build a coordinate transform using pattern matching. Use

imaqFindTransformPattern()

to define a coordinate system based on

the location of a reference feature. Use this technique when the object under
inspection does not have straight, distinct edges. Complete the following
steps to build a coordinate reference system using pattern matching.

Note

The object may rotate 360

° in the image using this technique if you use

rotation-invariant pattern matching.

1.

Define a template that represents the part of the object that you want
to use as a reference feature. Refer to the

Find Measurement Points

section of this chapter for more information about defining a template.

2.

Define a rectangular ROI in which you expect to find the template.

3.

Use the options parameter to select your options for finding the pattern
and the results that you want to overlay onto the image. When setting
the

Mode

element, select

IMAQ_MATCH_ROTATION_INVARIANT

when

you expect your template to appear rotated in the inspection images.
Otherwise, select

IMAQ_MATCH_SHIFT_INVARIANT

. Set the options

parameter to

NULL

to use the default options.

4.

Choose the mode for the function. To build a coordinate transform for
the first time, set the mode parameter to

IMAQ_FIND_REFERENCE

.

To update the coordinate system in subsequent images, set the mode
parameter to

IMAQ_UPDATE_TRANSFORM

.

Advertising