Chapter 5 Performing Machine Vision Tasks
IMAQ Vision for Visual Basic User Manual 5-8 ni.com
Set Search AreasSelect ROIs in the images to limit the areas in which you perform the
processing and inspection. You can define ROIs interactively or
programmatically.
Defining Regions Interactively
Follow these steps to interactively define an ROI:
1. Call
CWMachineVision.SetupViewerFor<shapename>Selection.
The following <shapename> values are available: Annulus, Line,
Point, Rectangle, and RotatedRect. This method configures the
viewer to display the appropriate tools for the shape you want to select.
2. Draw an ROI on the image. Resize or reposition the ROI until it defines
the area of the image you want to process.
3. Use CWMachineVision.GetSelected<shapename>FromViewer
to programmatically retrieve the shape from the viewer.
You also can use the techniques described in Chapter3, Making Grayscale
and Color Measurements, to select an ROI.
Table5-1 indicates which ROI selection methods to use with a given
CWMachineVision method.
Table 5-1. ROI Selection Methods to Use with CWMachineVision Methods
CWMachineVision ROI Selection Methods CWMachineVision Method
SetupViewerForRotatedRectSelection
GetSelectedRotatedRectFromViewer
FindPattern
MeasureMaximumDistance
MeasureMinimumDistance
FindStraightEdge
LightMeterRectangle
SetupViewerForAnnulusSelection
GetSelectedAnnulusFromViewer
FindCircularEdge
FindConcentricEdge