opencvimage-processingcomputer-visionfeature-detectionransac

Can RANSAC be improved to remove outliers?


I am using SIFT feature detector and descriptor. I am matching the points between two images. I am using findHomography() function of OpenCV with the RANSAC method.

When I read about the RANSAC algorithm, it is said that adjusting a threshold parameter for RANSAC can improve the results. But I don't want to hardcode any parameter.

I know RANSAC is removing outliers in matches. Can anyone let me know if removing outliers (not all of them) with basic methods before applying homography improves the result of homography?

If so, how can we apply an operation before RANSAC to remove outliers?


Solution

  • What is your definition of a good result? RANSAC is about a tradeoff between the number of points and their precision, so there is no uniform definition of good: you have more inliers if their accuracy is worse and vice versa.

    The parameter you are talking about is probably an outlier threshold and it may be just badly tuned so you have too many approximate inliers or too few super accurate inliers. Now, if you pre-filter your outliers you will just speed up your RANSAC but unlikely to improve the solution. Eventually the speed of RANSAC with Homography boils down to the probability of selecting 4 inliers and when their proportion is higher the convergence is more speedy.

    The other methods to sort out outliers before applying RANSAC is to look at simpler constraints such as ordering of points, straight lines still being straight lines, cross-ratio and other invariants of Homography transformation. Finally you may want to use higher level features such as lines to calculate homography. Note, that in homogeneous coordinates when points are transformed as p2=H*p1, the lines are transformed as l2 = H-t * l1. This can actually increase the accuracy (since lines are macro features and are less noisy than point of interests) while straight lines can be detected via a Hough transform.