Skip to content

Commit e7aa0aa

Browse files
committed
Merge pull request #1688 from alalek:xfeatures2d_fix_nonfree_tests
2 parents 86a6737 + 0a8d930 commit e7aa0aa

10 files changed

+35
-11
lines changed

modules/xfeatures2d/perf/perf_latch.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ typedef perf::TestBaseWithParam<std::string> latch;
1111
"cv/detectors_descriptors_evaluation/images_datasets/leuven/img1.png",\
1212
"stitching/a3.png"
1313

14+
#ifdef OPENCV_ENABLE_NONFREE
1415
PERF_TEST_P(latch, extract, testing::Values(LATCH_IMAGES))
1516
{
1617
string filename = getDataPath(GetParam());
@@ -30,5 +31,6 @@ PERF_TEST_P(latch, extract, testing::Values(LATCH_IMAGES))
3031

3132
SANITY_CHECK_NOTHING();
3233
}
34+
#endif // NONFREE
3335

3436
}} // namespace

modules/xfeatures2d/perf/perf_surf.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
// of this distribution and at http://opencv.org/license.html.
44
#include "perf_precomp.hpp"
55

6+
#ifdef OPENCV_ENABLE_NONFREE
67
namespace opencv_test { namespace {
78

89
typedef perf::TestBaseWithParam<std::string> surf;
@@ -64,3 +65,4 @@ PERF_TEST_P(surf, full, testing::Values(SURF_IMAGES))
6465
}
6566

6667
}} // namespace
68+
#endif // NONFREE

modules/xfeatures2d/perf/perf_surf.cuda.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242

4343
#include "perf_precomp.hpp"
4444

45-
#ifdef HAVE_CUDA
45+
#if defined(HAVE_CUDA) && defined(OPENCV_ENABLE_NONFREE)
4646

4747
#include "opencv2/ts/cuda_perf.hpp"
4848

@@ -99,4 +99,4 @@ PERF_TEST_P(Image, CUDA_SURF,
9999
#endif // HAVE_OPENCV_CUDAARITHM
100100

101101
}} // namespace
102-
#endif // HAVE_CUDA
102+
#endif // HAVE_CUDA && OPENCV_ENABLE_NONFREE

modules/xfeatures2d/perf/perf_surf.ocl.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545

4646
#include "perf_precomp.hpp"
4747

48-
#ifdef HAVE_OPENCV_OCL
48+
#if defined(HAVE_OPENCV_OCL) && defined(OPENCV_ENABLE_NONFREE)
4949

