Homography Estimation (DLT)
A homography is a projective transformation between two planes. In calibration, the most common case is the mapping from a planar calibration board to the image plane. Homography estimation is the first step in Zhang's calibration method.
Problem Statement
Given: point correspondences where are points on the world plane and are the corresponding image points.
Find: such that (equality up to scale) for all .
Assumptions:
- The world points are coplanar (the calibration board is flat)
- Correspondences are correct (or RANSAC is used to handle outliers)
- At least 4 non-collinear point correspondences
Derivation
From Projective Relation to Linear System
The relation in homogeneous coordinates means:
Expanding and eliminating the scale factor using cross-product (the constraint ), we get two independent equations per correspondence:
The DLT System
Stacking all correspondences into a matrix :
where .
Solving via SVD
We seek minimizing subject to (to avoid the trivial solution ). This is the standard homogeneous least squares problem, solved by the SVD of :
The solution is the last column of (corresponding to the smallest singular value). Reshaping this 9-vector into a matrix gives .
Normalization and Denormalization
The complete algorithm with Hartley normalization:
- Normalize world and image points: and
- Build the matrix from normalized points
- Solve via SVD to get
- Denormalize:
- Scale:
Degrees of Freedom
is a matrix with 9 entries, but it is defined up to scale, giving 8 degrees of freedom. Each correspondence provides 2 equations, so the minimum is correspondences (giving equations for 8 unknowns).
With , the system is overdetermined and the SVD solution minimizes the algebraic error in a least-squares sense.
RANSAC Wrapper
For real data with potential mismatched correspondences, dlt_homography_ransac wraps the DLT solver in RANSAC:
#![allow(unused)] fn main() { let (H, inliers) = dlt_homography_ransac(&world_pts, &image_pts, &opts)?; }
MIN_SAMPLES = 4- Residual: Euclidean reprojection error in pixels:
- Degeneracy check: Tests if the first 3 world points are collinear (a degenerate configuration for homography estimation)
OpenCV equivalence:
cv::findHomographywithRANSACmethod.
API
#![allow(unused)] fn main() { // Direct DLT (all points assumed inliers) let H = dlt_homography(&world_2d, &image_2d)?; // With RANSAC let opts = RansacOptions { max_iters: 1000, thresh: 3.0, // pixels confidence: 0.99, ..Default::default() }; let (H, inliers) = dlt_homography_ransac(&world_2d, &image_2d, &opts)?; }
Geometric Interpretation
For a planar calibration board at in world coordinates, the camera projection matrix reduces to a homography:
where are the first two columns of . This relationship is the foundation of Zhang's calibration method (next chapter).