RANSAC for homography estimation

Dependency

  • CMake 3.10+
  • Eigen3
  • OpenCV2

Run

git clone https://github.com/Tsuihao/ransac_homography.git

cd ransac_homography

mkdir build && cd build

cmake -DCMAKE_BUILD_TYPE=Debug ..

./ransac_homography

WriteUp.

We first use the four fixed point to calculate the baseline of Homogrpahy (Great reference turtorial here Ref) Alt text

The baseline homography should look like (perspective transformation) Alt text

Now in order to generate the a lot of corresponding points for RANSAC, we use the SIFT detector. Alt text

By default, opencv provide a fucntion called findhomography which uses RANSAC under the hood. The result homography from opencv - findhomography.

As can be seen, it looks identical as the baseline images (that is what we are looking for!)

Alt text

We are going to compare our own implementation of RANSAC.

Oppsy It's clear that the implementation has some bugs. check the below section

Alt text

Potential improvements

  • We are assume h33 = 1 (the (3, 3) element of homography matrix)
    • Ref
    • Ref
    • Ref
    • It might be more robust to use SVD and without assumption of h33 = 1
  • The current iteration number is hard coded. It can use the adaptive approach to optimize it.
  • While RANSAC generating random samples, we might need to do a pre-check to make sure there is no 3 points sit on a line (OpenCV does this check)
  • The cost function uses sqrt(forward projection error + backward projection error).
  • Lacking a quantitive method to estimate a threshold for inliers