Chapter3 Grayscaleand Color Measurements
IMAQVision for LabWindows/CVI User Manual 3-6 ni.com
Youcan also use imaqSelectPoint(),imaqSelectLine(),
imaqSelectRect(),andimaqSelectAnnulus() to defineregions of
interest. Followthese steps to use these functions:
1. Call the function to display an image in an ROIConstructor window.
Only the tools specific to that function are availablefor you to use.
2. Drawan ROI on your image. Resize or reposition the ROI until it
coversthe area you want to process.
3. Clickthe OK button to populate a structure represent ing the ROI.You
can uset his structure as an input to a varietyof functions, such as the
followingfunctions that measure grayscale intensity:
imaqLightMeterPoint()Usesthe output of
imaqSelectPoint()
imaqLightMeterLine()Usesthe output of
imaqSelectLine()
imaqLightMeterRect()Usesthe output of
imaqSelectRect()
Programmatically Defining Regions
Whenyou have an aut omated application, you may need to define regions
ofinterest programmatically. To programmatically define an ROI, create
the ROI using imaqCreateROI()and t hen add the individual contours.
A contour is a shape that defines an ROI. You can create contours from
points,lines, rectangles, ovals, polygons, and annuli. For example, t o add a
rectangular contour to an ROI, use imaqAddRectContour().
Specifyregions by providing basic parameters that describe the region you
wantto define. For example, define a point by providing the x-coordinate
andy-coordinate. Define a line by specifying the start and end coordinates.
Definea rectangle by specifying the coordinates of the top, left point; the
widthand height; and the rotation angle (in the case of a rotated rectangle).
Defining Regions with Masks
Youcan define regions to process with image masks. An image mask is
an8-bit image of the same size as or smaller than the image you want to
process. Pixels in the mask image determine whether the corresponding
pixelin the source image needs to be processed. If a pixel in the image
mask has a value different than 0, the corresponding pixel in the source
image is processed. If a pixel in the image mask has a value of 0, the
corresponding pixel in the source image is left unchanged.