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.

Solution (AVS)

  1. Add an EnumerateImages filter to get load consecutive images of some disk directory.

  2. Add a CheckPresence_EdgeAmount filter.

    • 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 ROI.
  3. In Project Explorer find a "Create New Global Parameter" icon and click it. Set name to Roi and type to Region. Mark the ROI as follows:

  4. Now create a new Variant Step Macrofilter and name it AnalyzeTablets. Define forking port of Bool data type and name the input inTabletsPresent.

  5. Now step into the AnalyzeTablets macrofilter. In "False" variant no changes should be made.

  6. In variant "True" add a DetectMultipleCircles filter.

    • Connect macrofilter input inImage with inImage.
    • Connect global parameter Roi to inRoi.
    • 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).
  7. Add a CircleBoundingBox filter. Connect outCircles.Circle to inCircle.

  8. Add a CheckPresence_Intensity filter.

  9. Add a DrawCircles_TwoColors filter.

  10. Add a CropImage filter.

    • Connect outImage to inImage.
    • In inSelection choose the area to be cropped. If there is no reference image available, try to run the program first.
  11. Connect outImage to macrofilter output.

  12. Go back to Main and add a LastNotNil filter (click "Choose later" while generic filter choosing) and connect macrofilter's output outImage with inObject.

  13. Now create HMI by clicking on HMI Designer in the upper toolbar.

    • Add videoBox and connect outImage to its input inImage. It is going to display the images from the production line.
    • Add other videoBox and connect outImage from AnalyzeTablets to its input inImage.

Macrofilter Main

Macrofilter AnalyzeTablets(True) performs inspection when the pills caret is position.

Macrofilter AnalyzeTablets(False)

Used Filters

Icon Name Description
EnumerateImages Emulates image acquisition with images stored on disk.
DetectMultipleCircles Detection of circular or close-to-circular objects like holes, pins, pills, particles.
CropImage Reduction of the amount of image data to be stored in memory.
CheckPresence_EdgeAmount Quick and easy presence verification, e.g. for missing caps, screws, labels.
CircleBoundingBox Computes the smallest box containing a circle.
CheckPresence_Intensity Quick and easy presence verification, e.g. for missing caps, screws, labels.
LastNotNil Returns the last value passed that existed.

Further Readings