fixed doc builder warnings; make sure the tests give reasonable results when OpenCL is not available
This commit is contained in:
@@ -240,7 +240,7 @@ The class ``SURF_GPU`` uses some buffers and provides access to it. All buffers
|
||||
|
||||
ocl::SURF_OCL
|
||||
-------------
|
||||
.. ocv:class:: ocl::SURF_OCL
|
||||
.. ocv:class:: ocl::SURF_OCL : public Feature2D
|
||||
|
||||
Class used for extracting Speeded Up Robust Features (SURF) from an image. ::
|
||||
|
||||
|
||||
@@ -114,7 +114,7 @@ namespace cv
|
||||
CV_OUT vector<KeyPoint>& keypoints,
|
||||
OutputArray descriptors,
|
||||
bool useProvidedKeypoints=false) const;
|
||||
|
||||
|
||||
AlgorithmInfo* info() const;
|
||||
|
||||
void releaseMemory();
|
||||
|
||||
@@ -13,9 +13,19 @@ typedef perf::TestBaseWithParam<std::string> surf;
|
||||
"stitching/a3.png"
|
||||
|
||||
#ifdef HAVE_OPENCV_OCL
|
||||
typedef ocl::SURF_OCL surf_class;
|
||||
static Ptr<Feature2D> getSURF()
|
||||
{
|
||||
ocl::PlatformsInfo p;
|
||||
if(ocl::getOpenCLPlatforms(p) > 0)
|
||||
return new ocl::SURF_OCL;
|
||||
else
|
||||
return new SURF;
|
||||
}
|
||||
#else
|
||||
typdef SURF surf_class;
|
||||
static Ptr<Feature2D> getSURF()
|
||||
{
|
||||
return new SURF;
|
||||
}
|
||||
#endif
|
||||
|
||||
PERF_TEST_P(surf, detect, testing::Values(SURF_IMAGES))
|
||||
@@ -28,10 +38,11 @@ PERF_TEST_P(surf, detect, testing::Values(SURF_IMAGES))
|
||||
|
||||
Mat mask;
|
||||
declare.in(frame).time(90);
|
||||
surf_class detector;
|
||||
Ptr<Feature2D> detector = getSURF();
|
||||
|
||||
vector<KeyPoint> points;
|
||||
|
||||
TEST_CYCLE() detector(frame, mask, points);
|
||||
TEST_CYCLE() detector->operator()(frame, mask, points, noArray());
|
||||
|
||||
SANITY_CHECK_KEYPOINTS(points, 1e-3);
|
||||
}
|
||||
@@ -47,12 +58,12 @@ PERF_TEST_P(surf, extract, testing::Values(SURF_IMAGES))
|
||||
Mat mask;
|
||||
declare.in(frame).time(90);
|
||||
|
||||
surf_class detector;
|
||||
Ptr<Feature2D> detector = getSURF();
|
||||
vector<KeyPoint> points;
|
||||
vector<float> descriptors;
|
||||
detector(frame, mask, points);
|
||||
detector->operator()(frame, mask, points, noArray());
|
||||
|
||||
TEST_CYCLE() detector(frame, mask, points, descriptors, true);
|
||||
TEST_CYCLE() detector->operator()(frame, mask, points, descriptors, true);
|
||||
|
||||
SANITY_CHECK(descriptors, 1e-4);
|
||||
}
|
||||
@@ -67,11 +78,11 @@ PERF_TEST_P(surf, full, testing::Values(SURF_IMAGES))
|
||||
|
||||
Mat mask;
|
||||
declare.in(frame).time(90);
|
||||
surf_class detector;
|
||||
Ptr<Feature2D> detector = getSURF();
|
||||
vector<KeyPoint> points;
|
||||
vector<float> descriptors;
|
||||
|
||||
TEST_CYCLE() detector(frame, mask, points, descriptors, false);
|
||||
TEST_CYCLE() detector->operator()(frame, mask, points, descriptors, false);
|
||||
|
||||
SANITY_CHECK_KEYPOINTS(points, 1e-3);
|
||||
SANITY_CHECK(descriptors, 1e-4);
|
||||
|
||||
@@ -51,9 +51,19 @@ const string DESCRIPTOR_DIR = FEATURES2D_DIR + "/descriptor_extractors";
|
||||
const string IMAGE_FILENAME = "tsukuba.png";
|
||||
|
||||
#ifdef HAVE_OPENCV_OCL
|
||||
#define SURF_NAME "SURF_OCL"
|
||||
static Ptr<Feature2D> getSURF()
|
||||
{
|
||||
ocl::PlatformsInfo p;
|
||||
if(ocl::getOpenCLPlatforms(p) > 0)
|
||||
return new ocl::SURF_OCL;
|
||||
else
|
||||
return new SURF;
|
||||
}
|
||||
#else
|
||||
#define SURF_NAME "SURF"
|
||||
static Ptr<Feature2D> getSURF()
|
||||
{
|
||||
return new SURF;
|
||||
}
|
||||
#endif
|
||||
|
||||
/****************************************************************************************\
|
||||
@@ -984,7 +994,7 @@ TEST( Features2d_Detector_SIFT, regression )
|
||||
|
||||
TEST( Features2d_Detector_SURF, regression )
|
||||
{
|
||||
CV_FeatureDetectorTest test( "detector-surf", FeatureDetector::create(SURF_NAME) );
|
||||
CV_FeatureDetectorTest test( "detector-surf", Ptr<FeatureDetector>(getSURF()) );
|
||||
test.safe_run();
|
||||
}
|
||||
|
||||
@@ -1001,7 +1011,7 @@ TEST( Features2d_DescriptorExtractor_SIFT, regression )
|
||||
TEST( Features2d_DescriptorExtractor_SURF, regression )
|
||||
{
|
||||
CV_DescriptorExtractorTest<L2<float> > test( "descriptor-surf", 0.05f,
|
||||
DescriptorExtractor::create(SURF_NAME) );
|
||||
Ptr<DescriptorExtractor>(getSURF()) );
|
||||
test.safe_run();
|
||||
}
|
||||
|
||||
@@ -1042,10 +1052,10 @@ TEST(Features2d_BruteForceDescriptorMatcher_knnMatch, regression)
|
||||
const int sz = 100;
|
||||
const int k = 3;
|
||||
|
||||
Ptr<DescriptorExtractor> ext = DescriptorExtractor::create(SURF_NAME);
|
||||
Ptr<DescriptorExtractor> ext = Ptr<DescriptorExtractor>(getSURF());
|
||||
ASSERT_TRUE(ext != NULL);
|
||||
|
||||
Ptr<FeatureDetector> det = FeatureDetector::create(SURF_NAME);
|
||||
Ptr<FeatureDetector> det = Ptr<FeatureDetector>(getSURF());
|
||||
//"%YAML:1.0\nhessianThreshold: 8000.\noctaves: 3\noctaveLayers: 4\nupright: 0\n"
|
||||
ASSERT_TRUE(det != NULL);
|
||||
|
||||
@@ -1102,7 +1112,11 @@ public:
|
||||
protected:
|
||||
void run(int)
|
||||
{
|
||||
Ptr<Feature2D> f = Algorithm::create<Feature2D>("Feature2D." + fname);
|
||||
Ptr<Feature2D> f;
|
||||
if(fname == "SURF")
|
||||
f = getSURF();
|
||||
else
|
||||
f = Algorithm::create<Feature2D>("Feature2D." + fname);
|
||||
if(f.empty())
|
||||
return;
|
||||
string path = string(ts->get_data_path()) + "detectors_descriptors_evaluation/planar/";
|
||||
@@ -1150,7 +1164,7 @@ protected:
|
||||
};
|
||||
|
||||
TEST(Features2d_SIFTHomographyTest, regression) { CV_DetectPlanarTest test("SIFT", 80); test.safe_run(); }
|
||||
TEST(Features2d_SURFHomographyTest, regression) { CV_DetectPlanarTest test(SURF_NAME, 80); test.safe_run(); }
|
||||
TEST(Features2d_SURFHomographyTest, regression) { CV_DetectPlanarTest test("SURF", 80); test.safe_run(); }
|
||||
|
||||
class FeatureDetectorUsingMaskTest : public cvtest::BaseTest
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user