Chapter 5
Performing Machine Vision Tasks
©
National Instruments Corporation
5-3
IMAQ Vision for Visual Basic User Manual
to as the measurement coordinate system. The measurement methods
automatically move the ROIs to the correct position using the position of
the measurement coordinate system with respect to the reference
coordinate system. For information about coordinate systems, refer to
Chapter 13,
Dimensional Measurements
, of the
IMAQ Vision Concepts
Manual
.
You can build a coordinate transformation using edge detection or
pattern matching. The output of the edge detection and pattern
matching methods that build a coordinate transformation is a
CWMVCoordinateTransformation object, which contains a reference
coordinate system and a measurement coordinate system. Some machine
vision methods take this transformation and adjust the regions of inspection
automatically. You also can use these outputs to move the regions of
inspection relative to the object programmatically.
Using Edge Detection to Build a Coordinate Transformation
You can build a coordinate transformation using two edge detection
techniques. Use
CWMachineVision.FindCoordTransformUsingRect
to define a reference coordinate system using one rectangular region. Use
CWMachineVision.FindCoordTransformUsingTwoRects
to define a
reference coordinate system using two independent rectangular regions.
Follow the steps below to build a coordinate transformation 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
CWMachineVision.FindCoordTransformUsingRect
,
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.