user3318590
user3318590

Reputation: 91

OpenCV recoverPose from essential matrix E

with Opencv 3.0, I obtained the essential matrix with the function:

E = findEssentialMat(points2, points1, focal, pp, RANSAC, 0.999, 1.0, mask);

Looking at the mask values number of inliers are really high.

After I used the recoverPose function:

recoverPose(E, points2, points1, R, t, focal, pp, mask);

But I noticed that the number of passed inliers (looking at the mask) are very few (often zeroes).

My questions is: There is a way to obtain more inliers from recoverPose function? If not, There is alternate way to obtain R and t (without using recoverPose function)?

Thanks a lot!

Upvotes: 2

Views: 4711

Answers (1)

Mannorok
Mannorok

Reputation: 71

Without more details it is really hard to judge what is going on. The main task RecoverPose has to solve is to choose between 4 different solutions for translation and rotation given an essential matrix estimate.

The steps are roughly the following:

  • Estimating the 4 possible solutions
  • 3D triangulation of all inlier points
  • Cheirality check: Basically checking if the triangulated point is in front of both cameras (positive z coordinate for opencv coordinate system)
  • Choose a solutions and flag all inliers that fail Cheirality check as outliers.

So it seems like that something is going wrong during the Cheirality check. You can actually implement RecoverPose yourself quite easily. You can check how I did it in my current project (look for DecomposeEssentialMat) : https://github.com/makra89/Visual-Odometry-Cpp/blob/master/src/Utils/src/ImageProcessingUtils.cpp

Upvotes: 1

Related Questions