The camera model
A pinhole camera maps a 3D world point to a 2D image point via:Intrinsic matrix
| Parameter | Meaning |
|---|---|
| Focal lengths in pixel units (horizontal and vertical) | |
| Principal point (optical axis in image coordinates) | |
| Skew coefficient (nearly zero for modern cameras) |
Extrinsic parameters: and
is the rotation matrix and the translation that express the world frame in the camera frame. Together they form the matrix . The full projection matrix therefore has 11 degrees of freedom (up to scale).Linear calibration via DLT
The Direct Linear Transform (DLT) estimates from a set of known 3D–2D correspondences . Each correspondence yields two linear equations in the 12 entries of . Stacking correspondences gives the system: The solution is the right singular vector of corresponding to the smallest singular value — computed via SVD.Numerical stability requires normalising the input coordinates before applying DLT (translate centroid to origin, scale so mean distance to origin is ).
Least-squares and SVD
For overdetermined systems the least-squares solution minimises . The SVD decomposition gives the solution directly: . For the homogeneous case () the solution is the last column of . Recovering , , from uses RQ decomposition (a variant of QR decomposition).Nonlinear optimisation and lens distortion
Real lenses introduce radial distortion: straight lines appear curved. The distorted image coordinates relate to the undistorted by: where are radial distortion coefficients. After the linear DLT initialisation, a nonlinear least-squares optimiser (e.g., Levenberg–Marquardt) jointly refines all parameters including distortion.RANSAC for robust calibration
When correspondences include outliers, ordinary least-squares gives poor estimates. RANSAC (RANdom SAmple Consensus) iteratively:Sample a minimal set
Randomly pick the minimum number of points needed to fit the model (e.g., 6 for DLT).
MATLAB code examples
Python resources
Camera calibration example (Colab)
Step-by-step calibration using a checkerboard pattern in Python with OpenCV.
E03 — Calibrate your project camera
In-class exercise: calibrate the camera you plan to use in your course project.
Video lecture
Lecture: Parameter estimation and camera calibration (2021)
Recorded class covering DLT, SVD-based estimation, and RANSAC applied to camera calibration.
Calibration workflow summary
How many images are needed for calibration?
How many images are needed for calibration?
In practice 10–20 images of a calibration pattern (checkerboard) taken from different angles and distances give reliable results. The MATLAB
cameraCalibrator app and OpenCV’s calibration routine both accept multiple views.What is the reprojection error?
What is the reprojection error?
After calibration the reprojection error is the average Euclidean distance between the observed image points and the points predicted by projecting the 3D world points through the estimated . A reprojection error below 1 pixel is considered good.
When is lens distortion important?
When is lens distortion important?
Wide-angle and fisheye lenses introduce significant radial distortion. For standard lenses in robotics or structure-from-motion, even small distortions compound over large scenes. Always estimate and correct distortion if metric accuracy matters.
How does RANSAC improve calibration?
How does RANSAC improve calibration?
Mislabelled or partially occluded corners act as outliers. RANSAC finds the largest set of consistent correspondences before refitting, giving an estimate close to the true parameters even when 30–50 % of matches are corrupted.
