Chapter 4
IMAQ Vision for LabWindows/CVI User Manual
4-4
ni.com
If you know enough about the shape features of the blobs you want to keep,
use
imaqParticleFilter()
to filter out particles that do not interest
you. If you do not have enough information about the particles you want to
keep at this point in your processing, use the particle measurement
functions to obtain this information before applying a particle filter. See the
section for more information about the
measurement functions.
Separating Touching Blobs
Use
imaqSeparation()
or apply an erosion or an open operation with
imaqMorphology()
to separate touching objects. The
imaqSeparation()
function is an advanced function that separates blobs
without modifying their shapes. However, erosion and open functions alter
the shape of all the blobs.
Note
A separation is a time-intensive operation compared to an erosion or open operation.
Consider using an erosion or open if speed is an issue with your application.
Improving Blob Shapes
Use
imaqFillHoles()
to fill holes in the blobs. Use
imaqMorphology()
to perform a variety of operations on the blobs. You
can use the
IMAQ_AUTOM
,
IMAQ_CLOSE
,
IMAQ_PCLOSE
,
IMAQ_OPEN
, and
IMAQ_POPEN
methods to smooth the boundaries of the blobs. Open and
proper open smooth the boundaries of the blob by removing small
isthmuses while close widens the isthmuses. Close and proper close fill
small holes in the blob. Auto-median removes isthmuses and fills holes.
For more information about these methods, see Chapter 9,
Binary
Morphology
, in the
IMAQ Vision Concepts Manual
.
Make Particle Measurements
After you create a binary image and improve it, you can make particle
measurements. With these measurements you can determine the location of
blobs and their shape features. Use the following functions to perform
particle measurements:
•
imaqGetParticleInfo()
—This function returns the number of
blobs in an image and a report containing the pixel area, real-world
area, and bounding rectangle of the blobs. You can use the bounding
rectangle to determine the location of the blob in the image. You can
also have this function return a report containing 16 of the most