mirror of
https://github.com/opencv/opencv.git
synced 2026-07-31 00:03:03 +04:00
Merge pull request #23078 from ivashmak:update_vsac
Update USAC #23078 ### Pull Request Readiness Checklist - [x] I agree to contribute to the project under Apache 2 License. - [x] To the best of my knowledge, the proposed patch is not based on a code under GPL or another license that is incompatible with OpenCV - [x] The PR is proposed to the proper branch - [x] There is a reference to the original bug report and related work - [x] There is accuracy test, performance test and test data in opencv_extra repository, if applicable Patch to opencv_extra has the same branch name. - [x] The feature is well documented and sample code can be built with the project CMake
This commit is contained in:
committed by
GitHub
parent
3c0b71bcec
commit
44881592c3
@@ -181,12 +181,9 @@ static double getError (TestSolver test_case, int pt_idx, const cv::Mat &pts1, c
|
||||
if (test_case == TestSolver::Fundam || test_case == TestSolver::Essen) {
|
||||
cv::Mat l2 = model * pt1;
|
||||
cv::Mat l1 = model.t() * pt2;
|
||||
if (test_case == TestSolver::Fundam) // sampson error
|
||||
return fabs(pt2.dot(l2)) / sqrt(pow(l1.at<double>(0), 2) + pow(l1.at<double>(1), 2) +
|
||||
pow(l2.at<double>(0), 2) + pow(l2.at<double>(1), 2));
|
||||
else // symmetric geometric distance
|
||||
return sqrt(pow(pt1.dot(l1),2) / (pow(l1.at<double>(0),2) + pow(l1.at<double>(1),2)) +
|
||||
pow(pt2.dot(l2),2) / (pow(l2.at<double>(0),2) + pow(l2.at<double>(1),2)));
|
||||
// Sampson error
|
||||
return fabs(pt2.dot(l2)) / sqrt(pow(l1.at<double>(0), 2) + pow(l1.at<double>(1), 2) +
|
||||
pow(l2.at<double>(0), 2) + pow(l2.at<double>(1), 2));
|
||||
} else
|
||||
if (test_case == TestSolver::PnP) { // PnP, reprojection error
|
||||
cv::Mat img_pt = model * pt2; img_pt /= img_pt.at<double>(2);
|
||||
@@ -340,7 +337,7 @@ TEST_P(usac_Essential, maxiters) {
|
||||
cv::Mat K1 = cv::Mat(cv::Matx33d(1, 0, 0,
|
||||
0, 1, 0,
|
||||
0, 0, 1.));
|
||||
const double conf = 0.99, thr = 0.5;
|
||||
const double conf = 0.99, thr = 0.25;
|
||||
int roll_results_sum = 0;
|
||||
|
||||
for (int iters = 0; iters < 10; iters++) {
|
||||
@@ -361,8 +358,8 @@ TEST_P(usac_Essential, maxiters) {
|
||||
FAIL() << "Essential matrix estimation failed!\n";
|
||||
else continue;
|
||||
}
|
||||
EXPECT_NE(roll_results_sum, 0);
|
||||
}
|
||||
EXPECT_NE(roll_results_sum, 0);
|
||||
}
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(Calib3d, usac_Essential, UsacMethod::all());
|
||||
|
||||
Reference in New Issue
Block a user