You are here: Start » Tutorial Exercises » Bottle Inspector Part 2: Measuring Liquid Level (bottles_2_level)
Bottle Inspector Part 2: Measuring Liquid Level (bottles_2_level)
Aim
Extend the "Bottle Inspector Part 1" program with measurement of the liquid level for each bottle.
Input
- A set of images of bottles.
- An array containing one coordinate systems for each bottle.
Images are stored in
bottles
directory.
Output
Create a new CheckLiquidLevel macrofilter that returns for each single bottle:
- A point that represents the liquid level (as Point2D),
- A boolean value that shows if the liquid level is correct (as Bool).
Hints
Start by creating a coordinate system for each bottle, so that we can define liquid level measurement as a local operation that will be repeated in multiple coordinate systems. Use a CreateCoordinateSystemFromPoint filter with its input connected to the outStripes.Point1 output.
The pixel intensity profile along a line segment (oriented from top to down) crossing the liquid level looks like this:
As we can see in the profile, there is a peak that represents a bright border between the liquid and the empty part of a bottle. (Note that this might be counter-intuitive, but the liquid is actually not much brighter than the empty space above it). This peak in the profile starts with a dark-to-bright transition, or a raising edge. To find this edge we use a ScanSingleEdge filter.
Solution (FIS)
►Click here to show the solution.