Skip to content

Commit f452bd4

Browse files
committed
update tests (gaussianBlur fix)
1 parent 91859e8 commit f452bd4

File tree

4 files changed

+32
-69
lines changed

4 files changed

+32
-69
lines changed

modules/line_descriptor/test/test_descriptors_regression.cpp

Lines changed: 5 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -100,19 +100,7 @@ class CV_BD_DescriptorsTest : public cvtest::BaseTest
100100
curMaxDist = dist;
101101
}
102102

103-
std::stringstream ss;
104-
ss << "Max distance between valid and computed descriptors " << curMaxDist;
105-
106-
if( curMaxDist < maxDist )
107-
ss << "." << std::endl;
108-
109-
else
110-
{
111-
ss << ">" << maxDist << " - bad accuracy!" << "\n";
112-
ts->set_failed_test_info( cvtest::TS::FAIL_BAD_ACCURACY );
113-
}
114-
115-
ts->printf( cvtest::TS::LOG, ss.str().c_str() );
103+
EXPECT_LT(curMaxDist, maxDist) << "Max distance between valid and computed descriptors";
116104
}
117105

118106
Mat readDescriptors()
@@ -286,25 +274,11 @@ class CV_BD_DescriptorsTest : public cvtest::BaseTest
286274
ts->printf( cvtest::TS::LOG, "\nAverage time of computing one descriptor = %g ms.\n",
287275
t / ( (double) getTickFrequency() * 1000. ) / calcDescriptors.rows );
288276

289-
if( calcDescriptors.rows != (int) keylines.size() )
290-
{
291-
ts->printf( cvtest::TS::LOG, "Count of computed descriptors and keylines count must be equal.\n" );
292-
ts->printf( cvtest::TS::LOG, "Count of keylines is %d.\n", (int) keylines.size() );
293-
ts->printf( cvtest::TS::LOG, "Count of computed descriptors is %d.\n", calcDescriptors.rows );
294-
ts->set_failed_test_info( cvtest::TS::FAIL_INVALID_OUTPUT );
295-
return;
296-
}
277+
ASSERT_EQ((int)keylines.size(), calcDescriptors.rows)
278+
<< "Count of computed descriptors and keylines count must be equal";
297279

298-
if( calcDescriptors.cols != bd->descriptorSize() / 8 || calcDescriptors.type() != bd->descriptorType() )
299-
{
300-
ts->printf( cvtest::TS::LOG, "Incorrect descriptor size or descriptor type.\n" );
301-
ts->printf( cvtest::TS::LOG, "Expected size is %d.\n", bd->descriptorSize() );
302-
ts->printf( cvtest::TS::LOG, "Calculated size is %d.\n", calcDescriptors.cols );
303-
ts->printf( cvtest::TS::LOG, "Expected type is %d.\n", bd->descriptorType() );
304-
ts->printf( cvtest::TS::LOG, "Calculated type is %d.\n", calcDescriptors.type() );
305-
ts->set_failed_test_info( cvtest::TS::FAIL_INVALID_OUTPUT );
306-
return;
307-
}
280+
ASSERT_EQ(bd->descriptorSize() / 8, calcDescriptors.cols);
281+
ASSERT_EQ(bd->descriptorType(), calcDescriptors.type());
308282

309283
// TODO read and write descriptor extractor parameters and check them
310284
Mat validDescriptors = readDescriptors();

modules/xfeatures2d/test/test_gms_matcher.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,19 +29,19 @@ CV_GMSMatcherTest::CV_GMSMatcherTest()
2929

3030
//Threshold = truncate(min(acc_win32, acc_win64))
3131
eps[0][0] = 0.9313;
32-
eps[0][1] = 0.9223;
32+
eps[0][1] = 0.92;
3333
eps[0][2] = 0.9313;
34-
eps[0][3] = 0.9223;
34+
eps[0][3] = 0.92;
3535

3636
eps[1][0] = 0.8199;
3737
eps[1][1] = 0.7964;
3838
eps[1][2] = 0.8199;
3939
eps[1][3] = 0.7964;
4040

41-
eps[2][0] = 0.7098;
42-
eps[2][1] = 0.6659;
43-
eps[2][2] = 0.6939;
44-
eps[2][3] = 0.6457;
41+
eps[2][0] = 0.6;
42+
eps[2][1] = 0.6;
43+
eps[2][2] = 0.6;
44+
eps[2][3] = 0.6;
4545

