Tutorial Camera Calibration
Camera Calibration
Camera calibration is the process of estimating the cameras parameters. It can either refer to the intrinsic parameters or the extrinsic parameters. Intrinsic parameters deal with camera specific features such as its focal length, skew, distortion, and image center. Extrinsic parameters describe its position and orientation in the world. For the remainder of this page we will focus on estimating intrinsic parameters.
BoofCV provides several software tools and support for different calibration target types. In a typical scenario calibration will be done by viewing a calibration target from different locations and orientations. Calibration points are then detected in these images. Since the geometry of the calibration target is known the cameras intrinsic parameters can be estimated to a high level of accuracy.
The most common way to calibrate a camera is using planar calibration targets with squares on them. BoofCV provides support for two different types of planar calibration targets with different patterns of squares on them, chess board and square grid. The code itself can be reused to detect similar types of application specific calibration targets.
Summary of current status:
- Chessboard feature detector is accurate
- Square grid feature detector is decent but can be improved
- Numerical optimization needs to be improved but works OK
- API is lacking and there is no way to transfer found results to other parts of the code
Applet List
While instructions are not yet provided, you can still view the code and figure out how to calibrate a camera using BoofCV. Just look at the classes inside of the boofcv.alg.geo.calibration package
Why Work in Progress?
Calibration is very much a work in progress because the API is still immature and the accuracy is a bit less than expected. These preliminary results typically have a mean residual error between 0.2 and 0.5 pixels across the calibration image. Which is within the typical range, but what makes the results some what suspect is how much variance there is between different datasets taken from the same camera.
Calibration with Square Grid
To help validate its performance data provided on Zhengyou Zhang's website has been processed. This test highlighted two issues. 1) The interest points provided by Zhang produced better results than the ones produced by BoofCV. 2) Even when using Zhang's interest points the found calibration parameters were similar, but not exactly the same. Jean-Yves Bouguet's Matlab calibration suite is able to produce nearly identical results to what Zhang had found. In summary, what is currently in place now is a good start but has room for improvement in feature detection and parameter optimization.
Calibration with Chessboard
Detecting features in the chessboard target is an easier task. The found accuracy is about 3x better (mean error of 0.1 pixels versus 0.3 pixels) than equivalent square grid datasets.
Numerical Optimization
Accuracy and speed of non-linear optimization can be improved. An older variant of Levenberg-Marquardt (LM) is currently being used. Plans are to use a trust region optimizer instead or a version of LM similar to what's in Minpack. The Jacobian is currently computed numerically which will limit its accuracy and make it a bit slower.
Calibration Targets
- Calib target chess small.png
Chessboard pattern
- Calib target square small.png
Square grid pattern
Fully automatic algorithms are provided for detecting the two types of calibration grids above. Calibration points are located at different locations on each target type. For the chess board pattern only the interior corners are used while for the square grid pattern all corner points are used.