"_rvec" and "_tvec" for solvePnPRansac() are wrong.

asked 2016-04-27 06:53:24 -0500

updated 2016-04-27 09:01:54 -0500

Environment:
OpenCV 3.1.0
OS X 10.11.4

I am using "solvePnPRansac()" to get "_rvec" and "_tvec".
However, I thought values are wrong.
Because when I tried same step with "OpenCV 2.4.12", there is the difference between both.

call "solvePnP" with arg "rvec", but set "_local_model.col" as "_rvec". ("tvec" also)

Code:

opencv-3.1.0/modules/calib3d/src/solvepnp.cpp (https://github.com/Itseez/opencv/blob...)

result = solvePnP(opoints_inliers, ipoints_inliers, cameraMatrix, distCoeffs, rvec, tvec, false, flags == SOLVEPNP_P3P ? SOLVEPNP_EPNP : flags) ? 1 : -1;
_rvec.assign(_local_model.col(0));    // output rotation vector
_tvec.assign(_local_model.col(1));    // output translation vector

I think this is right.

Code:

result = solvePnP(opoints_inliers, ipoints_inliers, cameraMatrix, distCoeffs, _local_model.col(0), _local_model.col(1), false, flags == SOLVEPNP_P3P ? SOLVEPNP_EPNP : flags) ? 1 : -1;

What do you think?

edit retag flag offensive close merge delete

Comments

Indeed, the corresponding issue and the pull request.

Eduardo gravatar imageEduardo ( 2018-01-07 11:23:34 -0500 )edit