You are here: Start » Tutorial Exercises » Bottle Inspector Part 3: Foam Detection
Bottle Inspector Part 3: Foam Detection
Aim:
- Extend the "Bottle Inspector Part 2" program with verification to ensure there is no foam above the liquid level.
 - Design a simple HMI that presents 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 the 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 the 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 the CreateRectangle filter to create a ROI based on previously calculated liquid level points.
Measure the average intensity within the ROI with the CheckPresence_Intensity.
Create a simple HMI form:
Solution (AVS)
Start with the program created in the "Bottle Inspector Part 2" tutorial.
- 
Add the CreateRectangle filter:
- Connect its inPoint input with the output representing liquid level points.
 - Set its inPointAnchor input to BottomCenter.
 - Set the inWidth and the inHeight to 35 and 15 respectively.
 
 - 
Add CheckPresence_Intensity filter and connect its inImage input with the input image and the inRoi with the created rectangle.
 - 
Set the inMinIntensity input to 80.
 - 
Draw results of the performed inspections with red and green colors depending on the inspection result. Use the DrawRectangles_MultiColor and the DrawPoints_MultiColor filters for that.
 
Macrofilter Main performs all inspections and shows results on the HMI.

