You are here: Start » Tutorial Exercises » Shape Fitting: Gasket (shape_fitting_gasket)

Shape Fitting: Gasket (shape_fitting_gasket)

Aim

Your task is to create a program which will be able to measure the distance between two holes in a gasket.

Input

Images of a gasket having variable location and rotation.

The input images are stored in gasket_inspection directory.

Output

The distance between the centers of two holes.

Hints

Start the program as in the "Edge-based Template Matching: Gasket" tutorial. Then use FitCircleToEdges filters to precisely detect the holes and PointToPointDistance to measure the distance between their centers.

Solution (AVS)

  1. Start with the program created in the "Edge-based Template Matching: Gasket" tutorial.

  2. Add FitCircleToEdges filter and define its inFittingField input as shown in the picture below.

  3. Add a second FitCircleToEdges filter and configure it for the second hole.

  4. Add the output circles to a data preview.

  5. Expose the outCircle.Center output on both of the shape fitting filters by using the "Show/Hide Ports" command.

  6. Add PointToPointDistance filter and connect the two circle centers to its inputs.

  7. Create a second data preview for the outDistance output.

Further Readings

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