Calibrate a Camera

Description

The camera calibration task of UW-MOS, responsible for obtaining the intrinsic parameters ruling the internal geometry of the camera, i.e., how a point from the world is projected onto the image plane.

This calibration is usually performed using a calibration pattern, from which some points belonging to a common known plane can be extracted. By means of a known planar pattern, and some user intervention, the 3D-2D relations can be established. Then, by means of the DLT algorithm and a non-linear optimization procedure, the parameters of the camera are recovered.

Configuration

The calibration method allows using two different types of patterns:

  • Chessboard/Checkerboard pattern, with the common black/white squares. The calibration method needs to detect the internal corners of this pattern.

  • Charuco pattern: an extension of the chessboard pattern, with the inclusion of easily- detectable AR markers, which help in the detection of the corners used for calibration. Follow this link for instructions on how to create this type of patterns using the OpenCV library.

The following figures show an example of both types:

Chessboard pattern

10 x 10 chessboard pattern (download a large resolution version).

Charuco pattern

10 x 10 charuco pattern (download a large resolution version).

The parameters to configure for this task are the following:

  • A set of images observing the calibration pattern.

  • The pattern type you are using (cheessboard or charuco).

  • The number of squares in X and Y in the pattern.

  • The side length of each square, in meters.

Additionally, just for the case of using a Charuco pattern, you need to also provide:

  • Side length of the markers, in meters.

  • The dictionary ID of the markers.

Results

Upon task completion, the calibration will be in the form of a json file, which you can quickly view by clicking on the See results button, or download using the Download button.

The structure of the json file is the following:

{
    "camera": {
        "id": 0,
        "width": 384,
        "height": 288,
        "image_projection_type": "pinhole",
        "image_projection": {
            "fx": 406.060066954618,
            "fy": 405.990806924723,
            "cx": 189.32634649219083,
            "cy": 135.71180929154955,
            "skew": 0.0,
            "optim_fx": false,
            "optim_fy": false,
            "optim_cx": false,
            "optim_cy": false,
            "optim_skew": false
        },
        "lens_distortion_type": "plumb_bob",
        "lens_distortion": {
            "k1": -0.3900273084092475,
            "k2": 0.38908742829150097,
            "k3": -0.4253151791982359,
            "t1": 0.0032801115104600638,
            "t2": -0.0003337298354829034,
            "optim_k1": false,
            "optim_k2": false,
            "optim_k3": false,
            "optim_t1": false,
            "optim_t2": false
        }
    }
}

As described in image_projection_type and lens_distortion_type, we assume a pinhole projection model and a plumb-bob distortion model. The relevant parameters of these models are:

  • fx, fy: focal length in X and Y (pixels), which is the orthogonal distance from the center of the camera to the image plane.

  • cx, cy: the principal point, which is the point located at the intersection of the focal axis and the image plane.

  • skew: skew parameter, only used in cases where the axes of the images are not fully orthogonal.

  • k1, k2, k3, t1, t2: parameters of the plumb-bob distortion model: three radial (k) and two tangential (t).

A more in-depth explanation of the parameters listed above can be found here. You can ignore the id parameter and those parameters starting by optim_, as they are internal of our calibration library.

Moreover, the app allows downloading additional data showing the results of the calibration by clicking on the Download Reprojection Data button of the task item. This button will trigger the download of a zip file containing three folders:

  • detection: the corners of the pattern as detected automatically by the service.

  • reprojection: the reprojected corners of the pattern. Given the calibrated intrinsic parameters, the known geometry of the pattern, and the pose of the camera with respect to the pattern at the time of taking the image (a side-result of the calibration procedure), we follow the pinhole + distortion model to reproject where the points of the pattern should project on the image. Ideally, if the calibration is correct, the reprojected points should coincide with the location of the corners of the pattern in the image.

  • detection-reprojection: the output of both previous folders combined, so that the user can see in the same image the detected points vs. the reprojected ones.

Demo

We provide here a sample dataset using the common chessboard pattern underwater. This dataset is a part of the dataset presented in [Mallios2017].

The pattern used a regular chessboard pattern, with 11 x 11 squares, each with a side length of 0.056m. Therefore, the configuration page should look as follows:

Calibration demo config

Configuration of the calibration task for the demo data.

After submitting this form, you can inspect the results on the Tasks list.

References

Mallios2017

Mallios, A.; Vidal, E.; Campos, R. & Carreras, M. Underwater caves sonar data set. The International Journal of Robotics Research, 2017, 36, 1247-1251. doi: 10.1177/0278364917732838