Commit 426a6651 authored by Alexander Alekhin's avatar Alexander Alekhin

Merge remote-tracking branch 'upstream/3.4' into merge-3.4

parents 09e05b84 e7aa0aa2
......@@ -11,6 +11,7 @@ typedef perf::TestBaseWithParam<std::string> latch;
"cv/detectors_descriptors_evaluation/images_datasets/leuven/img1.png",\
"stitching/a3.png"
#ifdef OPENCV_ENABLE_NONFREE
PERF_TEST_P(latch, extract, testing::Values(LATCH_IMAGES))
{
string filename = getDataPath(GetParam());
......@@ -30,5 +31,6 @@ PERF_TEST_P(latch, extract, testing::Values(LATCH_IMAGES))
SANITY_CHECK_NOTHING();
}
#endif // NONFREE
}} // namespace
......@@ -3,6 +3,7 @@
// of this distribution and at http://opencv.org/license.html.
#include "perf_precomp.hpp"
#ifdef OPENCV_ENABLE_NONFREE
namespace opencv_test { namespace {
typedef perf::TestBaseWithParam<std::string> surf;
......@@ -64,3 +65,4 @@ PERF_TEST_P(surf, full, testing::Values(SURF_IMAGES))
}
}} // namespace
#endif // NONFREE
......@@ -42,7 +42,7 @@
#include "perf_precomp.hpp"
#ifdef HAVE_CUDA
#if defined(HAVE_CUDA) && defined(OPENCV_ENABLE_NONFREE)
#include "opencv2/ts/cuda_perf.hpp"
......@@ -99,4 +99,4 @@ PERF_TEST_P(Image, CUDA_SURF,
#endif // HAVE_OPENCV_CUDAARITHM
}} // namespace
#endif // HAVE_CUDA
#endif // HAVE_CUDA && OPENCV_ENABLE_NONFREE
......@@ -45,7 +45,7 @@
#include "perf_precomp.hpp"
#ifdef HAVE_OPENCV_OCL
#if defined(HAVE_OPENCV_OCL) && defined(OPENCV_ENABLE_NONFREE)
namespace opencv_test { namespace {
......@@ -105,4 +105,4 @@ PERF_TEST_P(OCL_SURF, DISABLED_without_data_transfer, testing::Values(SURF_IMAGE
}
}} // namespace
#endif // HAVE_OPENCV_OCL
#endif // HAVE_OPENCV_OCL && OPENCV_ENABLE_NONFREE
......@@ -47,24 +47,7 @@
using namespace cv;
using namespace cv::cuda;
#if (!defined (HAVE_CUDA) || !defined (HAVE_OPENCV_CUDAARITHM))
cv::cuda::SURF_CUDA::SURF_CUDA() { throw_no_cuda(); }
cv::cuda::SURF_CUDA::SURF_CUDA(double, int, int, bool, float, bool) { throw_no_cuda(); }
int cv::cuda::SURF_CUDA::descriptorSize() const { throw_no_cuda(); }
void cv::cuda::SURF_CUDA::uploadKeypoints(const std::vector<KeyPoint>&, GpuMat&) { throw_no_cuda(); }
void cv::cuda::SURF_CUDA::downloadKeypoints(const GpuMat&, std::vector<KeyPoint>&) { throw_no_cuda(); }
void cv::cuda::SURF_CUDA::downloadDescriptors(const GpuMat&, std::vector<float>&) { throw_no_cuda(); }
void cv::cuda::SURF_CUDA::operator()(const GpuMat&, const GpuMat&, GpuMat&) { throw_no_cuda(); }
void cv::cuda::SURF_CUDA::operator()(const GpuMat&, const GpuMat&, GpuMat&, GpuMat&, bool) { throw_no_cuda(); }
void cv::cuda::SURF_CUDA::operator()(const GpuMat&, const GpuMat&, std::vector<KeyPoint>&) { throw_no_cuda(); }
void cv::cuda::SURF_CUDA::operator()(const GpuMat&, const GpuMat&, std::vector<KeyPoint>&, GpuMat&, bool) { throw_no_cuda(); }
void cv::cuda::SURF_CUDA::operator()(const GpuMat&, const GpuMat&, std::vector<KeyPoint>&, std::vector<float>&, bool) { throw_no_cuda(); }
void cv::cuda::SURF_CUDA::releaseMemory() { throw_no_cuda(); }
#else // !defined (HAVE_CUDA)
#if (!defined (OPENCV_ENABLE_NONFREE))
#ifndef OPENCV_ENABLE_NONFREE
#define throw_no_nonfree CV_Error(Error::StsNotImplemented, \
"This algorithm is patented and is excluded in this configuration; " \
"Set OPENCV_ENABLE_NONFREE CMake option and rebuild the library");
......@@ -72,6 +55,7 @@ void cv::cuda::SURF_CUDA::releaseMemory() { throw_no_cuda(); }
cv::cuda::SURF_CUDA::SURF_CUDA() { throw_no_nonfree }
cv::cuda::SURF_CUDA::SURF_CUDA(double, int, int, bool, float, bool) { throw_no_nonfree }
int cv::cuda::SURF_CUDA::descriptorSize() const { throw_no_nonfree }
int cv::cuda::SURF_CUDA::defaultNorm() const { throw_no_nonfree }
void cv::cuda::SURF_CUDA::uploadKeypoints(const std::vector<KeyPoint>&, GpuMat&) { throw_no_nonfree }
void cv::cuda::SURF_CUDA::downloadKeypoints(const GpuMat&, std::vector<KeyPoint>&) { throw_no_nonfree }
void cv::cuda::SURF_CUDA::downloadDescriptors(const GpuMat&, std::vector<float>&) { throw_no_nonfree }
......@@ -82,6 +66,23 @@ void cv::cuda::SURF_CUDA::operator()(const GpuMat&, const GpuMat&, std::vector<K
void cv::cuda::SURF_CUDA::operator()(const GpuMat&, const GpuMat&, std::vector<KeyPoint>&, std::vector<float>&, bool) { throw_no_nonfree }
void cv::cuda::SURF_CUDA::releaseMemory() { throw_no_nonfree }
#elif (!defined (HAVE_CUDA) || !defined (HAVE_OPENCV_CUDAARITHM))
cv::cuda::SURF_CUDA::SURF_CUDA() { throw_no_cuda(); }
cv::cuda::SURF_CUDA::SURF_CUDA(double, int, int, bool, float, bool) { throw_no_cuda(); }
int cv::cuda::SURF_CUDA::descriptorSize() const { throw_no_cuda(); }
int cv::cuda::SURF_CUDA::defaultNorm() const { throw_no_cuda(); }
void cv::cuda::SURF_CUDA::uploadKeypoints(const std::vector<KeyPoint>&, GpuMat&) { throw_no_cuda(); }
void cv::cuda::SURF_CUDA::downloadKeypoints(const GpuMat&, std::vector<KeyPoint>&) { throw_no_cuda(); }
void cv::cuda::SURF_CUDA::downloadDescriptors(const GpuMat&, std::vector<float>&) { throw_no_cuda(); }
void cv::cuda::SURF_CUDA::operator()(const GpuMat&, const GpuMat&, GpuMat&) { throw_no_cuda(); }
void cv::cuda::SURF_CUDA::operator()(const GpuMat&, const GpuMat&, GpuMat&, GpuMat&, bool) { throw_no_cuda(); }
void cv::cuda::SURF_CUDA::operator()(const GpuMat&, const GpuMat&, std::vector<KeyPoint>&) { throw_no_cuda(); }
void cv::cuda::SURF_CUDA::operator()(const GpuMat&, const GpuMat&, std::vector<KeyPoint>&, GpuMat&, bool) { throw_no_cuda(); }
void cv::cuda::SURF_CUDA::operator()(const GpuMat&, const GpuMat&, std::vector<KeyPoint>&, std::vector<float>&, bool) { throw_no_cuda(); }
void cv::cuda::SURF_CUDA::releaseMemory() { throw_no_cuda(); }
#else // OPENCV_ENABLE_NONFREE
namespace cv { namespace cuda { namespace device
......@@ -450,7 +451,6 @@ void cv::cuda::SURF_CUDA::releaseMemory()
maxPosBuffer.release();
}
#endif // !defined (HAVE_CUDA)
#endif // !defined (OPENCV_ENABLE_NONFREE)
#endif
......@@ -278,12 +278,15 @@ void CV_DetectorsTest::run( int /*start_from*/ )
GaussianBlur(to_test, to_test, Size(3, 3), 1.5);
vector<KeyPoint> exp;
#ifdef OPENCV_ENABLE_NONFREE
LoadExpected(string(ts->get_data_path()) + "detectors/surf.xml", exp);
if (exp.empty())
return;
if (!testDetector(to_test, SURF::create(1536+512+512, 2, 2, true, false), exp))
return;
#endif
LoadExpected(string(ts->get_data_path()) + "detectors/star.xml", exp);
if (exp.empty())
......
......@@ -987,7 +987,7 @@ void CV_DescriptorMatcherTest::run( int )
* Detectors
*/
#ifdef OPENCV_ENABLE_NONFREE
TEST( Features2d_Detector_SIFT, regression )
{
CV_FeatureDetectorTest test( "detector-sift", SIFT::create() );
......@@ -999,6 +999,7 @@ TEST( Features2d_Detector_SURF, regression )
CV_FeatureDetectorTest test( "detector-surf", SURF::create() );
test.safe_run();
}
#endif
TEST( Features2d_Detector_STAR, regression )
{
......@@ -1027,6 +1028,7 @@ TEST( Features2d_Detector_Harris_Laplace_Affine, regression )
/*
* Descriptors
*/
#ifdef OPENCV_ENABLE_NONFREE
TEST( Features2d_DescriptorExtractor_SIFT, regression )
{
CV_DescriptorExtractorTest<L1<float> > test( "descriptor-sift", 1.0f,
......@@ -1064,6 +1066,7 @@ TEST( Features2d_DescriptorExtractor_SURF_OCL, regression )
cv::ocl::setUseOpenCL(useOCL);
}
#endif
#endif // NONFREE
TEST( Features2d_DescriptorExtractor_DAISY, regression )
{
......@@ -1204,7 +1207,7 @@ TEST( Features2d_DescriptorExtractor_Calonder_float, regression )
test.safe_run();
}
#endif*/ // CV_SSE2
#ifdef OPENCV_ENABLE_NONFREE
TEST(Features2d_BruteForceDescriptorMatcher_knnMatch, regression)
{
const int sz = 100;
......@@ -1254,6 +1257,7 @@ TEST(Features2d_BruteForceDescriptorMatcher_knnMatch, regression)
}
}
}
#endif
/*TEST(Features2d_DescriptorExtractorParamTest, regression)
{
......@@ -1330,8 +1334,10 @@ protected:
Ptr<Feature2D> f2d;
};
#ifdef OPENCV_ENABLE_NONFREE
TEST(Features2d_SIFTHomographyTest, regression) { CV_DetectPlanarTest test("SIFT", 80, SIFT::create()); test.safe_run(); }
TEST(Features2d_SURFHomographyTest, regression) { CV_DetectPlanarTest test("SURF", 80, SURF::create()); test.safe_run(); }
#endif
class FeatureDetectorUsingMaskTest : public cvtest::BaseTest
{
......@@ -1394,6 +1400,7 @@ protected:
Ptr<FeatureDetector> featureDetector_;
};
#ifdef OPENCV_ENABLE_NONFREE
TEST(Features2d_SIFT_using_mask, regression)
{
FeatureDetectorUsingMaskTest test(SIFT::create());
......@@ -1433,5 +1440,6 @@ TEST( XFeatures2d_DescriptorExtractor, batch )
EXPECT_GT(descriptors[i].rows, 100);
}
}
#endif // NONFREE
}} // namespace
......@@ -115,7 +115,7 @@ protected:
// Registration of tests
#ifdef OPENCV_ENABLE_NONFREE
TEST(Features2d_Detector_Keypoints_SURF, validation)
{
CV_FeatureDetectorKeypointsTest test(xfeatures2d::SURF::create());
......@@ -127,6 +127,8 @@ TEST(Features2d_Detector_Keypoints_SIFT, validation)
CV_FeatureDetectorKeypointsTest test(xfeatures2d::SIFT::create());
test.safe_run();
}
#endif // NONFREE
TEST(Features2d_Detector_Keypoints_Star, validation)
{
......
......@@ -610,6 +610,7 @@ protected:
/*
* Detector's rotation invariance check
*/
#ifdef OPENCV_ENABLE_NONFREE
TEST(Features2d_RotationInvariance_Detector_SURF, regression)
{
DetectorRotationInvarianceTest test(SURF::create(),
......@@ -655,6 +656,7 @@ TEST(Features2d_RotationInvariance_Descriptor_LATCH, regression)
0.9999f);
test.safe_run();
}
#endif // NONFREE
TEST(DISABLED_Features2d_RotationInvariance_Descriptor_DAISY, regression)
{
......@@ -701,6 +703,7 @@ TEST(Features2d_RotationInvariance_Descriptor_VGG48, regression)
test.safe_run();
}
#ifdef OPENCV_ENABLE_NONFREE
TEST(Features2d_RotationInvariance_Descriptor_BRIEF_64, regression)
{
DescriptorRotationInvarianceTest test(SURF::create(),
......@@ -870,6 +873,8 @@ TEST(Features2d_RotationInvariance2_Detector_SURF, regression)
}
}
#endif // NONFREE
TEST(DISABLED_Features2d_ScaleInvariance_Descriptor_DAISY, regression)
{
DescriptorScaleInvarianceTest test(BRISK::create(),
......@@ -915,6 +920,7 @@ TEST(Features2d_ScaleInvariance_Descriptor_VGG48, regression)
test.safe_run();
}
#ifdef OPENCV_ENABLE_NONFREE
TEST(Features2d_ScaleInvariance_Descriptor_BoostDesc_BGM, regression)
{
DescriptorScaleInvarianceTest test(SURF::create(),
......@@ -977,5 +983,6 @@ TEST(Features2d_ScaleInvariance_Descriptor_BoostDesc_BINBOOST_256, regression)
0.98f);
test.safe_run();
}
#endif // NONFREE
}} // namespace
......@@ -42,7 +42,7 @@
#include "test_precomp.hpp"
#ifdef HAVE_CUDA
#if defined(HAVE_CUDA) && defined(OPENCV_ENABLE_NONFREE)
namespace opencv_test { namespace {
......@@ -181,4 +181,4 @@ INSTANTIATE_TEST_CASE_P(CUDA_Features2D, SURF, testing::Combine(
#endif // HAVE_OPENCV_CUDAARITHM
}} // namespace
#endif // HAVE_CUDA
#endif // HAVE_CUDA && OPENCV_ENABLE_NONFREE
......@@ -45,7 +45,7 @@
#include "test_precomp.hpp"
#ifdef HAVE_OPENCL
#if defined(HAVE_OPENCL) && defined(OPENCV_ENABLE_NONFREE)
namespace opencv_test { namespace {
......@@ -200,4 +200,4 @@ INSTANTIATE_TEST_CASE_P(OCL_Features2D, SURF, testing::Combine(
}} // namespace
#endif // HAVE_OPENCL
#endif // HAVE_OPENCL && OPENCV_ENABLE_NONFREE
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