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 the LocateSingleObject_Edges1. 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 the EnumerateImages and specify the directory to images in the inDirectory.

  2. Add the RectifyImage filter. Connect the outImage to the 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_Edges1 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 the outImage to the inImage and the outObject.Alignment to the inFittingFieldAlignment (for both filters at once).

  7. For both of the filters, determine the inFittingField, so that the circles are correctly fitted. Set the 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 the outCircle.Center from both of the filters to the inPoint1 and the 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 the Center Points from the FitCircleToEdges filters to the inImagePoints input. Finally, connect the outRectifiedTransform to the inTransform in both filters.

Macrofilter Main

Used Filters

Icon Name Description
PixelsToMillimetres Converts a length in pixels to millimetres using the given scale [px / mm].
CreateCoordinateSystemFromPoint Most often used to define an object alignment from results of 1D Edge Detection or Blob Analysis.
RegionBoundingCircle_OrNil Computes the smallest circle enclosing a region; returns NIL if the region is empty.
MakeSegment Creates a segment structure from individual fields.
EnumerateImages Emulates image acquisition with images stored on disk.
AlignPoint Required when there is a point defined in a local coordinate system, but the next image-related filter in the program does not have any inAlignment input.
ExtractBlobs_Intensity Segments an image into blobs by thresholding using a single value.
AlignSegment Required when there is a segment defined in a local coordinate system, but the next image-related filter in the program does not have any inAlignment input.
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.
RectifyImage Applies a spatial map to distorted image transforming it to rectified image defined in world coordinates.
ClassifyRegions Use this filter when you have an array of regions and you want to select some of them for further processing.
MakeStringLabel Creates a StringLabel structure from individual fields.

Further Readings