Level 0: Foundation
★☆☆☆☆ Introductory⏱ 5 minGeneral audience. No mathematics required.From a 3-D world to a flat picture
A camera flattens the world: every point along one line of sight lands on the same pixel, so a photo keeps directions but loses distances. The pinhole model describes this with a few numbers. The focal length sets how much the image is magnified, the principal point is where the optical axis hits the sensor, and the camera’s position and orientation say where it looks from. Real lenses also bend straight lines a little near the edges (distortion), and calibration measures all these numbers from photos of a known pattern. The demo projects a flat grid; change the focal length and the distortion and watch the rows bend.
Every measurement from images, from a drone’s map to a rover’s stereo range to a satellite’s geolocation, depends on a calibrated camera model; a 1% focal-length error becomes a 1% error in distances measured from the images.
- 1. A single image loses…
- 2. The focal length in pixels sets…
- 3. Calibration measures…
Level 1: Beginner
★★☆☆☆ Basic⏱ 20 minSecondary-school mathematics: arithmetic and elementary algebra.By hand
- Pinhole projection: a point X in camera coordinates maps to x = f X / Z + cₓ, y = f Y / Z + c_y. In homogeneous coordinates x ∼ K [R | t] X, a 3 × 4 matrix P with 11 degrees of freedom; the camera centre is the null vector of P.
- Intrinsics K: focal lengths fₓ, f_y in pixels (focal length divided by pixel pitch), principal point (cₓ, c_y), skew (zero for modern sensors). Field of view 2 atan(W / 2f).
- Extrinsics: rotation R and translation t take world coordinates to camera coordinates; the camera centre is C = −Rᵀt. Conventions differ (OpenCV: x right, y down, z forward; OpenGL and NeRF code: z backwards), a common source of bugs.
- Projective geometry: points and lines are homogeneous 3-vectors; the line through two points is their cross product; parallel 3-D lines meet at a vanishing point Kd; the horizon is the vanishing line of the ground plane. Cross-ratios survive projection; lengths and angles do not.
- Homography: any plane, or any scene seen by a purely rotating camera, maps to the image by a 3 × 3 matrix H with 8 degrees of freedom: estimated from 4 or more matches with the direct linear transform (DLT), after Hartley normalisation.
- Distortion: radial x(1 + k₁r² + k₂r⁴ + k₃r⁶) (barrel for k₁ below 0) plus tangential p₁, p₂ (Brown, 1966; Conrady, 1919); fisheye and omnidirectional lenses use Kannala–Brandt (2006) or Scaramuzza models; undistortion has no closed form and is done iteratively or with a lookup map.
- Calibration: Zhang (2000) estimates K from 3 or more views of a planar checkerboard, then refines everything, including distortion, by minimising reprojection error (Levenberg–Marquardt). Tsai (1987) used 3-D targets. Tools: OpenCV calibrateCamera, Kalibr (camera-IMU), COLMAP self-calibration.
- Beyond the pinhole: rolling-shutter sensors expose rows at different times; pushbroom satellite sensors (SPOT, WorldView, Sentinel-2) build images line by line and are usually distributed with rational polynomial coefficient (RPC) models.
- 1. Degrees of freedom of a 3 × 4 projection matrix:
- 2. Negative k₁ is…
- 3. A homography maps…
Level 2: Intermediate
★★★☆☆ Intermediate⏱ 25 minUndergraduate students and practising engineers.Projecting, undistorting and calibrating
Exercise 1.
- Build K and project points with P = K [R | t].
- Apply radial distortion and invert it iteratively.
- Estimate a homography with the normalised DLT.
Practice.
- Calibrate with OpenCV: findChessboardCornersSB (or ChArUco boards when corners may be partly hidden), calibrateCamera, then check per-view reprojection errors.
- Tilt the board strongly (30–60°) and cover the whole image, especially the corners where distortion is largest.
- Report the reprojection RMS and the parameter uncertainties (stdDeviationsIntrinsics); a small RMS alone does not prove the parameters are right.
- Keep focus and zoom fixed after calibration; recalibrate after any mechanical change, and in flight hardware check for thermal drift.
- For camera–IMU or multi-camera rigs use Kalibr; for satellite imagery use the vendor’s RPC model and refine it with ground control points.
import cv2, glob, numpy as np
pattern, square = (9, 6), 0.030 # inner corners, metres
obj = np.zeros((54, 3), np.float32); obj[:, :2] = np.mgrid[0:9, 0:6].T.reshape(-1, 2) * square
objpts, imgpts = [], []
for f in sorted(glob.glob("calib/*.png")):
g = cv2.imread(f, cv2.IMREAD_GRAYSCALE)
ok, c = cv2.findChessboardCornersSB(g, pattern)
if ok: objpts.append(obj); imgpts.append(c)
rms, K, dist, rvecs, tvecs, sd_int, sd_ext, per_view = cv2.calibrateCameraExtended(objpts, imgpts, g.shape[::-1], None, None)
print(rms, K, dist.ravel(), sd_int.ravel()[:4]) # RMS (px), K, (k1 k2 p1 p2 k3), std of fx fy cx cy- 1. For calibration, the board should be…
- 2. Partly hidden boards are easier with…
- 3. Camera–IMU calibration tool:
Level 3: Advanced
★★★★☆ Advanced⏱ 25 minGraduate level, with full derivations and proofs.Theory
Planes give homographies. A point on the board plane Z = 0 projects as K [r₁ r₂ r₃ t] (X, Y, 0, 1)ᵀ = K [r₁ r₂ t] (X, Y, 1)ᵀ, so each view of the board is a homography H = λ K [r₁ r₂ t].
Zhang’s constraints. Because r₁ and r₂ are orthonormal, h₁ᵀ ω h₂ = 0 and h₁ᵀ ω h₁ = h₂ᵀ ω h₂ with ω = K⁻ᵀK⁻¹ (the image of the absolute conic). Each view gives 2 linear equations in the 6 entries of the symmetric ω (5 up to scale), so 3 views suffice in general; K follows from a Cholesky-like factorisation, and all parameters are then refined by minimising reprojection error.
Degeneracy. If the board faces the camera in every view, H ≈ λ diag(f, f, 1) up to an in-plane rotation and translation: scaling f and the distance together leaves the image unchanged, so the constraints no longer determine f. Perspective foreshortening from tilted views is what fixes the focal length. The reprojection error cannot reveal this, because a wrong (f, distance) pair fits the images just as well.
Normalisation. The DLT minimises an algebraic error whose conditioning depends on coordinate scales; Hartley (1997) showed that centring and scaling points to mean distance √2 makes the linear estimate much more stable, especially for the fundamental matrix.
- 1. Each view of a plane gives how many constraints on ω?
- 2. Fronto-parallel boards fail to determine…
- 3. Hartley normalisation scales points to mean distance…
Level 4: Expert
★★★★★ Expert⏱ 30 minResearchers: original papers and open problems.How many views and how much tilt does planar calibration need, and does a small reprojection error mean a correct calibration?
History.
- D. C. Brown, “Decentering distortion of lenses” (1966).
- R. Tsai, “A versatile camera calibration technique for high-accuracy 3D machine vision metrology” (1987).
- R. Hartley, “In defense of the eight-point algorithm” (1997); R. Hartley and A. Zisserman, Multiple View Geometry (2000, 2004).
- Z. Zhang, “A flexible new technique for camera calibration” (2000).
Exercise 2. A camera with f = 800 px and principal point (320, 240) views a 9 × 6 checkerboard (30 mm squares) 550–750 mm away. Corners get 0.5 px Gaussian noise. Zhang’s closed form is applied to normalised-DLT homographies (no nonlinear refinement); 20 trials per condition; medians reported.
- Conditions: 3, 5 or 10 views tilted about 21–30°; the same with unnormalised DLT; boards tilted only 3.5–5°; and an unmodelled radial distortion k₁ = −0.15.
- Measures: absolute focal error, principal-point error and RMS 2-D reprojection error (pixel noise alone gives about 0.71 px).
| condition | focal error (px) | principal point error (px) | reprojection RMS (px) |
|---|---|---|---|
| 3 views | 17.19 | 5.73 | 0.686 |
| 5 views | 7.64 | 3.15 | 0.699 |
| 10 views | 3.0 | 3.03 | 0.712 |
| 5 views, unnormalised DLT | 7.67 | 3.15 | 0.699 |
| 5 views, 5° tilt | 138.51 | 11.52 | 0.689 |
| 10 views, 5° tilt | 158.51 | 9.84 | 0.689 |
| 5 views, unmodelled k₁ | 11.72 | 9.52 | 0.807 |
- More views help: focal error fell from 17.2 to 3.0 px (seeds 1 and 2: 7.9 to 4.84, and 16.64 to 5.53).
- Tilt matters more than the number of views: with nearly fronto-parallel boards the focal error was 139 px (seeds 1 and 2: 162 and 189), and 10 views did not fix it (159 px). The reprojection RMS was a normal-looking 0.69 px in every case.
- Null result: Hartley normalisation changed the focal error by 0.03 px here; with 54 well-spread corners in double precision, noise, not conditioning, limited accuracy.
- Unmodelled distortion did show up in the residuals (0.807, 0.833 and 0.844 px on the three seeds) and biased the principal point by 7.5–9.7 px on the three seeds.
- Caveat: closed form only; real calibration adds nonlinear refinement with distortion, which reduces but does not remove the tilt degeneracy.
Camera models in AI, robotics and aerospace
- Robotics: every visual SLAM, stereo and hand–eye system starts from calibrated intrinsics; Kalibr calibrates camera–IMU rigs jointly, including time offsets.
- Earth observation: pushbroom imagers on Sentinel-2, Landsat and WorldView are modelled line by line; RPC models refined with ground control points give geolocation to a few metres or better.
- Space: star trackers and navigation cameras are calibrated on the ground and re-checked in orbit from star fields, whose directions are known to arcseconds.
References
- Z. Zhang (2000). “A flexible new technique for camera calibration.” IEEE TPAMI.
- R. Hartley and A. Zisserman (2004). Multiple View Geometry in Computer Vision, 2nd edition. Cambridge University Press.
- R. Hartley (1997). “In defense of the eight-point algorithm.” IEEE TPAMI.
- D. C. Brown (1966). “Decentering distortion of lenses.” Photogrammetric Engineering.
- J. Kannala and S. Brandt (2006). “A generic camera model and calibration method for conventional, wide-angle, and fish-eye lenses.” IEEE TPAMI.
- P. Furgale, J. Rehder and R. Siegwart (2013). “Unified temporal and spatial calibration for multi-sensor systems.” IROS (Kalibr).