You are here: Start » Tutorial Exercises » Bottle Inspector Part 3: Foam Detection (bottles_3_foam)

Bottle Inspector Part 3: Foam Detection (bottles_3_foam)

Aim

  • Extend the "Bottle Inspector Part 2" program with verification if there is no foam above the liquid level.
  • Design a simple HMI that will present all the inspection results in the end-user's graphical interface.

Input

  • A set of images of bottles.
  • An array of liquid level points from the previous exercise.

Images are stored in bottles directory.

Output

Application with an HMI which performs several inspections:

  • checking of the number of bottles,
  • validation of the liquid levels,
  • detection of foam above the liquid levels.

The results should be presented in HMI, visualized with green or red primitives.

Hints

The foam is much darker than the normal interior of a bottle above the liquid level.

In the first step, use a CreateRectangle filter to create a ROI based on previously calculated liquid level points.

Measure average intensity within the ROI with CheckPresence_Intensity.

Create a simple HMI form:

  • Show the result of a single inspection (Bool type) in PassFailIndicator control.
  • Present an array of Bool values with BoolIndicatorBoard control.
  • Present an image with the VideoBox control.
  • Use Label controls to improve visual appearance of the HMI.

Solution (AVS)

Start with the program created in the "Bottle Inspector Part 2" tutorial.

  1. Add CreateRectangle filter:

    • Connect its inPoint input with the output representing liquid level points.
    • Set its inPointAnchor input to BottomCenter.
    • Set the inWidth and inHeight to 35 and 15 respectively.
  2. Add CheckPresence_Intensity filter and connect its inImage input with the input image and inRoi with the created rectangle.

  3. Set inMinIntensity input to 80.

  4. Draw results of the performed inspections with red and green colors depending on the inspection result. Use DrawRectangles_MultiColor and DrawPoints_MultiColor filters for that.

Macrofilter Main performs all inspections and shows results on the HMI.