You are here: Start » Program Examples » Calibration World Coordinates On Original Images

Calibration World Coordinates On Original Images

Aim

The goal is to measure the distances between the consecutive center points of each circle.

Input

A few images of the circle calibration grid.

Output

Detected centers of the black circles on the calibration grid and distances between them.

Hints

Black circles are clearly discernible, so it is a good idea to use Region Analysis to find them and their centers, and then to perform rectification using the ImagePointsToWorldPlane.

Solution (AVS)

  1. Add the EnumerateImages filter and specify the directory to images in the inDirectory.

  2. Create a new step macrofilter in which you will produce the algorithm for finding center points. Name it FindCircleCenter. Connect the outImage to its inputs.

  3. Inside of the macrofilter, add the ExtractBlobs_Intensity. Make following changes:

  4. Add the ClassifyRegions filter. Connect the outBlobs to the inRegions. Set:

    • the inFeature to Circularity_BoundingCirclePreserving,
    • the inMinimum to 0.7 to make sure all non-circular blobs are rejected.
  5. Add the SortRegions filter. Connect the outAccepted to the inRegions. Set the inFeature to MassCenterY.

  6. Add the RegionMassCenter filter and connect the outSortedRegions to the inRegion. Connect the outMassCenter to macrofilter inputs as outCenter. Leave the macrofilter.

  7. Back in Main, add the ImagePointsToWorldPlane filter. Connect the outCenter to the inImagePoints.

  8. Open the Calibration Editor by clicking on the inTransform input in the Properties window in the bottom left corner. Load images of the calibration grid by clicking on the button circled in orange:

  9. Determine Board Parameters:

    • Select a proper calibration grid,
    • Specify dimensions - width and height of the calibration grid,
    • When you are ready, click Locate.
  10. If calibration grid's points are correctly located, you can alternatively adjust Camera Parameters (if necessary). Eventually, click on Compute Camera Calibration Model:

  11. If camera calibration model has been successfully computed, click on the Next button. In this step the Image to World Transform is computed. Add at least one image to the Editor:

  12. Now you can either enter points manually, or use the calibration grid to do it automatically. In this example, the other option is shown. When you are ready, you can click on Locate...:

  13. Change the origin segment by setting the Origin point to (0.00, 0.00) and the X-axis point to (200.00, 0.00). If no problems have occurred, click on Compute World Transform.

  14. After successful computation, the Results & Statistics tab will be prompted. You can leave the Editor by clicking OK:

  15. Now add the PointSequenceDistances filter and connect the outWorldPoints to the inPoints. This filter will measure the distance between the consecutive circle centers. If you add another the PointSequenceDistances filter and connect the outCenter to the inPoints, you will observe the connecting segments, but they will not reflect true distances. They will be displayed only for visualization purposes.

Macrofilter Main

Macrofilter FindCircleCenter

Used Filters

Icon Name Description
ImagePointToWorldPlane Finds the world coordinates of image Point.
ShiftWorldPlane Correction of already calibrated world plane. Useful for avoiding recalibration when, for example, the product thickness on a conveyor belt changes by a known amount.
RemoveNils This filter is useful e.g. when inspecting multiple objects while some of the inspections may fail (Nil result). RemoveNils is used to ignore the failed cases in the final result.
EnumerateImages Emulates image acquisition with images stored on disk.
ExtractBlobs_Intensity Segments an image into blobs by thresholding using a single value.
FitCircleToEdges Precise detection of a circular object or hole, whose rough location is known beforehand.
FormatRealToString Useful for preparing a number for display or communication with specific number of fractional digits, sign etc.
RegionMassCenter Computes a point with coordinates equal to the average coordinates of the region's pixels.
ClassifyRegions Use this filter when you have an array of regions and you want to select some of them for further processing.
MakeCircle Creates a circle structure from individual fields.
MakeStringLabel Creates a StringLabel structure from individual fields.
FitCircleToPoints Approximates points with a circle using selected outliers suppression method.

Further Readings