You are here: Start » Program Examples » Tablets
Tablets
Aim:
The aim of the program is to detect missing or damaged tablets on a conveyor belt.
Input:
A series of images from the conveyor of a production line.
Output:
Detected missing or damaged tablets:
Hints:
To detect damaged tablets, it is recommended to consider using the DetectMultipleCircles filter together with the CheckPresence_Intensity filter to verify object presence by analyzing pixel intensities. To ensure that the inspection is performed once for each batch of tablets, you can specify a Region Of Interest, where the inspection should be performed, as an input of the CheckPresence_EdgeAmount filter.
Labeling connections is explained in this article.
Solution (FIS):
-
In Workspace Explorer, open the workspace Examples, and in the Filmstrip window, select the Tablets dataset. Drag the Image channel to the ACQUIRE section.
-
Add the CheckPresence_EdgeAmount filter.
- Label the outIsPresent as IsKeyFrame.
- Connect the ReadFilmstrip output to the inImage input of the current one.
- In Properties window, in the bottom left corner, set the inEdgeScale to 2.
- Set the inMinAmount to 0.27 to determine the minimum amount of the pixels that should be detected.
- Click on the CheckPresence_EdgeAmount filter and select the inRoi parameter in the Properties window to mark the region as shown on image below:
-
Add a formula that converts an input image into Nil when no tablets are found:
KeyFrame = if IsKeyFrame then Image else Nil
-
Add the DetectMultipleCircles filter.
- Connect the DetectMultipleCircles.inImage input with the Formula.KeyFrame.
- Set the inRoi as on the image below:
- Set the inRadius to 7 (approximate radius of tablets), the inMaxOverlap to 0 (to avoid overlapping), the inMinScore to 15 (in order not to miss any tablet) and the inEdgeThreshold to 6 (the minimum accepted edge magnitude).
-
Add the CircleBoundingRectangle and connect its inCircle with the DetectMultipleCircles's outCircles
-
Add the CheckPresence_Intensity filter.
- Connect the Formula.KeyFrame with the inImage.
- Connect the CircleBoundingRectangle's outBoundingRectangle with the CheckPresence_Intensity's inRoi.
- Set the inMinContrast to 18 to avoid detecting bad tablets as good ones by checking their contrast.
-
Now create HMI by clicking on HMI Designer in the upper toolbar.
- Add the View2dBox control and connect the ReadFilmstrip output to its inImage input. It is going to display the images from the production line.
- Connect the IsPresent with the View2dBox.InStatus1.
- Connect the TabletCircles with the View2dBox.InData1.
Macrofilter Main
Used Filters
Icon | Name | Description |
---|---|---|
![]() |
CheckPresence_EdgeAmount | Quick and easy presence verification, e.g. for missing caps, screws, labels. |
![]() |
CheckPresence_Intensity | Quick and easy presence verification, e.g. for missing caps, screws, labels. |
![]() |
CircleBoundingRectangle | Computes the smallest rectangle containing a circle. |
![]() |
DelayByPeriod | Suspends the program workflow for inTime milliseconds relative to the end of the filter's last invoke time. |
![]() |
DetectMultipleCircles | Detection of circular or close-to-circular objects like holes, pins, pills, particles. |
Further Readings
- Image Analysis - List of filters analyzing images.