- CMake 3.10+
- Eigen3
- OpenCV2
git clone https://github.com/Tsuihao/ransac_homography.git
cd ransac_homography
mkdir build && cd build
cmake -DCMAKE_BUILD_TYPE=Debug ..
./ransac_homography
We first use the four fixed point to calculate the baseline of Homogrpahy (Great reference turtorial here Ref)
The baseline homography should look like (perspective transformation)
Now in order to generate the a lot of corresponding points for RANSAC, we use the SIFT detector.
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!)
We are going to compare our own implementation of RANSAC.
Oppsy It's clear that the implementation has some bugs. check the below section
- We are assume h33 = 1 (the (3, 3) element of homography matrix)
- 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