The OpenCV function findhomography()
finds a homographic transformation between matching points of two images. (See Definition)
For finding matching subsets of points RANSAC can be used.
Here's the catch: In contrast to other function in OpenCV which use RANSAC (e.g. findfundamentalMat
(See Definition)) the RANSAC parameter for confidence cannot be changed. Only the reprojection threshold can be passed as an argument.
I looked in the OpenCV source, and for findhomography()
the confidence is hardcoded to 0.995.
For my purposes I need to increase this. Is there a way to do this without changing the value in the OpenCV source itself?
Is there a reason why this should be hardcoded?
PS: I added a change request under Ticket 1557 for the next subversion.
Well, you are not the first that needs to change harcoded variables or functions in OpenCV. Actually we are changing a lot of OpenCV functions in order to make them faster and more efficient for mobile phones. If you want to change RANSAC, just create a copy of the class with a different name
class CvModelEstimator2
{
}
in your code, and modify it yourself as you need. You can also change the maxnumber of iterations for RANSAC, the default is very high and makes application really slow.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With