5050
namespace opencv_test { namespace {
5151

@@ -105,4 +105,4 @@ PERF_TEST_P(OCL_SURF, DISABLED_without_data_transfer, testing::Values(SURF_IMAGE
105105
}
106106

107107
}} // namespace
108-
#endif // HAVE_OPENCV_OCL
108+
#endif // HAVE_OPENCV_OCL && OPENCV_ENABLE_NONFREE

modules/xfeatures2d/test/test_detectors.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -278,12 +278,15 @@ void CV_DetectorsTest::run( int /*start_from*/ )
278278
GaussianBlur(to_test, to_test, Size(3, 3), 1.5);
279279

280280
vector<KeyPoint> exp;
281+
282+
#ifdef OPENCV_ENABLE_NONFREE
281283
LoadExpected(string(ts->get_data_path()) + "detectors/surf.xml", exp);
282284
if (exp.empty())
283285
return;
284286

285287
if (!testDetector(to_test, SURF::create(1536+512+512, 2, 2, true, false), exp))
286288
return;
289+
#endif
287290

288291
LoadExpected(string(ts->get_data_path()) + "detectors/star.xml", exp);
289292
if (exp.empty())

modules/xfeatures2d/test/test_features2d.cpp

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -987,7 +987,7 @@ void CV_DescriptorMatcherTest::run( int )
987987
* Detectors
988988
*/
989989

990-
990+
#ifdef OPENCV_ENABLE_NONFREE
991991
TEST( Features2d_Detector_SIFT, regression )
992992
{
993993
CV_FeatureDetectorTest test( "detector-sift", SIFT::create() );
@@ -999,6 +999,7 @@ TEST( Features2d_Detector_SURF, regression )
999999
CV_FeatureDetectorTest test( "detector-surf", SURF::create() );
10001000
test.safe_run();
10011001
}
1002+
#endif
10021003

10031004
TEST( Features2d_Detector_STAR, regression )
10041005
{
@@ -1027,6 +1028,7 @@ TEST( Features2d_Detector_Harris_Laplace_Affine, regression )
10271028
/*
10281029
* Descriptors
10291030
*/
1031+
#ifdef OPENCV_ENABLE_NONFREE
10301032
TEST( Features2d_DescriptorExtractor_SIFT, regression )
10311033
{
10321034
CV_DescriptorExtractorTest<L1<float> > test( "descriptor-sift", 1.0f,
@@ -1064,6 +1066,7 @@ TEST( Features2d_DescriptorExtractor_SURF_OCL, regression )
10641066
cv::ocl::setUseOpenCL(useOCL);
10651067
}
10661068
#endif
1069+
#endif // NONFREE
10671070

10681071
TEST( Features2d_DescriptorExtractor_DAISY, regression )
10691072
{
@@ -1204,7 +1207,7 @@ TEST( Features2d_DescriptorExtractor_Calonder_float, regression )
12041207
test.safe_run();
12051208
}
12061209
#endif*/ // CV_SSE2
1207-
1210+
#ifdef OPENCV_ENABLE_NONFREE
12081211
TEST(Features2d_BruteForceDescriptorMatcher_knnMatch, regression)
12091212
{
12101213
const int sz = 100;
@@ -1254,6 +1257,7 @@ TEST(Features2d_BruteForceDescriptorMatcher_knnMatch, regression)
12541257
}
12551258
}
12561259
}
1260+
#endif
12571261

12581262
/*TEST(Features2d_DescriptorExtractorParamTest, regression)
12591263
{
@@ -1330,8 +1334,10 @@ class CV_DetectPlanarTest : public cvtest::BaseTest
13301334
Ptr<Feature2D> f2d;
13311335
};
13321336

1337+
#ifdef OPENCV_ENABLE_NONFREE
13331338
TEST(Features2d_SIFTHomographyTest, regression) { CV_DetectPlanarTest test("SIFT", 80, SIFT::create()); test.safe_run(); }
13341339
TEST(Features2d_SURFHomographyTest, regression) { CV_DetectPlanarTest test("SURF", 80, SURF::create()); test.safe_run(); }
1340+
#endif
13351341

13361342
class FeatureDetectorUsingMaskTest : public cvtest::BaseTest
13371343
{
@@ -1394,6 +1400,7 @@ class FeatureDetectorUsingMaskTest : public cvtest::BaseTest
13941400
Ptr<FeatureDetector> featureDetector_;
13951401
};
13961402

1403+
#ifdef OPENCV_ENABLE_NONFREE
13971404
TEST(Features2d_SIFT_using_mask, regression)
13981405
{
13991406
FeatureDetectorUsingMaskTest test(SIFT::create());
@@ -1433,5 +1440,6 @@ TEST( XFeatures2d_DescriptorExtractor, batch )
14331440
EXPECT_GT(descriptors[i].rows, 100);
14341441
}
14351442
}
1443+
#endif // NONFREE
14361444

14371445
}} // namespace

modules/xfeatures2d/test/test_keypoints.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ class CV_FeatureDetectorKeypointsTest : public cvtest::BaseTest
115115

116116

117117
// Registration of tests
118-
118+
#ifdef OPENCV_ENABLE_NONFREE
119119
TEST(Features2d_Detector_Keypoints_SURF, validation)
120120
{
121121
CV_FeatureDetectorKeypointsTest test(xfeatures2d::SURF::create());
@@ -127,6 +127,8 @@ TEST(Features2d_Detector_Keypoints_SIFT, validation)
127127
CV_FeatureDetectorKeypointsTest test(xfeatures2d::SIFT::create());
128128
test.safe_run();
129129
}
130+
#endif // NONFREE
131+
130132

131133
TEST(Features2d_Detector_Keypoints_Star, validation)
132134
{

modules/xfeatures2d/test/test_rotation_and_scale_invariance.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -610,6 +610,7 @@ class DescriptorScaleInvarianceTest : public cvtest::BaseTest
610610
/*
611611
* Detector's rotation invariance check
612612
*/
613+
#ifdef OPENCV_ENABLE_NONFREE
613614
TEST(Features2d_RotationInvariance_Detector_SURF, regression)
614615
{
615616
DetectorRotationInvarianceTest test(SURF::create(),
@@ -655,6 +656,7 @@ TEST(Features2d_RotationInvariance_Descriptor_LATCH, regression)
655656
0.9999f);
656657
test.safe_run();
657658
}
659+
#endif // NONFREE
658660

659661
TEST(DISABLED_Features2d_RotationInvariance_Descriptor_DAISY, regression)
660662
{
@@ -701,6 +703,7 @@ TEST(Features2d_RotationInvariance_Descriptor_VGG48, regression)
701703
test.safe_run();
702704
}
703705

706+
#ifdef OPENCV_ENABLE_NONFREE
704707
TEST(Features2d_RotationInvariance_Descriptor_BRIEF_64, regression)
705708
{
706709
DescriptorRotationInvarianceTest test(SURF::create(),
@@ -870,6 +873,8 @@ TEST(Features2d_RotationInvariance2_Detector_SURF, regression)
870873
}
871874
}
872875

876+
#endif // NONFREE
877+
873878
TEST(DISABLED_Features2d_ScaleInvariance_Descriptor_DAISY, regression)
874879
{
875880
DescriptorScaleInvarianceTest test(BRISK::create(),
@@ -915,6 +920,7 @@ TEST(Features2d_ScaleInvariance_Descriptor_VGG48, regression)
915920
test.safe_run();
916921
}
917922

923+
#ifdef OPENCV_ENABLE_NONFREE
918924
TEST(Features2d_ScaleInvariance_Descriptor_BoostDesc_BGM, regression)
919925
{
920926
DescriptorScaleInvarianceTest test(SURF::create(),
@@ -977,5 +983,6 @@ TEST(Features2d_ScaleInvariance_Descriptor_BoostDesc_BINBOOST_256, regression)
977983
0.98f);
978984
test.safe_run();
979985
}
986+
#endif // NONFREE
980987

981988
}} // namespace

