Vision Part:
Download the tutorial files here
- Aim - Find irrelevant tablets
- Image Buffer: Add Copy (1)—Stores a copy of the original image into the image buffer for later use. The image is stored in Buffer #1.
- Color Threshold: Manual—Thresholds the color image to separate all the tablets in the image from the background. A color threshold is applied to the image in the HSL color space. The resulting binary image contains all the tablets and some noise particles from the background.
- Image Buffer: Add Copy (2)—Stores the binary image with all the pills into the image buffer. The image is stored in Buffer #2
- Image Buffer: Retrieve Copy (1)—Retrieves the original color image from Buffer #1 in the image buffer.
- Color Threshold: Manual—Thresholds the color image to separate all the correctly colored tablets from the rest of the image. A color threshold is applied to the thresholded image in the HSL color space. The hue values of the correctly colored tablets fall in a range from 230 – 255 (red). The resulting binary image contains all the correctly colored tablets and some noise particles from the background. The particles corresponding to the tablets may have holes in them.
- Adv. Morphology: Fill Holes—Improves the binary image by filling holes in the particles corresponding to the correct tablets.
- Image Buffer: Add Copy (3)—Stores the binary image with the correct tablet particles into the image buffer. The image is stored in Buffer #3.
- Image Buffer: Retrieve Copy (2)—Retrieves the binary image with all the tablet particles for processing from Buffer #2 in the image buffer. This image becomes the active image.
- Operators: Subtract—Subtracts the binary image with the correct tablet particles from the binary image containing all the particles. The Subtract operator subtracts the image stored in Buffer #3 from the binary image you are processing. The resulting image contains particles that correspond to the foreign tablets and other noise particles in the background.
- Basic Morphology: Erode Objects—Removes noise particles that are present in the image. All noise particles are removed within two erosion iterations. The resulting image contains particles corresponding to the foreign tablets in the image.
- Adv. Morphology: Remove Small Particles—Uses the Particle Analysis function to determine the location of the foreign tablets. The center of mass coordinates of each particle are used to locate the particle in the image.
- Particle Analysis— Find center of mass on the remaining tablets.
- Create LabVIEW VI – follow the guide and generate LabVIEW code from your script.
LabVIEW Part:
- Aim - Mark irrelevant tablets with overlay
- Save original image to buffer
- Use center of mass data to mark the irrelevant tablets on the original image – use one of the IMAQ overlay functions.