Support Blog

Support Article Filter

Search Support Articles

Ask Multipix a Question Back to Support

Calibrating a Camera with an Arbitrary Calibration Plate Using HALCON

Camera calibration determines the interior and exterior camera parameters based on a sufficiently large number of accurately known three-dimensional world points in metric units and their point correspondences in pixel in the two-dimensional image plane. For good calibration results, a calibration plate on which the three-dimensional world points are very accurately known is required. Moreover, calibration images of high quality are necessary to allow accurate extraction of the marks.

In HALCON, calibration can be performed with both standard and custom calibration plates. In general, the calibration requires: First, the coordinates of the three-dimensional world points in metric units. Second, the center points of the observed calibration marks in pixel, which have the same index as their corresponding three-dimensional world points. Third, an initial pose of the calibration plate with respect to the camera coordinate system and initial camera parameters.

The coordinates of the three-dimensional world points can be collected in a tuple by knowing the distances between two subsequent marks. Alternatively, save the world points in a file that can be read by HALCON.

A possible approach to find the center points of the observed calibration marks in pixel, which have the same index as their corresponding world points, involves the following steps.

Initially, determine the calibration plate’s domain by applying blob analysis and reduce the image to this domain. Then, estimate the calibration plate’s pose with respect to the camera coordinate system and project the world points into the image plane. Depending on the calibration plate’s shape, we recommend using find_calib_deformable_model, vector_to_pose or get_rectangle_pose. If the calibration plate has rectangular arranged marks, we recommend extracting the four corner marks, determining their center points by fitting an ellipse and then applying vector_to_pose. Then, project the world coordinates XCoord, YCoord, ZCoord into the image plane:


The figure below shows the results obtained so far.

Fig. 1: Intermediate results which are used for extracting the marks.

Next, generate a circle around each projected world point with radius about twice the radius of the mark within a for-loop. Reduce the domain to that circle and apply edges_sub_pix to find the contour with sub-pixel precision. Finally, fit an ellipse to each contour by applying fit_ellipse_contour_xld and collect the coordinates of the center point of the ellipses in tuples.

The initial pose of the calibration plate with respect to the camera coordinate system can be estimated by applying vector_to_pose on the three-dimensional world coordinates and their correspondences in image coordinates obtained as described above. The initial camera parameters can be set by consulting the data sheets of the used camera and lens.

Finally, pass the information obtained so far to the calibration handle created previously and apply calibrate_cameras to perform the calibration:





calibrate_cameras(CalibDataID, Error)


All questions are moderated before they are published on this website. Once we receive your question, we will review and decide whether to email you directly or publish the solution to help other users.

Ask Multipix a Question

Your email address will not be published. Required fields are marked *

  • Euresys
  • FingerLake Instruments
  • IO Industries
  • Moritex
  • Basler
  • Imperx