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 a DetectMultipleCircles filter together with a CheckPresence_Intensity filter to verify object presence by analyzing pixel intensities. To ensure that the inspection is performed once for an every batch of tablets, you can specify a Region Of Interest, where the inspection should be performed, as an input of CheckPresence_EdgeAmount filter.
Labeling connections is explained in this article.
Solution (FIS)
-
Add an EnumerateImages filter to get load consecutive images of some disk directory. Double click on the outImage and change its name to Image.
-
Add a CheckPresence_EdgeAmount filter.
- Change the name of outIsPresent to IsKeyFrame.
- Connect outImage from the previous filter to inImage of the current one.
- In Properties window in the bottom left corner set inEdgeScale to 2.
- Set inMinAmount to 0.27 to determine the minimum amount of the pixels that should be detected.
- Click on the CheckPresence_EdgeAmount filter and select inRoi parameter in the Properties window to mark the region as on image below:
-
Add formula which converts an input image into Nil when no tablets are found:
KeyFrame = if IsKeyFrame then Image else Nil
-
Add a DetectMultipleCircles filter.
- Connect input DetectMultipleCircles.inImage with Formula.KeyFrame.
- Set inRoi as on the image below:
- Set inRadius to 7 (approximate radius of tablets), inMaxOverlap to 0 (to avoid overlapping), inMinScore to 15 (in order not to miss any tablet) and inEdgeThreshold to 6 (the minimum accepted edge magnitude).
-
Add a CircleBoundingRectangle and connect its inCircle with DetectMultipleCircles's outCircles
-
Add a CheckPresence_Intensity filter.
- Connect Formula.KeyFrame with inImage.
- Connect CircleBoundingRectangle's outBoundingRectangle with CheckPresence_Intensity's inRoi.
- Set 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 View2dBox and connect outImage to its input inImage. It is going to display the images from the production line.
- Connect IsPresent with View2dBox.InStatus1.
- Connect TabletCircles with View2dBox.InData1.
Macrofilter Main
Used Filters
Icon | Name | Description |
---|---|---|
![]() |
EnumerateImages | Emulates image acquisition with images stored on disk. |
![]() |
CircleBoundingRectangle | Computes the smallest rectangle containing a circle. |
![]() |
DetectMultipleCircles | Detection of circular or close-to-circular objects like holes, pins, pills, particles. |
![]() |
CheckPresence_Intensity | Quick and easy presence verification, e.g. for missing caps, screws, labels. |
![]() |
DelayByPeriod | Suspends the program workflow for inTime milliseconds relative to the end of the filter's last invoke time. |
![]() |
CheckPresence_EdgeAmount | Quick and easy presence verification, e.g. for missing caps, screws, labels. |
Further Readings
- Image Analysis - List of filters analyzing images.