Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Different inliers convention with solvePnPRansac and USAC option #20008

Closed
@catree

Description

@catree
System information (version)
  • OpenCV =>>= 4.5.0
  • Operating System / Platform => N/A
  • Compiler => N/A
Detailed description

Inliers convention withsolvePnPRansac and USAC option (from this GSoC work#17683) is different from defaultsolvePnPRansac methods:

  • with USAC, it is a vector of0/1 for the input points
  • with classical methods, it is a vector of inlier indexes

I think using the same convention than before would be ok.

/cc@ivashmak

Steps to reproduce
constsize_t nbPoints =10;    std::vector<cv::Point3d> objectPoints;    std::vector<cv::Point2d> imagePoints;    cv::RNGrng(0x123456789);for (size_t i =0; i < nbPoints; i++) {        objectPoints.push_back(cv::Point3d(rng.uniform(0.0,0.1), rng.uniform(0.0,0.1), rng.uniform(0.0,0.1)));    }    cv::Matx31drvec(0.1,0.2,0.3), tvec(0.1,0.2,1);    cv::Matx33dcameraMatrix(600,0,320,0,600,240,0,0,1);cv::projectPoints(objectPoints, rvec, tvec, cameraMatrix, cv::noArray(), imagePoints);    imagePoints[0].x +=10;    imagePoints[1].y +=10;    imagePoints[2].x +=10;    cv::Matx31d rvec_est, tvec_est;    std::vector<int> inlierIndex;cv::solvePnPRansac(objectPoints, imagePoints, cameraMatrix, cv::noArray(), rvec_est, tvec_est, false, 1000, 2.0, 0.99, inlierIndex, cv::SOLVEPNP_ITERATIVE);    std::vector<int> inlierIndex_usac;    cv::Matx31d rvec_est_usac, tvec_est_usac;cv::solvePnPRansac(objectPoints, imagePoints, cameraMatrix, cv::noArray(), rvec_est_usac, tvec_est_usac, false, 1000, 2.0, 0.99, inlierIndex_usac, cv::USAC_ACCURATE);    std::vector<int> inlierIndex_usac2;    cv::Matx31d rvec_est_usac2, tvec_est_usac2;cv::solvePnPRansac(objectPoints, imagePoints, cameraMatrix, cv::noArray(), rvec_est_usac2, tvec_est_usac2, inlierIndex_usac2);    std::cout <<"\nNORMAL:" << std::endl;    std::cout <<"rvec:" << rvec.t() << std::endl;    std::cout <<"rvec_est:" << rvec_est.t() << std::endl;    std::cout <<"tvec:" << tvec.t() << std::endl;    std::cout <<"tvec_est:" << tvec_est.t() << std::endl;    std::cout <<"Inlier index:" << std::endl;for (auto idx : inlierIndex) {       std::cout << idx << std::endl;    }    std::cout <<"\nUSAC:" << std::endl;    std::cout <<"rvec:" << rvec.t() << std::endl;    std::cout <<"rvec_est_usac:" << rvec_est_usac.t() << std::endl;    std::cout <<"tvec:" << tvec.t() << std::endl;    std::cout <<"tvec_est_usac:" << tvec_est_usac.t() << std::endl;    std::cout <<"Inlier index:" << std::endl;for (auto idx : inlierIndex_usac) {        std::cout << idx << std::endl;    }    std::cout <<"\nUSAC 2:" << std::endl;    std::cout <<"rvec:" << rvec.t() << std::endl;    std::cout <<"rvec_est_usac2:" << rvec_est_usac2.t() << std::endl;    std::cout <<"tvec:" << tvec.t() << std::endl;    std::cout <<"tvec_est_usac2:" << tvec_est_usac2.t() << std::endl;    std::cout <<"Inlier index:" << std::endl;for (auto idx : inlierIndex_usac2) {        std::cout << idx << std::endl;    }

Output:

NORMAL:rvec: [0.1, 0.2, 0.3]rvec_est: [0.1000001115198924, 0.2000000619071916, 0.2999998504321869]tvec: [0.1, 0.2, 1]tvec_est: [0.0999999851190521, 0.2000000191436395, 1.000000038294651]Inlier index:3456789USAC:rvec: [0.1, 0.2, 0.3]rvec_est_usac: [0.0999956768017629, 0.1999999513689168, 0.3000022343620654]tvec: [0.1, 0.2, 1]tvec_est_usac: [0.1000017130274078, 0.200002461007063, 1.000010978690636]Inlier index:0001111111USAC 2:rvec: [0.1, 0.2, 0.3]rvec_est_usac2: [0.0999956768017629, 0.1999999513689168, 0.3000022343620654]tvec: [0.1, 0.2, 1]tvec_est_usac2: [0.1000017130274078, 0.200002461007063, 1.000010978690636]Inlier index:0001111111
Issue submission checklist
  • I report the issue, it's not a question
  • I checked the problem with documentation, FAQ, open issues,
    forum.opencv.org, Stack Overflow, etc and have not found solution
  • I updated to latest OpenCV version and the issue is still there
  • There is reproducer code and related data files: videos, images, onnx, etc

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions


    [8]ページ先頭

    ©2009-2025 Movatter.jp