beautypg.com

National Instruments IMAQ Vision for LabWindows TM /CVI User Manual

Page 56

background image

Chapter 5

Performing Machine Vision Tasks

IMAQ Vision for LabWindows/CVI User Manual

5-4

ni.com

Using Edge Detection to Build a Coordinate Transform

You can build a coordinate transform using two edge detection techniques.
Use

imaqFindTransformRect()

to define a coordinate system using

one rectangular region. Use

imaqFindTransformRects()

to define a

coordinate system using two independent rectangular regions. Follow these
steps to build a coordinate transform using edge detection.

Note

To use this technique, the object cannot rotate more than ±65

° in the image.

1.

Specify one or two rectangular ROIs.

a.

If you use

imaqFindTransformRect()

, specify one rectangular

ROI that includes part of two straight, nonparallel boundaries of
the object, as shown in Figure 5-2. This rectangular region must
be large enough to include these boundaries in all the images you
want to inspect.

Figure 5-2. Coordinate Systems of a Reference Image and Inspection Image

1

Search Area for the Coordinate System

2

Object Edges

3

Origin of the Coordinate System

4

Measurement Area

1

4

1

4

a.

b.

2

3

3

2