Unverified Commit d1fc1c64 authored by Alexander Alekhin's avatar Alexander Alekhin Committed by GitHub

Merge pull request #2342 from alalek:issue_9863

parents 62c969dd f452bd49
...@@ -100,19 +100,7 @@ class CV_BD_DescriptorsTest : public cvtest::BaseTest ...@@ -100,19 +100,7 @@ class CV_BD_DescriptorsTest : public cvtest::BaseTest
curMaxDist = dist; curMaxDist = dist;
} }
std::stringstream ss; EXPECT_LT(curMaxDist, maxDist) << "Max distance between valid and computed descriptors";
ss << "Max distance between valid and computed descriptors " << curMaxDist;
if( curMaxDist < maxDist )
ss << "." << std::endl;
else
{
ss << ">" << maxDist << " - bad accuracy!" << "\n";
ts->set_failed_test_info( cvtest::TS::FAIL_BAD_ACCURACY );
}
ts->printf( cvtest::TS::LOG, ss.str().c_str() );
} }
Mat readDescriptors() Mat readDescriptors()
...@@ -286,25 +274,11 @@ class CV_BD_DescriptorsTest : public cvtest::BaseTest ...@@ -286,25 +274,11 @@ class CV_BD_DescriptorsTest : public cvtest::BaseTest
ts->printf( cvtest::TS::LOG, "\nAverage time of computing one descriptor = %g ms.\n", ts->printf( cvtest::TS::LOG, "\nAverage time of computing one descriptor = %g ms.\n",
t / ( (double) getTickFrequency() * 1000. ) / calcDescriptors.rows ); t / ( (double) getTickFrequency() * 1000. ) / calcDescriptors.rows );
if( calcDescriptors.rows != (int) keylines.size() ) ASSERT_EQ((int)keylines.size(), calcDescriptors.rows)
{ << "Count of computed descriptors and keylines count must be equal";
ts->printf( cvtest::TS::LOG, "Count of computed descriptors and keylines count must be equal.\n" );
ts->printf( cvtest::TS::LOG, "Count of keylines is %d.\n", (int) keylines.size() );
ts->printf( cvtest::TS::LOG, "Count of computed descriptors is %d.\n", calcDescriptors.rows );
ts->set_failed_test_info( cvtest::TS::FAIL_INVALID_OUTPUT );
return;
}
if( calcDescriptors.cols != bd->descriptorSize() / 8 || calcDescriptors.type() != bd->descriptorType() ) ASSERT_EQ(bd->descriptorSize() / 8, calcDescriptors.cols);
{ ASSERT_EQ(bd->descriptorType(), calcDescriptors.type());
ts->printf( cvtest::TS::LOG, "Incorrect descriptor size or descriptor type.\n" );
ts->printf( cvtest::TS::LOG, "Expected size is %d.\n", bd->descriptorSize() );
ts->printf( cvtest::TS::LOG, "Calculated size is %d.\n", calcDescriptors.cols );
ts->printf( cvtest::TS::LOG, "Expected type is %d.\n", bd->descriptorType() );
ts->printf( cvtest::TS::LOG, "Calculated type is %d.\n", calcDescriptors.type() );
ts->set_failed_test_info( cvtest::TS::FAIL_INVALID_OUTPUT );
return;
}
// TODO read and write descriptor extractor parameters and check them // TODO read and write descriptor extractor parameters and check them
Mat validDescriptors = readDescriptors(); Mat validDescriptors = readDescriptors();
......
...@@ -29,19 +29,19 @@ CV_GMSMatcherTest::CV_GMSMatcherTest() ...@@ -29,19 +29,19 @@ CV_GMSMatcherTest::CV_GMSMatcherTest()
//Threshold = truncate(min(acc_win32, acc_win64)) //Threshold = truncate(min(acc_win32, acc_win64))
eps[0][0] = 0.9313; eps[0][0] = 0.9313;
eps[0][1] = 0.9223; eps[0][1] = 0.92;
eps[0][2] = 0.9313; eps[0][2] = 0.9313;
eps[0][3] = 0.9223; eps[0][3] = 0.92;
eps[1][0] = 0.8199; eps[1][0] = 0.8199;
eps[1][1] = 0.7964; eps[1][1] = 0.7964;
eps[1][2] = 0.8199; eps[1][2] = 0.8199;
eps[1][3] = 0.7964; eps[1][3] = 0.7964;
eps[2][0] = 0.7098; eps[2][0] = 0.6;
eps[2][1] = 0.6659; eps[2][1] = 0.6;
eps[2][2] = 0.6939; eps[2][2] = 0.6;
eps[2][3] = 0.6457; eps[2][3] = 0.6;
correctMatchDistThreshold = 5.0; correctMatchDistThreshold = 5.0;
} }
......
...@@ -352,6 +352,8 @@ protected: ...@@ -352,6 +352,8 @@ protected:
const int maxAngle = 360, angleStep = 15; const int maxAngle = 360, angleStep = 15;
for(int angle = 0; angle < maxAngle; angle += angleStep) for(int angle = 0; angle < maxAngle; angle += angleStep)
{ {
SCOPED_TRACE(cv::format("angle=%d", angle));
Mat H = rotateImage(image0, static_cast<float>(angle), image1, mask1); Mat H = rotateImage(image0, static_cast<float>(angle), image1, mask1);
vector<KeyPoint> keypoints1; vector<KeyPoint> keypoints1;
...@@ -374,16 +376,10 @@ protected: ...@@ -374,16 +376,10 @@ protected:
} }
} }
float descInliersRatio = static_cast<float>(descInliersCount) / keypoints0.size(); EXPECT_GE(descInliersCount, keypoints0.size() * minDescInliersRatio)
if(descInliersRatio < minDescInliersRatio) << "minDescInliersRatio=" << minDescInliersRatio << " keypoints0.size()=" << keypoints0.size();
{
ts->printf(cvtest::TS::LOG, "Incorrect descInliersRatio: curr = %f, min = %f.\n",
descInliersRatio, minDescInliersRatio);
ts->set_failed_test_info(cvtest::TS::FAIL_BAD_ACCURACY);
return;
}
#if SHOW_DEBUG_LOG #if SHOW_DEBUG_LOG
std::cout << "descInliersRatio " << static_cast<float>(descInliersCount) / keypoints0.size() << std::endl; std::cout << "angle=" << angle << " descInliersRatio=" << static_cast<float>(descInliersCount) / keypoints0.size() << std::endl;
#endif #endif
} }
ts->set_failed_test_info( cvtest::TS::OK ); ts->set_failed_test_info( cvtest::TS::OK );
...@@ -558,6 +554,7 @@ protected: ...@@ -558,6 +554,7 @@ protected:
for(int scaleIdx = 1; scaleIdx <= 3; scaleIdx++) for(int scaleIdx = 1; scaleIdx <= 3; scaleIdx++)
{ {
float scale = 1.f + scaleIdx * 0.5f; float scale = 1.f + scaleIdx * 0.5f;
SCOPED_TRACE(cv::format("scale=%g", scale));
Mat image1; Mat image1;
resize(image0, image1, Size(), 1./scale, 1./scale, INTER_LINEAR_EXACT); resize(image0, image1, Size(), 1./scale, 1./scale, INTER_LINEAR_EXACT);
...@@ -583,16 +580,10 @@ protected: ...@@ -583,16 +580,10 @@ protected:
} }
} }
float descInliersRatio = static_cast<float>(descInliersCount) / keypoints0.size(); EXPECT_GE(descInliersCount, keypoints0.size() * minDescInliersRatio)
if(descInliersRatio < minDescInliersRatio) << "minDescInliersRatio=" << minDescInliersRatio << " keypoints0.size()=" << keypoints0.size();
{
ts->printf(cvtest::TS::LOG, "Incorrect descInliersRatio: curr = %f, min = %f.\n",
descInliersRatio, minDescInliersRatio);
ts->set_failed_test_info(cvtest::TS::FAIL_BAD_ACCURACY);
return;
}
#if SHOW_DEBUG_LOG #if SHOW_DEBUG_LOG
std::cout << "descInliersRatio " << static_cast<float>(descInliersCount) / keypoints0.size() << std::endl; std::cout << "scale=" << scale << " descInliersRatio=" << static_cast<float>(descInliersCount) / keypoints0.size() << std::endl;
#endif #endif
} }
ts->set_failed_test_info( cvtest::TS::OK ); ts->set_failed_test_info( cvtest::TS::OK );
...@@ -653,7 +644,7 @@ TEST(Features2d_RotationInvariance_Descriptor_LATCH, regression) ...@@ -653,7 +644,7 @@ TEST(Features2d_RotationInvariance_Descriptor_LATCH, regression)
DescriptorRotationInvarianceTest test(SIFT::create(), DescriptorRotationInvarianceTest test(SIFT::create(),
LATCH::create(), LATCH::create(),
NORM_HAMMING, NORM_HAMMING,
0.9999f); 0.98f);
test.safe_run(); test.safe_run();
} }
#endif // NONFREE #endif // NONFREE
...@@ -672,7 +663,7 @@ TEST(Features2d_RotationInvariance_Descriptor_VGG120, regression) ...@@ -672,7 +663,7 @@ TEST(Features2d_RotationInvariance_Descriptor_VGG120, regression)
DescriptorRotationInvarianceTest test(KAZE::create(), DescriptorRotationInvarianceTest test(KAZE::create(),
VGG::create(VGG::VGG_120, 1.4f, true, true, 48.0f, false), VGG::create(VGG::VGG_120, 1.4f, true, true, 48.0f, false),
NORM_L1, NORM_L1,
1.00f); 0.98f);
test.safe_run(); test.safe_run();
} }
...@@ -681,7 +672,7 @@ TEST(Features2d_RotationInvariance_Descriptor_VGG80, regression) ...@@ -681,7 +672,7 @@ TEST(Features2d_RotationInvariance_Descriptor_VGG80, regression)
DescriptorRotationInvarianceTest test(KAZE::create(), DescriptorRotationInvarianceTest test(KAZE::create(),
VGG::create(VGG::VGG_80, 1.4f, true, true, 48.0f, false), VGG::create(VGG::VGG_80, 1.4f, true, true, 48.0f, false),
NORM_L1, NORM_L1,
1.00f); 0.98f);
test.safe_run(); test.safe_run();
} }
...@@ -690,7 +681,7 @@ TEST(Features2d_RotationInvariance_Descriptor_VGG64, regression) ...@@ -690,7 +681,7 @@ TEST(Features2d_RotationInvariance_Descriptor_VGG64, regression)
DescriptorRotationInvarianceTest test(KAZE::create(), DescriptorRotationInvarianceTest test(KAZE::create(),
VGG::create(VGG::VGG_64, 1.4f, true, true, 48.0f, false), VGG::create(VGG::VGG_64, 1.4f, true, true, 48.0f, false),
NORM_L1, NORM_L1,
1.00f); 0.98f);
test.safe_run(); test.safe_run();
} }
...@@ -699,7 +690,7 @@ TEST(Features2d_RotationInvariance_Descriptor_VGG48, regression) ...@@ -699,7 +690,7 @@ TEST(Features2d_RotationInvariance_Descriptor_VGG48, regression)
DescriptorRotationInvarianceTest test(KAZE::create(), DescriptorRotationInvarianceTest test(KAZE::create(),
VGG::create(VGG::VGG_48, 1.4f, true, true, 48.0f, false), VGG::create(VGG::VGG_48, 1.4f, true, true, 48.0f, false),
NORM_L1, NORM_L1,
1.00f); 0.98f);
test.safe_run(); test.safe_run();
} }
...@@ -746,7 +737,7 @@ TEST(Features2d_RotationInvariance_Descriptor_BoostDesc_BGM, regression) ...@@ -746,7 +737,7 @@ TEST(Features2d_RotationInvariance_Descriptor_BoostDesc_BGM, regression)
DescriptorRotationInvarianceTest test(SURF::create(), DescriptorRotationInvarianceTest test(SURF::create(),
BoostDesc::create(BoostDesc::BGM,true,6.25f), BoostDesc::create(BoostDesc::BGM,true,6.25f),
NORM_HAMMING, NORM_HAMMING,
0.999f); 0.98f);
test.safe_run(); test.safe_run();
} }
...@@ -773,7 +764,7 @@ TEST(Features2d_RotationInvariance_Descriptor_BoostDesc_LBGM, regression) ...@@ -773,7 +764,7 @@ TEST(Features2d_RotationInvariance_Descriptor_BoostDesc_LBGM, regression)
DescriptorRotationInvarianceTest test(SURF::create(), DescriptorRotationInvarianceTest test(SURF::create(),
BoostDesc::create(BoostDesc::LBGM,true,6.25f), BoostDesc::create(BoostDesc::LBGM,true,6.25f),
NORM_L1, NORM_L1,
0.999f); 0.98f);
test.safe_run(); test.safe_run();
} }
...@@ -800,7 +791,7 @@ TEST(Features2d_RotationInvariance_Descriptor_BoostDesc_BINBOOST_256, regression ...@@ -800,7 +791,7 @@ TEST(Features2d_RotationInvariance_Descriptor_BoostDesc_BINBOOST_256, regression
DescriptorRotationInvarianceTest test(SURF::create(), DescriptorRotationInvarianceTest test(SURF::create(),
BoostDesc::create(BoostDesc::BINBOOST_256,true,6.25f), BoostDesc::create(BoostDesc::BINBOOST_256,true,6.25f),
NORM_HAMMING, NORM_HAMMING,
0.999f); 0.98f);
test.safe_run(); test.safe_run();
} }
...@@ -819,7 +810,7 @@ TEST(Features2d_ScaleInvariance_Detector_SIFT, regression) ...@@ -819,7 +810,7 @@ TEST(Features2d_ScaleInvariance_Detector_SIFT, regression)
{ {
DetectorScaleInvarianceTest test(SIFT::create(), DetectorScaleInvarianceTest test(SIFT::create(),
0.69f, 0.69f,
0.99f); 0.98f);
test.safe_run(); test.safe_run();
} }
...@@ -889,7 +880,7 @@ TEST(Features2d_ScaleInvariance_Descriptor_VGG120, regression) ...@@ -889,7 +880,7 @@ TEST(Features2d_ScaleInvariance_Descriptor_VGG120, regression)
DescriptorScaleInvarianceTest test(KAZE::create(), DescriptorScaleInvarianceTest test(KAZE::create(),
VGG::create(VGG::VGG_120, 1.4f, true, true, 48.0f, false), VGG::create(VGG::VGG_120, 1.4f, true, true, 48.0f, false),
NORM_L1, NORM_L1,
0.99f); 0.98f);
test.safe_run(); test.safe_run();
} }
......
...@@ -20,10 +20,8 @@ TEST(ximgproc_ridgedetectionfilter, ReferenceAccuracy) ...@@ -20,10 +20,8 @@ TEST(ximgproc_ridgedetectionfilter, ReferenceAccuracy)
rdf->getRidgeFilteredImage(src, out); rdf->getRidgeFilteredImage(src, out);
Mat out_cmp; Mat out_cmp;
out.convertTo(out_cmp, CV_8UC1); out.convertTo(out_cmp, CV_8UC1);
Mat sb; EXPECT_LE(cvtest::norm(out, ref, NORM_INF), 0.0f);
subtract(out_cmp, n_ref, sb); EXPECT_LE(cvtest::norm(out, ref, NORM_L2 | NORM_RELATIVE), .0f);
int zeros = countNonZero(sb);
EXPECT_EQ(zeros, 0);
} }
}} // namespace }} // namespace
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