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 the DetectMultipleCircles filter together with the 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 the CheckPresence_EdgeAmount filter.

Labeling connections is explained in this article.

Solution (AVS)

  1. In Workspace Explorer open workspace Examples and in Film strip window select Tablets dataset. Drag the Image channel to the ACQUIRE section.

  2. Add the CheckPresence_EdgeAmount filter.

    • Label the outIsPresent as IsKeyFrame.
    • Connect the ReadFilmstrip output to the inImage input of the current one.
    • In Properties window in the bottom left corner set the inEdgeScale to 2.
    • Set the inMinAmount to 0.27 to determine the minimum amount of the pixels that should be detected.
    • Click on the CheckPresence_EdgeAmount filter and select the 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 the DetectMultipleCircles filter.

    • Set the inRadius to 7 (approximate radius of tablets), the inMaxOverlap to 0 (to avoid overlapping), the inMinScore to 15 (in order not to miss any tablet) and the inEdgeThreshold to 6 (the minimum accepted edge magnitude).
  5. Add the CircleBoundingRectangle and connect its inCircle with the DetectMultipleCircles's outCircles

  6. Add the CheckPresence_Intensity filter.

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

    • Add the View2dBox control and connect the ReadFilmstrip output to its inImage input. It is going to display the images from the production line.
    • Connect the IsPresent with the View2dBox.InStatus1.
    • Connect the TabletCircles with the View2dBox.InData1.

Macrofilter Main

Used Filters

Icon Name Description
CheckPresence_EdgeAmount Quick and easy presence verification, e.g. for missing caps, screws, labels.
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.
CircleBoundingRectangle Computes the smallest rectangle containing a circle.
DelayByPeriod Suspends the program workflow for inTime milliseconds relative to the end of the filter's last invoke time.

Further Readings