简体   繁体   中英

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!

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM