Chapter4 BlobAnalysis
IMAQVision for LabWindows/CVI User Manual 4-2 ni.com
Correct Image Distortion
Ifyou need to make accurate shape measurements based on the blobs in
an image containingperspective and nonlinear distortion errors, correct
the distortion using the calibration information you attached to your
image.U se imaqCorrectCalibratedImage()to correct distorti on in
your grayscale image before thresholding it. See Chapter 6, Calibration,
for more information about correcting an image using calibration
information.
Create a Binary Image
Thresholdyour grayscale or color image to create a binary image. Creating
ab inary image separates the objects that you want to inspect from the
background.The threshold operation sets the backgroundpixels to 0 in the
binary image, whiles etting theo bject pixels to a non-zero value. Object
pixelshave a v alue of 1 by default, but you can set the object pixels to any
value or retain their original value.
Youcan use different techniques to threshold your image. If all the
objects of interest in your grayscale image fall within a continuous range
ofintensities and yo u canspeci fy this threshold range manually,use
imaqThreshold()to threshol d your image.
Ifall the objects in your grayscale image are either brighter or darker than
your background, you can use imaqAutoThreshold() toautomatically
determine the optimal threshold range and threshold your image.
Automatic thresholding techniques offer more flexibility than simple
thresholdsbased on fixed ranges. Because automatic thresholding
techniquesdetermine the threshold level according to the image histogram,
theoperation is more independe nt of changes in the overallbrightness and
contrast of the image than a fixedthreshold. These techniques are more
resistant to changes in lighting, which makes them well suited for
automatedinspection tasks.
If your grayscale image contains objects that havemultiple discontinu ous
grayscale values,use imaqMultithreshold() to specify multiple
threshold ranges.
Ifyou need to threshold a color image, use imaqColorThreshold().
You must specify threshold ranges for each of the color planes (either Red,
Green,and Blue or Hue, Saturation, and Luminance). The binary image
resulting from a color threshold is an 8-bit binary image.