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 (AVS)

  1. Add an EnumerateImages filter to get load consecutive images of some disk directory. Double click on the outImage and change its name to Image.

  2. 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:
  3. Add formula which converts an input image into Nil when no tablets are found:

    KeyFrame = if IsKeyFrame then Image else Nil

  4. Add a DetectMultipleCircles filter.

  5. Add a CircleBoundingRectangle and connect its inCircle with DetectMultipleCircles's outCircles

  6. Add a CheckPresence_Intensity filter.

  7. 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.
DetectMultipleCircles Detection of circular or close-to-circular objects like holes, pins, pills, particles.
CheckPresence_EdgeAmount Quick and easy presence verification, e.g. for missing caps, screws, labels.
CircleBoundingRectangle Computes the smallest rectangle containing a circle.
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.

Further Readings