Loading...
Implement RANSAC for homography estimation between two images, a crucial task in computer vision that involves finding the transformation matrix mapping points between planes. A homography H (3×3 matrix) maps points between planes: p′=Hp.
The Direct Linear Transform (DLT) algorithm estimates H from 4+ correspondences by setting up a linear system Ah=0 and solving using Singular Value Decomposition (SVD).
This technique is widely used in image stitching and object recognition.
src = [[0,0], [1,0], [1,1], [0,1], [10,10]] dst = [[0,0], [2,0], [2,2], [0,2], [5,5]] # 2x scale + outlier threshold = 1.0
H ≈ [[2,0,0],[0,2,0],[0,0,1]], 4 inliers
First 4 point pairs indicate 2× scaling. Last pair [10,10]→[5,5] is inconsistent (would be 0.5× scale).
RANSAC finds the homography explaining 4/5 correspondences.