Chapter 2 Getting Measurement-Ready Images
IMAQ Vision for Visual Basic User Manual 2-8 ni.com
Use CWIMAQVision.Histogram2 to analyze the overall grayscale
distribution in the image. Use the histogram of the image to analyze
two important criteria that define the quality of an image—saturation and
contrast. If the image does not have enough light, the majority of the pixels
will have low intensity values, which appear as a concentration of peaks on
the left side of the histogram. If the image has too much light, the majority
of the pixels will have a high intensity values, which appear as
a concentration of peaks on the right side of the histogram. If the image has
an appropriate amount of contrast, the histogram will have distinct regions
of pixel concentrations. Use the histogram information to decide if the
image quality is high enough to separate objects of interest from the
background.
If the image quality meets your needs, use the histogram to determine the
range of pixel values that correspond to objects in the image. You can use
this range in processing methods, such as determining a threshold range
during particle analysis.
If the image quality does not meet your needs, try to improve the imaging
conditions to get the appropriate image quality. You may need to
re-evaluate and modify each component of the imaging setup: lighting
equipment and setup, lens tuning, camera operation mode, and acquisition
board parameters. If you reach the best possible conditions with the setup
but the image quality still does not meet your needs, try to improve the
image quality using the image processing techniques described in the
Improve an Image section of this chapter.
Use
CWIMAQVision.LineProfile2 to get the pixel distribution along a
line in the image, or use
CWIMAQVision.RegionsProfile to get the
pixel distribution along a one-dimensional path in the image. By looking at
the pixel distribution, you can determine if the image quality is high enough
to provide you with sharp edges at object boundaries. Also, you can
determine if the image is noisy, and identify the characteristics of the noise.
If the image quality meets your needs, use the pixel distribution
information to determine some parameters of the inspection methods you
want to use. For example, use the information from the line profile to
determine the strength of the edge at the boundary of an object. You can
input this information into
CWIMAQVision.FindEdges2 to find the edges
of objects along the line.