Skip to content

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

@catree

Description

@catree
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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions