You are here: Start » Program Examples » Measuring the L-Pipe (l_pipe)

Measuring the L-Pipe (l_pipe)

Aim

The task is to create an application that measures an angle and a width on an L-pipe.

Input

An image of an L-pipe. The location of the object, including the orientation, is variable.

Images are stored in l_pipe directory.

Output

Application should measure following elements:

  1. An angle (blue) of type Real.
  2. A pipe width(violet) of type Real.

.

Hints

This is a typical case for performing measurements aligned to an object's position.

In the first step the object has to be located. We recommend the LocateSingleObject_Edges filter for this purpose. Next, the interesting contours of the objects have to be detected with Shape Fitting filters such as FitSegmentToEdges.

It is important to appropriately connect the 'Alignment' inputs of these filters with the results of the Template Matching (outObject.Alignment). Finally, the measurements can be extracted with AngleBetweenSegments.

Measurement of pipe width can be done using MeasureObjectWidth filter.

Solution (AVS)

  1. In the first step we will load images from consecutive files of some directory. Add filter EnumerateImages to project. At this point we are able to run the program iteration by iteration and see all cases of input images.

  2. Next, a location of pipe should be found. To perform this task add LocateSingleObject_Edges filter. Next connect output image from filter EnumerateImages.

  3. Create template matching model using Template Matching Model Editor.

  4. In next step reference coordinate system will be used to find two pipe's edges. Add two filters FitSegmentToEdges. Connect both inFittingFieldAlignment to outObject.Alignment.

  5. Measure angle between found segments using AngleBetweenSegments filter.

  6. To find L-Pipe width add filter MeasureObjectWidth. Connect inScanFieldAlignment input with output outObject.Alignment of LocateSingleObject_Edges and select a scanning field as on the image below.

Main macrofilter calculates pipe's dimensions from images.

Used Filters

Icon Name Description
LocateSingleObject_Edges Detection of an object whose outlines are sharp and rigid. Often one of the first filters in a program.
AngleBetweenSegments Measures the angle between two segments with one of four possible metrics.
FitSegmentToEdges Precise detection of a straight edge, whose rough location is known beforehand.
EnumerateImages Emulates image acquisition with images stored on disk.
MeasureObjectWidth Measures the width of an object using stripe detection.

Further Readings

  • Shape Fitting - This article presents usage of the Shape Fitting technique.
  • Template Matching - Most detailed description of the Template Matching technique.