You are here: Start » Program Examples » Seat Mount

Seat Mount

Aim

The task is to measure a distance between centers of two seat mounting holes.

Input

An image of a seat mount. The location and orientation of the object is variable.

Output

Calculated distance between mounting holes.

Hints

Location of object is variable. To find object's holes combination of Region Analysis and Template Matching techniques can be used. To do measurements, which are independent of object orientation, CoordinateSystem2D connected with a object location must be prepared. Use LocateSingleObject_Edges to create reference CoordinateSystem2D and then use Region Analysis technique on the selected ROI.

Solution (AVS)

  1. Add EnumerateImages filter to get load consecutive images of some disk directory.

  2. Add LocateSingleObject_Edges filter to find a location of the object.

    • 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.
    • The rotation of the object is in specified range, therefore you can narrow the expected rotation by setting:
      • in Expert Complexity Level: inMinAngle to -30 and inMaxAngle to 30,
      • in Basic Complexity Level: Rotation Tolerance to 60.
    • To speed up locating an object, click the "..." button at the inSearchRegion and select a region of possible object centers.
    • Set inMaxPyramidLevel to 2.
    • To specify the minimum strength of edges used for matching, set inEdgeThreshold to 120.
    • Set inMinScore to 0.850.
  3. Add CreateRectangleRegion filter to create a rectangular region for the next steps of the algorithm. Connect its inputs:

  4. Add ThresholdToRegion filter to create a region containing pixels of the hole. Connect its inputs inRoi with CreateRectangleRegion output outRegion.

  5. Add RegionMassCenter filter to compute a center of the hole.

  6. Select the group of filters CreateRectangleRegion, ThresholdToRegion and RegionMassCenter and extract the Step macrofilter DetectHole by right-clicking on this group and select "Extract Step...". This macrofilter detects center of the hole within input region of interest.

  7. Create the macrofilter's input inRoi of type Region.

  8. Create the macrofilter's output outHoleCenter and connect it with outMassCenter.

  9. Create the macrofilter's output outAlignedRoi and connect it with outAlignedRectangle.

  10. Create the macrofilter's output outHoleRegion and connect it with ThresholdToRegion's output outRegion.

  11. Click the "..." button at the inRoi input in the Properties window, to open the GUI for selecting a ROI. Select the rectangular region containing the first required hole.
    .

  12. Add another DetectHole macrofilter and set its inputs inImage, inRoiAlignment, inFrameWidth and inFrameHeight as in previous steps.

  13. Select the rectangular region containing the second required hole. .

  14. Add PointToPointDistance filter and connect its inputs with outputs of both instances of the DetectHole macrofilter. The output outDistance is desired result of this program.

Macrofilter Main

Macrofilter DetectHole

Used Filters

Icon Name Description
RegionMassCenter_OrNil Computes a point with coordinates equal to the average coordinates of the region's pixels; returns NIL if the region is empty.
EnumerateImages Emulates image acquisition with images stored on disk.
CreateRectangleRegion Creates a region corresponding to a given rectangle.
LocateSingleObject_Edges Detection of an object whose outlines are sharp and rigid. Often one of the first filters in a program.
ThresholdToRegion Extraction of a region of objects that can be defined by a salient brightness.
PointToPointDistance Measures the distance between two points.

Further Readings

  • Blob Analysis - Article presents detailed information about the Blob Analysis technique.
  • Template Matching - Most detailed description of the Template Matching technique.