RANSAC Robust Estimation
RANSAC fits models to noisy matches by voting: sample few points, count supporters, and keep the model with the largest consensus.
Why Does This Exist?
Least squares trusts every match, so one bad pair bends the answer. Real match sets hold to percent outliers from repetition and motion. RANSAC instead searches for the largest self consistent subset.
It fits lines, homographies, and poses from tiny random samples, then lets all points vote. The winning model is refit on its inliers. It turns ratio filtered matches into trustworthy geometry.
Think of It Like This
Finding the real meeting spot
Ten friends text meeting spots, but four phones autocorrected wrongly. You test small groups: pick two texts, go there, and count who else named that corner. The corner with six supporters beats scattered wrong pins.
Minimal samples are those small groups. Inlier counts are the supporters. The analogy stops at noise: friends stand still, while pixels carry measurement error that needs a distance threshold.
How It Actually Works
Pick a minimal sample : points for a line, for a homography, to for pose. Fit the model, count points within reprojection threshold as inliers, and repeat times. Keep the largest set, then refit on all its inliers.
Worked numbers
With inlier ratio , sample size , and target success , iterations are:
So rounds give percent odds of one clean sample. With pairs and threshold pixels, a good homography might claim inliers while bad samples claim to . Adaptive RANSAC updates from the best set so far and stops early when drops.
Watch Out For
Threshold copied across resolutions
Three pixels means little on a K frame and a lot on a thumbnail. Scale with image size and expected detection noise, or inlier sets swing wildly between runs.
Degenerate samples accepted blindly
Four near collinear points define no stable homography yet can still count accidental inliers. Enforce a minimum geometric sanity check on each sample, such as spread and non-collinearity, before counting votes.
The Quick Version
- Fits from minimal random samples, not all points.
- Inlier threshold defines consensus membership.
- Iteration math follows outlier ratio and sample size.
- Refit the winner on all its inliers.
- Standard gate before any homography or pose is trusted.