Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

solvePnPRansac() returns the "wrong" rvec and tvec #9085

Closed
catree opened this issue Jul 3, 2017 · 0 comments · Fixed by #9086
Closed

solvePnPRansac() returns the "wrong" rvec and tvec #9085

catree opened this issue Jul 3, 2017 · 0 comments · Fixed by #9086

Comments

@catree
Copy link
Contributor

catree commented Jul 3, 2017

System information (version)
  • OpenCV => 3.3.0-rc
Detailed description

From what I have understood of the code, solvePnPRansac returns the best rvec and tvec estimated during the Minimal Sample Sets step (estimated rvec and tvec that produce the best (bigger) consensus set) and not rvec and tvec estimated using all the inliers.
The corresponding faulty code is here:

if( result <= 0 || _local_model.rows <= 0)
{
    _rvec.assign(rvec);    // output rotation vector
    _tvec.assign(tvec);    // output translation vector

    if( _inliers.needed() )
        _inliers.release();

    return false;
}
else
{
    _rvec.assign(_local_model.col(0));    // output rotation vector
    _tvec.assign(_local_model.col(1));    // output translation vector
}

When result > 0 is ok, _rvec and _tvec are assigned with the _local_model insted of rvec and tvec estimated using all the inliers.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants