"_rvec" and "_tvec" for solvePnPRansac() are wrong. [closed]

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

minoken gravatar image

updated 2020-11-17 13:42:03 -0600

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 reopen merge delete

Closed for the following reason the question is answered, right answer was accepted by sturkmen
close date 2020-11-17 13:42:16.446786

Comments

Indeed, the corresponding issue and the pull request.

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