modules/xfeatures2d/test/test_surf.cuda.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242

4343
#include "test_precomp.hpp"
4444

45-
#ifdef HAVE_CUDA
45+
#if defined(HAVE_CUDA) && defined(OPENCV_ENABLE_NONFREE)
4646

4747
namespace opencv_test { namespace {
4848

@@ -181,4 +181,4 @@ INSTANTIATE_TEST_CASE_P(CUDA_Features2D, SURF, testing::Combine(
181181
#endif // HAVE_OPENCV_CUDAARITHM
182182

183183
}} // namespace
184-
#endif // HAVE_CUDA
184+
#endif // HAVE_CUDA && OPENCV_ENABLE_NONFREE

modules/xfeatures2d/test/test_surf.ocl.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545

4646
#include "test_precomp.hpp"
4747

48-
#ifdef HAVE_OPENCL
48+
#if defined(HAVE_OPENCL) && defined(OPENCV_ENABLE_NONFREE)
4949

5050
namespace opencv_test { namespace {
5151

@@ -200,4 +200,4 @@ INSTANTIATE_TEST_CASE_P(OCL_Features2D, SURF, testing::Combine(
200200

201201
}} // namespace
202202

203-
#endif // HAVE_OPENCL
203+
#endif // HAVE_OPENCL && OPENCV_ENABLE_NONFREE

0 commit comments

Comments
 (0)