4646
correctMatchDistThreshold = 5.0;
4747
}

modules/xfeatures2d/test/test_rotation_and_scale_invariance.cpp

Lines changed: 19 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -352,6 +352,8 @@ class DescriptorRotationInvarianceTest : public cvtest::BaseTest
352352
const int maxAngle = 360, angleStep = 15;
353353
for(int angle = 0; angle < maxAngle; angle += angleStep)
354354
{
355+
SCOPED_TRACE(cv::format("angle=%d", angle));
356+
355357
Mat H = rotateImage(image0, static_cast<float>(angle), image1, mask1);
356358

357359
vector<KeyPoint> keypoints1;
@@ -374,16 +376,10 @@ class DescriptorRotationInvarianceTest : public cvtest::BaseTest
374376
}
375377
}
376378

377-
float descInliersRatio = static_cast<float>(descInliersCount) / keypoints0.size();
378-
if(descInliersRatio < minDescInliersRatio)
379-
{
380-
ts->printf(cvtest::TS::LOG, "Incorrect descInliersRatio: curr = %f, min = %f.\n",
381-
descInliersRatio, minDescInliersRatio);
382-
ts->set_failed_test_info(cvtest::TS::FAIL_BAD_ACCURACY);
383-
return;
384-
}
379+
EXPECT_GE(descInliersCount, keypoints0.size() * minDescInliersRatio)
380+
<< "minDescInliersRatio=" << minDescInliersRatio << " keypoints0.size()=" << keypoints0.size();
385381
#if SHOW_DEBUG_LOG
386-
std::cout << "descInliersRatio " << static_cast<float>(descInliersCount) / keypoints0.size() << std::endl;
382+
std::cout << "angle=" << angle << " descInliersRatio=" << static_cast<float>(descInliersCount) / keypoints0.size() << std::endl;
387383
#endif
388384
}
389385
ts->set_failed_test_info( cvtest::TS::OK );
@@ -558,6 +554,7 @@ class DescriptorScaleInvarianceTest : public cvtest::BaseTest
558554
for(int scaleIdx = 1; scaleIdx <= 3; scaleIdx++)
559555
{
560556
float scale = 1.f + scaleIdx * 0.5f;
557+
SCOPED_TRACE(cv::format("scale=%g", scale));
561558

562559
Mat image1;
563560
resize(image0, image1, Size(), 1./scale, 1./scale, INTER_LINEAR_EXACT);
@@ -583,16 +580,10 @@ class DescriptorScaleInvarianceTest : public cvtest::BaseTest
583580
}
584581
}
585582

586-
float descInliersRatio = static_cast<float>(descInliersCount) / keypoints0.size();
587-
if(descInliersRatio < minDescInliersRatio)
588-
{
589-
ts->printf(cvtest::TS::LOG, "Incorrect descInliersRatio: curr = %f, min = %f.\n",
590-
descInliersRatio, minDescInliersRatio);
591-
ts->set_failed_test_info(cvtest::TS::FAIL_BAD_ACCURACY);
592-
return;
593-
}
583+
EXPECT_GE(descInliersCount, keypoints0.size() * minDescInliersRatio)
584+
<< "minDescInliersRatio=" << minDescInliersRatio << " keypoints0.size()=" << keypoints0.size();
594585
#if SHOW_DEBUG_LOG
595-
std::cout << "descInliersRatio " << static_cast<float>(descInliersCount) / keypoints0.size() << std::endl;
586+
std::cout << "scale=" << scale << " descInliersRatio=" << static_cast<float>(descInliersCount) / keypoints0.size() << std::endl;
596587
#endif
597588
}
598589
ts->set_failed_test_info( cvtest::TS::OK );
@@ -653,7 +644,7 @@ TEST(Features2d_RotationInvariance_Descriptor_LATCH, regression)
653644
DescriptorRotationInvarianceTest test(SIFT::create(),
654645
LATCH::create(),
655646
NORM_HAMMING,
656-
0.9999f);
647+
0.98f);
657648
test.safe_run();
658649
}
659650
#endif // NONFREE
@@ -672,7 +663,7 @@ TEST(Features2d_RotationInvariance_Descriptor_VGG120, regression)
672663
DescriptorRotationInvarianceTest test(KAZE::create(),
673664
VGG::create(VGG::VGG_120, 1.4f, true, true, 48.0f, false),
674665
NORM_L1,
675-
1.00f);
666+
0.98f);
676667
test.safe_run();
677668
}
678669

