Post

RANSAC, Homography Estimation, and Keypoint Matching

Applying RANSAC to fit a line and improve keypoint matching, implementing Direct Linear Transform (DLT) for homography computation, and evaluating accuracy both with synthetic and real image data.

RANSAC, Homography Estimation, and Keypoint Matching

Overview

A. Finding a Line Using RANSAC

  • Used RANSAC to fit a line to data with 25% inliers.
  • Required iterations: K = log(1 - 0.9999) / log(1 - 0.25^2) ≈ 143
  • Each iteration:
    • Two points sampled to define a line
    • Top 25% of points (closest to line) considered inliers
    • Homogeneous least squares fit performed on inliers
  • Best fit:
    • Slope: -0.4895
    • Intercept: 2.0023
    • Error: 0.2576
  • Results showed effective detection of inlier line structure.

B. DLT Method for Homography Between Planar Images

  • Tested accuracy using randomly generated point pairs in [0,1] × [0,1].
  • RMSE results (average over 10 trials):
    • 4 points: 0.0000
    • 5 points: 0.1811
    • 6 points: 1.1338
  • Demonstrated increasing instability with more random pairs.
  • Verified DLT implementation before testing.

Real Image Results

  • Used 8 clicked point pairs per slide/frame pair:
    • 4 used for homography (red stars)
    • 4 for evaluation (cyan stars)
    • Mapped points shown as green dots
  • Initial poor mapping resolved by using every other point for better spatial distribution.
  • Final mappings aligned closely with both red and cyan points.

C. Improving SIFT Keypoint Matching with RANSAC Homography

  • RANSAC applied to prune poor SIFT matches.
  • Process:
    1. Use knnsearch() to get nearest SIFT matches
    2. Randomly sample 4 matches for homography
    3. Identify top 8% of inliers
    4. Refit and evaluate using RMSE
    5. Retain homography if RMSE improves
  • Iterations computed with:
    • 99.9999% confidence
    • 8% inlier probability
    • 4 points per fit → Resulted in 337,286 iterations per pair
  • Visual results:
    • More and cleaner matches than previous assignment (HW09)
    • Substantially reduced false matches
    • Final inliers shown as green dots connected by red lines

Conclusion

This assignment demonstrates the effectiveness of RANSAC for robust model fitting in both synthetic and real image contexts. DLT homography was validated with controlled inputs and successfully applied to slide/frame image pairs. Combined with SIFT matching, homography-based RANSAC significantly outperforms earlier matching methods by preserving accuracy while increasing match count.

This post is licensed under CC BY 4.0 by the author.