You are here: Start » Program Examples » Gasket Inspection

Gasket Inspection

Aim

The task is to measure a distance between centers of gasket holes.

Input

An image containing a gasket. The position of the gasket is variable.

Output

Calculated distance between two pairs of holes.

Hints

Location of object is variable, therefore in the first step of an algorithm LocateSingleObject_Edges filter should be used. Then its output outObject.Alignment can be used as a reference CoordinateSystem2D to subsequent filters. Centers of holes can be found using FitCircleToEdges filters. Centers of the holes which are not closed can be found using FitArcToEdges.

Labeling connections is explained in this article.

Solution (AVS)

  1. Add EnumerateImages filter to get load consecutive images of some disk directory.
  2. To find location of the gasket add LocateSingleObject_Edges filter.
    • Click the "..." button at the inEdgeModel input to open the GUI for creating template matching models.
    • Select the template region which should contain characteristic edges of the object, but should be not too big.
    • Mark the SearchRegion, which is an area of possible object centers. Please note that, as in the case of inEdgeModel the smaller SearchRegion, results in the shorter execution time.
  3. Add two FitCircleToEdges filters. Connect to them an input image and outObject.Alignment from LocateSingleObject_Edges filter.
    • Click the "..." button at the inFittingField input and set the fitting field.
  4. Add PointToPointDistance filter and connect to it the outCircle.Center from both FitCircleToEdges filters.
  5. Add two FitArcToEdges filters. Connect to them an input image and outObject.Alignment from LocateSingleObject_Edges filter.
    • Click the "..." button at the inFittingField input and set the fitting field.
  6. Add PointToPointDistance filter and connect to it the outArc.Center from both FitArcToEdges filters.

Macrofilter Main

Used Filters

Icon Name Description
FitCircleToEdges Precise detection of a circular object or hole, whose rough location is known beforehand.
LocateSingleObject_Edges Detection of an object whose outlines are sharp and rigid. Often one of the first filters in a program.
FitArcToEdges Precise detection of an arciform edge, whose rough location is known beforehand.
EnumerateImages Emulates image acquisition with images stored on disk.
PointToPointDistance Measures the distance between two points.

Further Readings

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