@@ -681,7 +672,7 @@ TEST(Features2d_RotationInvariance_Descriptor_VGG80, regression)
681672
DescriptorRotationInvarianceTest test(KAZE::create(),
682673
VGG::create(VGG::VGG_80, 1.4f, true, true, 48.0f, false),
683674
NORM_L1,
684-
1.00f);
675+
0.98f);
685676
test.safe_run();
686677
}
687678

@@ -690,7 +681,7 @@ TEST(Features2d_RotationInvariance_Descriptor_VGG64, regression)
690681
DescriptorRotationInvarianceTest test(KAZE::create(),
691682
VGG::create(VGG::VGG_64, 1.4f, true, true, 48.0f, false),
692683
NORM_L1,
693-
1.00f);
684+
0.98f);
694685
test.safe_run();
695686
}
696687

@@ -699,7 +690,7 @@ TEST(Features2d_RotationInvariance_Descriptor_VGG48, regression)
699690
DescriptorRotationInvarianceTest test(KAZE::create(),
700691
VGG::create(VGG::VGG_48, 1.4f, true, true, 48.0f, false),
701692
NORM_L1,
702-
1.00f);
693+
0.98f);
703694
test.safe_run();
704695
}
705696

@@ -746,7 +737,7 @@ TEST(Features2d_RotationInvariance_Descriptor_BoostDesc_BGM, regression)
746737
DescriptorRotationInvarianceTest test(SURF::create(),
747738
BoostDesc::create(BoostDesc::BGM,true,6.25f),
748739
NORM_HAMMING,
749-
0.999f);
740+
0.98f);
750741
test.safe_run();
751742
}
752743

@@ -773,7 +764,7 @@ TEST(Features2d_RotationInvariance_Descriptor_BoostDesc_LBGM, regression)
773764
DescriptorRotationInvarianceTest test(SURF::create(),
774765
BoostDesc::create(BoostDesc::LBGM,true,6.25f),
775766
NORM_L1,
776-
0.999f);
767+
0.98f);
777768
test.safe_run();
778769
}
779770

@@ -800,7 +791,7 @@ TEST(Features2d_RotationInvariance_Descriptor_BoostDesc_BINBOOST_256, regression
800791
DescriptorRotationInvarianceTest test(SURF::create(),
801792
BoostDesc::create(BoostDesc::BINBOOST_256,true,6.25f),
802793
NORM_HAMMING,
803-
0.999f);
794+
0.98f);
804795
test.safe_run();
805796
}
806797

@@ -819,7 +810,7 @@ TEST(Features2d_ScaleInvariance_Detector_SIFT, regression)
819810
{
820811
DetectorScaleInvarianceTest test(SIFT::create(),
821812
0.69f,
822-
0.99f);
813+
0.98f);
823814
test.safe_run();
824815
}
825816

@@ -889,7 +880,7 @@ TEST(Features2d_ScaleInvariance_Descriptor_VGG120, regression)
889880
DescriptorScaleInvarianceTest test(KAZE::create(),
890881
VGG::create(VGG::VGG_120, 1.4f, true, true, 48.0f, false),
891882
NORM_L1,
892-
0.99f);
883+
0.98f);
893884
test.safe_run();
894885
}
895886

modules/ximgproc/test/test_ridge_detection_filter.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,8 @@ TEST(ximgproc_ridgedetectionfilter, ReferenceAccuracy)
2020
rdf->getRidgeFilteredImage(src, out);
2121
Mat out_cmp;
2222
out.convertTo(out_cmp, CV_8UC1);
23-
Mat sb;
24-
subtract(out_cmp, n_ref, sb);
25-
int zeros = countNonZero(sb);
26-
EXPECT_EQ(zeros, 0);
23+
EXPECT_LE(cvtest::norm(out, ref, NORM_INF), 0.0f);
24+
EXPECT_LE(cvtest::norm(out, ref, NORM_L2 | NORM_RELATIVE), .0f);
2725
}
2826

2927
}} // namespace

0 commit comments

Comments
 (0)