Home

Awesome

BabelCalib: A Universal Approach to Calibrating Central Cameras

<div align="center">

Paper Datasets Conference Poster Youtube

This repository contains the MATLAB implementation of the BabelCalib calibration framework.

<img src="./assets/teaser.png" width="500rem">

<b>Method overview and result.</b> (left) BabelCalib pipeline: the camera model proposal step ensures a good initialization (right) example result showing residuals of reprojected corners of test images.

<br/> <img src="./assets/ex1.png" width="200rem"> <img src="./assets/ex2.png" width="200rem"> <img src="./assets/ex3.png" width="200rem">

<b>Projection of calibration target from estimated calibration.</b> Detected corners are red crosses, target projected using initial calibration are blue squares and using the final calibration are cyan circles.

</div>

Description

BabelCalib is a calibration framework that can estimate camera models for all types of central projection cameras. Calibration is robust and fully automatic. BabelCalib provides models for pinhole cameras with additive distortion as well as omni-directional cameras and catadioptric rigs. The supported camera models are listed under the solvers directory. BabelCalib supports calibration targets made of a collection of calibration boards, i.e., multiple planar targets. The method is agnostic to the pattern type on the calibration boards. It is robust to inaccurately localized corners, outlying detections and occluded targets.

Table of Contents


<a name="installation"/>

Installation

You need to clone the repository. The required library Visual Geometry Toolkit is added as a submodule. Please clone the repository with submodules:

git clone --recurse-submodules https://github.com/ylochman/babelcalib

If you already cloned the project without submodules, you can run

git submodule update --init --recursive 
<a name="calibration"/>

Calibration

Calibration is performed by the function calibrate.m. The user provides the 2D<->3D correspondence of the corner detections in the captured images as well as the coordinates of the calibration board fiducials and the absolute poses of the calibration boards. Any calibration board of the target may be partially or fully occluded in a calibration image. The camera model is returned as well as diagnostics about the calibration.

function [model, res, corners, boards] = calibrate(corners, boards, imgsize, varargin)

Parameters:

Returns

<a name="evaluation"/>

Evaluation

BabelCalib adopts the train-test set methodology for fitting and evaluation. The training set contains the images used for calibration, and the test set contains held-out images for evaluation. Evaluating a model on test-set images demonstrates how well a calibration generalizes to unseen imagery. During testing, the intriniscs are kept fixed and only the poses of the camera are regressed. The RMS re-projection error is used to assess calibration quality. The poses are estimated by get_poses.m:

function [model, res, corners, boards] = get_poses(intrinsics, corners, boards, imgsize, varargin)

Parameters:

Returns

<a name="defs"/>

Type Defintions

<a name="corners"/>

corners : 1xN struct array

Contains the set of 2D<->3D correspondences of the calibration board fiducials to the detected corners in each image. Here, we let N be the number of images; Kn be the number of detected corners in the n-th image, where (n=1,...,N); and B be the number of planar calibration boards.

fielddata typedescription
x2xKn array2D coordinates specifying the detected corners
cspond2xKn arraycorrespondences, where each column is a correspondence and the first row contains the indices to points and the second row contains indices to calibration board fiducials
<a name="boards"/>

boards : 1xB struct array

Contains the set of absolute poses for each of the B calibration boards of the target, where (b=1,...,B) indexes the calibration boards. Also specifies the coordinates of the fiducials on each of the calibration boards.

fielddata typedescription
Rt3x4 arrayabsolute orientation of each pose is encoded in the 3x4 pose matrix
X2xKb array2D coordinates of the fiducials on board b of the target. The coordinates are specified with respect to the 2D coordinate system attached to each board
<a name="model"/>

model : struct

Contains the intrinsics and extrinsics of the regressed camera model. The number of parameters of the back-projection or projection model, denoted C, depends on the chosen camera model and model complexity.

fielddata typedescription
proj_modelstrname of the target projection model
proj_params1xC arrayparameters of the projection/back-projection function
K3x3 arraycamera calibration matrix (relating to A in the paper: K = inv(A))
Rt3x4xN arraycamera poses stacked along the array depth
<a name="res"/>

res : struct

Contains the information about the residuals, loss and initialization (minimal solution). Here, we let K be the total number of corners in all the images.

fielddata typedescription
lossdoubleloss value
irdoubleinlier ratio
reprojerrs1xK arrayreprojection errors
rmsdoubleroot mean square reprojection error
wrmsdoubleroot mean square weighted reprojection error (Huber weights)
infotype info
<a name="info"/>

info : struct

Contains additional information about the residuals, loss and initialization (minimal solution).

fielddata typedescription
dx2xK arrayre-projection difference vectors: dx = x - x_hat
w1xK arrayHuber weights on the norms of dx
residual2xK arrayresiduals: residual = w .* dx
cs1xK array (boolean)consensus set indicators (1 if inlier, 0 otherwise)
min_modeltype modelmodel corresponding to the minimal solution
min_restype resresidual info corresponding to the minimal solution
<a name="cfg"/>

cfg

cfg contains the optional configurations. Default values for the optional parameters are loaded from parse_cfg.m. These values can be changed by using the varargin parameter. Parameters values passed in by varargin take precedence. The varargin format is 'param_1', value_1, 'param_2', value_2, .... The parameter descriptions are grouped by which component of BabelCalib they change.

Solver configurations:

Sampler configurations:

RANSAC configurations:

Refinement configurations:

<a name="examples"/>

Examples and wrappers

<a name="calib-csponds"/>

2D<->3D correspondences

BabelCalib provides a convenience wrapper (see calib_run_plane.m and calib_run_cube.m) for running the calibration calibrate.m with a training set and evaluating get_poses.m with a test set.

<a name="calib-deltille"/>

Deltille

The Deltille detector is a robust deltille and checkerboard detector. It comes with detector library, example detector code, and MATLAB bindings. BabelCalib provides functions for calibration and evaluation using the Deltille software's outputs. Calibration from Deltille detections requires format conversion which is peformed by import_ODT.m. A complete example of using calibrate and get_poses with import_ODT is provided in calib_run_plane_deltille.m and calib_run_cube_deltille.m.

<a name="citation"/>

Citation

If you find this work useful in your research, please consider citing:

@InProceedings{Lochman-ICCV21,
    title     = {BabelCalib: A Universal Approach to Calibrating Central Cameras},
    author    = {Lochman, Yaroslava and Liepieshov, Kostiantyn and Chen, Jianhui and Perdoch, Michal and Zach, Christopher and Pritts, James},
    booktitle = {Proceedings of the IEEE/CVF International Conference on Computer Vision (ICCV)},
    year      = {2021},
    pages     = {15253-15262}
}
<a name="license"/>

License

The software is licensed under the MIT license. Please see LICENSE for details.