Pills Inspection
Application Type | Inspection |
Image Characteristics | Monochrome; Good Contrast |
Machine Vision Tool(s) | Threshold; Watershed Segmentation; Particle Analysis |
The pill inspection example uses the Watershed Segmentation algorithm to separate pills in an image and then perform particle analysis on the individual pills.
The Watershed Segmentation algorithm partitions an image based on the topographic surface of the image. The image is separated into non-overlapping segments. Each segment contains a unique particle. This example shows how to use the Watershed image to mask the original image and separate the objects. The particle analysis step then analyzes each individual pill.
Threshold: Auto Threshold—Clustering—Separates the bright regions in the image from the rest of the image using an automatic threshold technique.
Image Buffer: Add Copy (1)—Stores a copy of the thresholded image in Buffer #1 of the image buffer for later use.
Distance—Assigns to each pixel a grayscale value equal to the shortest distance to the border of the object, which might be to a hole within the object. This step is a preprocessing step before applying the Watershed Segmentation algorithm.
Watershed Segmentation—The Watershed Segmentation algorithm partitions an image based on the topographic surface of the image. The image is separated into non-overlapping segments, with each segment containing a unique particle. Each region is separated by a line of pixels with values of 0. This line is called the watershed line.
Image Buffer: Add Copy (2)—Stores a copy of the watershed image in Buffer #2 of the image buffer for later use.
Image Buffer: Retrieve Buffer—Retrieves the copy of the thresholded image.
Mask Buffer—Masks the thresholded image with the watershed image. As a result, the pixels of the watershed lines (with values of 0) are set to 0 on the resulting image, therefore separating the particles.
Particle Analysis—Analyzes the properties of the remaining particles (pills) in the image. The particle measurement function can analyze up to 50 different properties of a particle.