You are here: Start » Program Examples » Rubber Ring
Rubber Ring
Aim
The aim of the program is to detect improperly assembled segments of a rubber band.
Input
An image of a chip with an assembled rubber band around it.
Output
Detected properly and improperly segments of the rubber band.
Hints
It is possible to achieve this goal in many ways. This is a simpler solution of the problem in which we recommend to use basically Region Analysis.
Solution (FIS)
- Add EnumerateImages filter.
- Add ThresholdToRegion_HSx and connect outImage with inRgbImage.
- Click on ThresholdToRegion_HSx filter and make these changes in Properties window (in the lower left corner):
- Set inEndHue to 10.
- Set inMinSaturation to 190.
- Set inMaxSaturation to 255.
- Set inMinBrightness to 65.
- Set inMaxBrightness to 255.
- Add CloseRegion filter. Connect outRegion from a previous filter with inRegion of the current one.
- Click on CloseRegion filter. In Properties window:
- Add FillRegionHoles filter. Connect outRegion with inRegion.
- Click on FillRegionHoles filter and in Properties window set inMaxHoleArea to 10000.
- Add OpenRegion filter. Connect outRegion with inRegion.
- Click on OpenRegion filter. In Properties window:
- Now add new step, name it DrawDefects and connect these outputs to it:
- Get inside newly-created macrofilter and add RegionContours filter.
- Connect inRingRegion with inRegion. Click on RegionContours filter and set inContourMode to PixelEdges.
- Add another RegionContours filter but connect inErrors with its input inRegion. Set inContourMode to PixelEdges.
- Add AverageChannels filter and connect macrofilter's inImage with inImage.
- Add DrawPaths_SingleColor filter.
- Connect outImage with inImage.
- Connect outContours from the first RegionContours filter and connect with inPaths.
- Click on DrawPaths_SingleColor and in Properties window make these changes:
- Set inColor to green.
- Set inDrawingStyle.Opacity to 0.75.
- Set inDrawingStyle.Thickness to 2.
- Set inDrawingStyle.PointSize to 2.
- Add another DrawPaths_SingleColor filter.
- Connect outImage from a previous filter with inImage of the current one.
- Connect outContours from the other RegionContours filter and connect with inPaths.
- Click on DrawPaths_SingleColor filter and in Properties window make these changes:
- Set inColor to red.
- Set inDrawingStyle.Thickness to 3.
- Set inDrawingStyle.PointSize to 2.
- Connect outImage to macrofilter outputs and name it outImage.
Macrofilter Main
Macrofilter DrawDefects
Used Filters
Icon | Name | Description |
---|---|---|
![]() |
CloseRegion | Filling-in small gaps in a region without making it thicker. |
![]() |
FillRegionHoles | Extends the input region so that it contains also all the pixels previously lying in its holes. |
![]() |
EnumerateImages | Emulates image acquisition with images stored on disk. |
![]() |
DrawPaths_SingleColor | Draws paths on an image with a single color. |
![]() |
AverageChannels | Creates a monochromatic image by averaging the input image channels. |
![]() |
ThresholdToRegion_HSx | Extraction of a region characterized with a specific color. |
![]() |
OpenRegion | Removing small parts from a region without making it thinner. |
![]() |
RegionContours | Computes an array of closed paths corresponding to the contours of the input region. |
Further Readings
- Blob Analysis - Article presents detailed information about the Blob Analysis technique.