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 with the inPoint input connected with the output representing liquid level points and with inPointAnchor set to BottomCenter. Set width and height to 35 and 15 respectively.

  2. Add CheckPresence_Intensity filter with inImage connected with the input image and inRoi connected with the created rectangle.

  3. Extract a "CheckFoamAbsence" macrofilter from the two filters. Create and connect outputs of this macrofilter: outFoamArea (Rectangle2D) and outFoamAreaOK (Bool).

  4. Add another macrofilter, "DrawResults", with filters visualizing the performed inspections with red and green colors depending on the results. Use DrawRectangles_TwoColors and DrawPoints_TwoColors filters for that.

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

Macrofilter CheckFoamAbsence performs inspection of foam.

Macrofilter DrawResults prepares visualization for the HMI.