Commit 8a79d414 authored by Alexander Shishkov's avatar Alexander Shishkov

fixed bug in solvePnPRansac test (thanks to Pieter-Jan Busschaert)

test was refactored
parent 34a18f79
...@@ -73,7 +73,7 @@ namespace cv ...@@ -73,7 +73,7 @@ namespace cv
Mat R(3, 3, CV_64FC1); Mat R(3, 3, CV_64FC1);
Rodrigues(rvec, R); Rodrigues(rvec, R);
Mat transformation(3, 4, CV_64F); Mat transformation(3, 4, CV_64F);
Mat r = transformation.colRange(0, 2); Mat r = transformation.colRange(0, 3);
R.copyTo(r); R.copyTo(r);
Mat t = transformation.colRange(3, 4); Mat t = transformation.colRange(3, 4);
tvec.copyTo(t); tvec.copyTo(t);
......
...@@ -97,7 +97,11 @@ protected: ...@@ -97,7 +97,11 @@ protected:
} }
} }
double eps = 1.0e-7; 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 try
{ {
...@@ -118,12 +122,9 @@ protected: ...@@ -118,12 +122,9 @@ protected:
isTestSuccess = isTestSuccess isTestSuccess = isTestSuccess
&& (abs(tvec.at<double> (1, 0) - 1) < eps); && (abs(tvec.at<double> (1, 0) - 1) < eps);
isTestSuccess = isTestSuccess && (abs(tvec.at<double> (2, 0)) < eps); isTestSuccess = isTestSuccess && (abs(tvec.at<double> (2, 0)) < eps);
if (!isTestSuccess)
{ if (isTestSuccess)
ts.printf( cvtest::TS::LOG, "Invalid accuracy, inliers.size = %d\n", inliers.size()); successfulTestsCount++;
ts.set_failed_test_info(cvtest::TS::FAIL_BAD_ACCURACY);
break;
}
} }
catch(...) catch(...)
...@@ -132,6 +133,13 @@ protected: ...@@ -132,6 +133,13 @@ protected:
ts.set_failed_test_info(cvtest::TS::FAIL_BAD_ACCURACY); 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);
}
} }
}; };
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment