You are here: Start » Program Examples » Rubber Ring (Advanced)

Rubber Ring (Advanced)

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:

Proper and improper segments of the rubber band.

Hints:

This is another variant of the same example but using more advanced techniques. If you do not feel secure enough, please see the simpler variant here. The effect is just the same, and the solution is more user-friendly, though.

In this example, we use similar techniques to the simpler variant but enriched by additional filters.

Labeling connections is explained in this article.

Solution (AVS):

  1. In Workspace Explorer, open the workspace Examples, and in the Filmstrip window, select the RubberRing dataset. Drag the Image channel to the ACQUIRE section.
  2. Add a new Step macrofilter, name it DetectRing, connect the ReadFilmstrip output to it and get inside.
  3. Add the ThresholdToRegion_Color filter and connect macrofilter's inImage with the inImage.
  4. Click on the ThresholdToRegion_Color filter and set the inMaxDifference to 20 to increase the maximum difference between the image pixel and reference color.
  5. Add the CloseRegion filter.
  6. Add the FillRegionHoles filter.
  7. Add the OpenRegion filter. Connect the outRegion with the inRegion.
  8. Connect the outRegion to macrofilters outputs and name it outRingRegion.
  9. Go back to Main and add a new Step macrofilter, name it GetOuterAndInnerContour. Connect the outRingRegion from a previous macrofilter to it and name it inRingRegion.
  10. Get inside the macrofilter and add the RegionContours filter.
  11. Connect inRingRegion with the inRegion.
  12. Add the ConvertToEquidistantPath filter. Connect the outContours with the inPath.
  13. Add the GetArrayElements filter of the Path type. Connect the outPath with the inArray.
  14. Connect the outValue1 and the outValue2 to macrofilter outputs and name them outOuter and outInner respectively.
  15. Go back to Main and add the PathToPathDistanceProfile filter. Connect the outOuter with the inPath1 and the outInner with the inPath2.
  16. Add the ClassifyByRange filter of the Segment2D type. Make these changes:
  17. Click on the ClassifyByRange filter and, in Properties window:
    • Set the inMinimum to 0 to define a minimal distance.
    • Set the inMaximum to 30 to define a maximal distance.
  18. Add a new Step macrofilter, name it DrawDefects and:
    • Connect the ReadFilmstrip output to it and name it inImage.
    • Connect the outRingRegion from the DetectRegion macrofilter to it and name it inRingRegion.
    • Connect the outHigher to it and name it inErrors.
  19. Get inside the macrofilter and add the ReverseArray filter.
  20. Right-click on the inErrors, find the Property outputs and select Point1 and Point2.
  21. Connect the inErrors.Point1 with the inArray.
  22. Add the JoinArrays filter and connect the inErrors.Point2 with the inArray1. Connect the outArray with the inArray2.
  23. Add the MakePath filter.
  24. Add the AverageChannels filter. Connect macrofilter's inImage with the inImage.
  25. Add the RegionContours filter.
  26. Add the DrawPaths_SingleColor filter.
  27. Add another DrawPaths_SingleColor filter.
  28. Connect the outImage to macrofilter outputs and name it outImage.

Macrofilter Main

Macrofilter DetectRing

Macrofilter GetOuterAndInnerContour

Macrofilter DrawDefects

Used Filters

Icon Name Description
AverageChannels Creates a monochromatic image by averaging the input image channels.
ClassifyByRange E.g. selection of the objects (e.g. blobs) whose associated values (e.g. area) meet the specified minimum and maximum requirements.
CloseRegion Filling-in small gaps in a region without making it thicker.
ConvertToEquidistantPath Creates a new path whose characteristic points lie on the input path, but are equally spaced.
DrawPaths_SingleColor Draws paths on an image with a single color.
FillRegionHoles Adds pixels to the input region so that it contains no holes.
GetArrayElements Extracts up to 8 individual elements from an array.
JoinArrays Concatenates the input arrays one after another.
MakePath Creates a path structure.
OpenRegion Removing small parts from a region without making it thinner.
PathToPathDistanceProfile Computes the profile of distances between two paths.
RegionContours Computes an array of closed paths corresponding to the contours of the input region.
ReverseArray Creates an array of the input array elements in reversed order.
ThresholdToRegion_Color Color analysis with a given reference color.

Further Readings

  • Array - Link to all operations based on arrays in Aurora Vision Studio.
  • Blob Analysis - Article presents detailed information about the Blob Analysis technique.