Question

I have calculated fundamental matrix using the function shown below

[fMatrix, epipolarInliers, status] = estimateFundamentalMatrix(...
   matchedPoints1, matchedPoints2, 'Method', 'RANSAC', ...
   'NumTrials', 10000, 'DistanceThreshold', 0.1, 'Confidence', 99.99);

but here in this case fundamental matrix keeps varying each time i run the program.

but when i use the code shown below in open cv i get the same fundamental matrix everytime i run the program.code is shown below

 cv::Mat fundamental=cv::findFundamentalMat(cv::Mat(selPointsLeft),cv::Mat(selPointsRight),CV_FM_RANSAC);

in both the cases i used surf features to extract the match features.Matchpoints1=selpointsleft and matchpoints2=selpointsright. What might the reason for this?

Was it helpful?

Solution

RANSAC is an abbreviation for "RANdom SAmple Consensus". That said, we must expect the output matrix to change as the samples are randomly picked.

In OpenCV, the values are picked from a uniformly distributed list of random values. Thus we get the same values every time we run the code.

In Matlab, it that seems to pick a completely random value and hence the problem. You will have to check whether there is a way to random-seed the picking of random values, which I am quiet unsure of.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top