You are here: Start » Program Examples » Radiator Holes

Radiator Holes

Aim

The task is to detect holes on the radiator and measure the distance between their centers.

Input

An image of the radiator. The position is stable, but may slightly vary.

Output

Detected circles and segments between them.

Hints

Shape Fitting allows for precise detection of line segments, circles, arcs and paths with sub-pixel precision. Therefore this technique is the best choice in cases that require high precision of the measurements, like this one. Use the FitCircle filter and remember that the right-clicking on the input or the output of a filter will show advanced properties.

Solution (AVS)

  1. In Workspace Explorer open workspace Examples and in Film strip window select Radiator dataset. Drag the Image channel to the ACQUIRE section.

  2. Add the first FitCircleToEdges filter and create an appropriate fitting field for the biggest hole. After that generate a Global Parameter by right-clicking on the FittingField and selecting Extract Global Parameter option.

  3. Set the inScanCount to 100 to increase the number of points that will be searched.

  4. Set the inScanWidth to 13 to make a scanning field wider, so that the scanning results will be more resistant to noise.

  5. To detect the four similar holes at the same time add the second FitCircleToEdges filter. It will be executed in an array mode. To do so create a Global Parameter. Its type should be CircleFittingFieldArray. Then set the appropriate Fitting Fields as shown:

  6. The inFittingField is hidden by default, use the Show/HidePorts and select the inFittingField to make it visible, then connect a Global Parameter there:

  7. Set the inScanCount to 25 to increase the number of points that will be searched to estimate the position of the circle.

  8. Set the EdgeTransition to DarkToBright as the background in the smaller holes is darker than the surface of the radiator.

  9. To create segments connecting the centers of detected circles use the MakeSegment filter. Connect the outCircle.Center from both FitCircleToEdges filters to the individual inPoint inputs. Drop the outSegment on the preview window. To extract information about the length use the Show/HidePorts and choose the outSegment.Length.

  10. To prevent the algorithm from calculating the distance between centers, when the lack of detection occurs, use the SkipArrayWithNils to omit any array containing the Nil value. Connect the outCircle.Center output to the inArray input to apply it.

  11. Add the PointSequenceDistances filter that measures the distances between consecutive points in the input array. The question mark in the name of the filter indicates that it will be executed conditionally. It means that the distance will not be measured if at least one circle is not detected.

Macrofilter Main

Used Filters

Icon Name Description
FitCircleToEdges Precise detection of a circular object or hole, whose rough location is known beforehand.
MakeSegment Creates a segment structure from individual fields.
SkipArrayWithNils Changes an array with conditional elements into a conditional array. Can be useful if some processing should be performed only when all expected objects are correctly detected.
PointSequenceDistances Measures the distances between consecutive points of a point sequence.

Further Readings

  • Shape Fitting - This article presents usage of the Shape Fitting technique.