National Instruments IMAQTM Digital Camera User Manual


 
Chapter 4 Performing Particle Analysis
IMAQ Vision for Visual Basic User Manual 4-2 ni.com
If all the objects in the grayscale image are either brighter or darker than
the background, you can use
CWIMAQVision.AutoThreshold to
automatically determine the optimal threshold range and threshold the
image. Automatic thresholding techniques offer more flexibility than
simple thresholds based on fixed ranges. Because automatic thresholding
techniques determine the threshold level according to the image histogram,
the operation is more independent of changes in the overall brightness and
contrast of the image than a fixed threshold. These techniques are more
resistant to changes in lighting, which makes them well suited for
automated inspection tasks.
If the grayscale image contains objects that have multiple discontinuous
grayscale values, use
CWIMAQVision.MultiThreshold2 to specify
multiple threshold ranges.
If you need to threshold a color image, use
CWIMAQVision.ColorThreshold. You must specify threshold
ranges for each of the color planes—Red, Green, and Blue; or Hue,
Saturation, and Luminance. The binary image resulting from a color
threshold is an 8-bit binary image.
Improve the Binary Image
After you threshold the image, you may want to improve the resulting
binary image with binary morphology. You can use primary binary
morphology or advanced binary morphology to remove unwanted
particles, separate connected particles, or improve the shape of particles.
Primary morphology methods work on the image as a whole by processing
pixels individually. Advanced morphology operations are built upon
the primary morphological operators and work on particles as opposed
to pixels.
The advanced morphology methods that improve binary images require
that you specify the type of connectivity to use. Connectivity specifies how
IMAQ Vision determines if two adjacent pixels belong to the same particle.
If you have a particle that contains narrow areas, use connectivity-8 to
ensure that the software recognizes the connected pixels as one particle.
If you have two particles that touch at one point, use connectivity-4 to
ensure that the software recognizes the pixels as two separate particles.
For more information about connectivity, refer to Chapter 9, Binary
Morphology, of the IMAQ Vision Concepts Manual.
Note Use the same type of connectivity throughout the application.