You are here: Start » Program Examples » Calibration World Coordinates With Remapped Images

Calibration World Coordinates With Remapped Images

Aim

The goal is to compute the world coordinates based on given images of the calibration grid.

Input

A few images of the calibration grid.

Output

Located calibration grid and center points of two first circles on the board.

Hints

First of all, as there are both lens and perspective distortion, they need to be removed by using the RectifyImage filter. Next, to correctly locate the circle board it is best to use LocateSingleObject_Edges. Eventually, to find the center points of circles, try fitting a corresponding shape to them and use an appropriate property output.

Solution (AVS)

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

  2. Add the RectifyImage filter. Connect outImage to inImage. Click on the filter and in the Properties window, and then click on the inRectificationMap input.

  3. In the Calibration Editor you need to follow the exact same steps as it was described in the Calibration World Coordinates On Original Images example in steps 8-14 except for one additional step:

  4. If you have prepared the rectification transform, now you can proceed with the algorithm - add the LocateSingleObject_Edges filter and create a new edge model by clicking on the inEdgeModel input in the Properties window of the filter. Create your model in a following way:

  5. You can also narrow the search region down to accelerate computations by clicking on the inSearchRegion input in the Properties window of the filter and marking a suitable area. Additionally, to increase the accuracy of matching the template:

  6. Now add two FitCircleToEdges filters. Connect outImage to inImage and outObject.Alignment to inFittingFieldAlignment (for both filters at once).

  7. For both of the filters, determine inFittingField, so that circles are correctly fitted. Set inEdgeScanParams.EdgeTransition to DarkToBright as circles are black. Right-click on the outCircle output, select Property Outputs and choose Center.

  8. Now add the PointToPointDistance filter and connect outCircle.Center from both of the filters to inPoint1 and inPoint2 respectively. This filter will allow you to calculate the distance in pixels between the centers of the circles.

  9. To compute the world coordinates, use two ImagePointsToWorldPlane filters and connect Center Points from the FitCircleToEdges filters to the inImagePoints input. Finally, connect outRectifiedTransform to inTransform in both filters.

Macrofilter Main

Used Filters

Icon Name Description
EnumerateImages Emulates image acquisition with images stored on disk.
FitCircleToEdges Precise detection of a circular object or hole, whose rough location is known beforehand.
PointToPointDistance Measures the distance between two points.
LocateSingleObject_Edges Detection of an object whose outlines are sharp and rigid. Often one of the first filters in a program.
RectifyImage Image undistortion, perspective removal.
ImagePointsToWorldPlane Undistortion, image to world coordinate transformation.

Further Readings