mirror of
https://github.com/opencv/opencv.git
synced 2024-11-28 21:20:18 +08:00
fixed bug in solvePnPRansac test (thanks to Pieter-Jan Busschaert)
test was refactored
This commit is contained in:
parent
34a18f79e1
commit
8a79d414c0
@ -73,7 +73,7 @@ namespace cv
|
||||
Mat R(3, 3, CV_64FC1);
|
||||
Rodrigues(rvec, R);
|
||||
Mat transformation(3, 4, CV_64F);
|
||||
Mat r = transformation.colRange(0, 2);
|
||||
Mat r = transformation.colRange(0, 3);
|
||||
R.copyTo(r);
|
||||
Mat t = transformation.colRange(3, 4);
|
||||
tvec.copyTo(t);
|
||||
|
@ -97,7 +97,11 @@ protected:
|
||||
}
|
||||
}
|
||||
double eps = 1.0e-7;
|
||||
for (int testIndex = 0; testIndex< 10; testIndex++)
|
||||
|
||||
int successfulTestsCount = 0;
|
||||
int totalTestsCount = 10;
|
||||
|
||||
for (int testIndex = 0; testIndex < totalTestsCount; testIndex++)
|
||||
{
|
||||
try
|
||||
{
|
||||
@ -118,12 +122,9 @@ protected:
|
||||
isTestSuccess = isTestSuccess
|
||||
&& (abs(tvec.at<double> (1, 0) - 1) < eps);
|
||||
isTestSuccess = isTestSuccess && (abs(tvec.at<double> (2, 0)) < eps);
|
||||
if (!isTestSuccess)
|
||||
{
|
||||
ts.printf( cvtest::TS::LOG, "Invalid accuracy, inliers.size = %d\n", inliers.size());
|
||||
ts.set_failed_test_info(cvtest::TS::FAIL_BAD_ACCURACY);
|
||||
break;
|
||||
}
|
||||
|
||||
if (isTestSuccess)
|
||||
successfulTestsCount++;
|
||||
|
||||
}
|
||||
catch(...)
|
||||
@ -132,6 +133,13 @@ protected:
|
||||
ts.set_failed_test_info(cvtest::TS::FAIL_BAD_ACCURACY);
|
||||
}
|
||||
}
|
||||
|
||||
if (successfulTestsCount < 0.8*totalTestsCount)
|
||||
{
|
||||
ts.printf( cvtest::TS::LOG, "Invalid accuracy, failed %d tests from %d\n",
|
||||
totalTestsCount - successfulTestsCount, totalTestsCount);
|
||||
ts.set_failed_test_info(cvtest::TS::FAIL_BAD_ACCURACY);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user