Skip to content

Commit 5f20e80

Browse files
hrnralalek
authored andcommitted
Merge pull request opencv#8869 from hrnr:akaze_part1
[GSOC] Speeding-up AKAZE, part opencv#1 (opencv#8869) * ts: expand arguments before stringifications in CV_ENUM and CV_FLAGS added protective macros to always force macro expansion of arguments. This allows using CV_ENUM and CV_FLAGS with macro arguments. * feature2d: unify perf test use the same test for all detectors/descriptors we have. * added AKAZE tests * features2d: extend perf tests * add BRISK, KAZE, MSER * run all extract tests on AKAZE keypoints, so that the test si more comparable for the speed of extraction * feature2d: rework opencl perf tests use the same configuration as cpu tests * feature2d: fix descriptors allocation for AKAZE and KAZE fix crash when descriptors are UMat * feature2d: name enum to fix build with older gcc * Revert "ts: expand arguments before stringifications in CV_ENUM and CV_FLAGS" This reverts commit 19538ca. This wasn't a great idea after all. There is a lot of flags implemented as #define, that we don't want to expand. * feature2d: fix expansion problems with CV_ENUM in perf * expand arguments before passing them to CV_ENUM. This does not need modifications of CV_ENUM. * added include guards to `perf_feature2d.hpp` * feature2d: fix crash in AKAZE when using KAZE descriptors * out-of-bound access in Get_MSURF_Descriptor_64 * this happened reliably when running on provided keypoints (not computed by the same instance) * feature2d: added regression tests for AKAZE * test with both MLDB and KAZE keypoints * feature2d: do not compute keypoints orientation twice * always compute keypoints orientation, when computing keypoints * do not recompute keypoint orientation when computing descriptors this allows to test detection and extraction separately * features2d: fix crash in AKAZE * out-of-bound reads near the image edge * same as the bug in KAZE descriptors * feature2d: refactor invariance testing * split detectors and descriptors tests * rewrite to google test to simplify debugging * add tests for AKAZE and one test for ORB * stitching: add tests with AKAZE feature finder * added basic stitching cpu and ocl tests * fix bug in AKAZE wrapper for stitching pipeline causing lots of ! OPENCV warning: getUMat()/getMat() call chain possible problem. ! Base object is dead, while nested/derived object is still alive or processed. ! Please check lifetime of UMat/Mat objects!
1 parent 437ca0b commit 5f20e80

21 files changed

+849
-1085
lines changed

modules/features2d/perf/opencl/perf_fast.cpp

Lines changed: 0 additions & 47 deletions
This file was deleted.
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
#include "../perf_precomp.hpp"
2+
#include "opencv2/ts/ocl_perf.hpp"
3+
#include "../perf_feature2d.hpp"
4+
5+
#ifdef HAVE_OPENCL
6+
7+
namespace cvtest {
8+
namespace ocl {
9+
10+
OCL_PERF_TEST_P(feature2d, detect, testing::Combine(Feature2DType::all(), TEST_IMAGES))
11+
{
12+
Ptr<Feature2D> detector = getFeature2D(get<0>(GetParam()));
13+
std::string filename = getDataPath(get<1>(GetParam()));
14+
Mat mimg = imread(filename, IMREAD_GRAYSCALE);
15+
16+
ASSERT_FALSE(mimg.empty());
17+
ASSERT_TRUE(detector);
18+
19+
UMat img, mask;
20+
mimg.copyTo(img);
21+
declare.in(img);
22+
vector<KeyPoint> points;
23+
24+
OCL_TEST_CYCLE() detector->detect(img, points, mask);
25+
26+
EXPECT_GT(points.size(), 20u);
27+
SANITY_CHECK_NOTHING();
28+
}
29+
30+
OCL_PERF_TEST_P(feature2d, extract, testing::Combine(testing::Values(DETECTORS_EXTRACTORS), TEST_IMAGES))
31+
{
32+
Ptr<Feature2D> detector = AKAZE::create();
33+
Ptr<Feature2D> extractor = getFeature2D(get<0>(GetParam()));
34+
std::string filename = getDataPath(get<1>(GetParam()));
35+
Mat mimg = imread(filename, IMREAD_GRAYSCALE);
36+
37+
ASSERT_FALSE(mimg.empty());
38+
ASSERT_TRUE(extractor);
39+
40+
UMat img, mask;
41+
mimg.copyTo(img);
42+
declare.in(img);
43+
vector<KeyPoint> points;
44+
detector->detect(img, points, mask);
45+
46+
EXPECT_GT(points.size(), 20u);
47+
48+
UMat descriptors;
49+
50+
OCL_TEST_CYCLE() extractor->compute(img, points, descriptors);
51+
52+
EXPECT_EQ((size_t)descriptors.rows, points.size());
53+
SANITY_CHECK_NOTHING();
54+
}
55+
56+
OCL_PERF_TEST_P(feature2d, detectAndExtract, testing::Combine(testing::Values(DETECTORS_EXTRACTORS), TEST_IMAGES))
57+
{
58+
Ptr<Feature2D> detector = getFeature2D(get<0>(GetParam()));
59+
std::string filename = getDataPath(get<1>(GetParam()));
60+
Mat mimg = imread(filename, IMREAD_GRAYSCALE);
61+
62+
ASSERT_FALSE(mimg.empty());
63+
ASSERT_TRUE(detector);
64+
65+
UMat img, mask;
66+
mimg.copyTo(img);
67+
declare.in(img);
68+
vector<KeyPoint> points;
69+
UMat descriptors;
70+
71+
OCL_TEST_CYCLE() detector->detectAndCompute(img, mask, points, descriptors, false);
72+
73+
EXPECT_GT(points.size(), 20u);
74+
EXPECT_EQ((size_t)descriptors.rows, points.size());
75+
SANITY_CHECK_NOTHING();
76+
}
77+
78+
} // ocl
79+
} // cvtest
80+
81+
#endif // HAVE_OPENCL

modules/features2d/perf/opencl/perf_orb.cpp

Lines changed: 0 additions & 87 deletions
This file was deleted.

modules/features2d/perf/perf_agast.cpp

Lines changed: 0 additions & 42 deletions
This file was deleted.

modules/features2d/perf/perf_fast.cpp

Lines changed: 0 additions & 63 deletions
This file was deleted.
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
#include "perf_feature2d.hpp"
2+
3+
PERF_TEST_P(feature2d, detect, testing::Combine(Feature2DType::all(), TEST_IMAGES))
4+
{
5+
Ptr<Feature2D> detector = getFeature2D(get<0>(GetParam()));
6+
std::string filename = getDataPath(get<1>(GetParam()));
7+
Mat img = imread(filename, IMREAD_GRAYSCALE);
8+
9+
ASSERT_FALSE(img.empty());
10+
ASSERT_TRUE(detector);
11+
12+
declare.in(img);
13+
Mat mask;
14+
vector<KeyPoint> points;
15+
16+
TEST_CYCLE() detector->detect(img, points, mask);
17+
18+
EXPECT_GT(points.size(), 20u);
19+
SANITY_CHECK_NOTHING();
20+
}
21+
22+
PERF_TEST_P(feature2d, extract, testing::Combine(testing::Values(DETECTORS_EXTRACTORS), TEST_IMAGES))
23+
{
24+
Ptr<Feature2D> detector = AKAZE::create();
25+
Ptr<Feature2D> extractor = getFeature2D(get<0>(GetParam()));
26+
std::string filename = getDataPath(get<1>(GetParam()));
27+
Mat img = imread(filename, IMREAD_GRAYSCALE);
28+
29+
ASSERT_FALSE(img.empty());
30+
ASSERT_TRUE(extractor);
31+
32+
declare.in(img);
33+
Mat mask;
34+
vector<KeyPoint> points;
35+
detector->detect(img, points, mask);
36+
37+
EXPECT_GT(points.size(), 20u);
38+
39+
Mat descriptors;
40+
41+
TEST_CYCLE() extractor->compute(img, points, descriptors);
42+
43+
EXPECT_EQ((size_t)descriptors.rows, points.size());
44+
SANITY_CHECK_NOTHING();
45+
}
46+
47+
PERF_TEST_P(feature2d, detectAndExtract, testing::Combine(testing::Values(DETECTORS_EXTRACTORS), TEST_IMAGES))
48+
{
49+
Ptr<Feature2D> detector = getFeature2D(get<0>(GetParam()));
50+
std::string filename = getDataPath(get<1>(GetParam()));
51+
Mat img = imread(filename, IMREAD_GRAYSCALE);
52+
53+
ASSERT_FALSE(img.empty());
54+
ASSERT_TRUE(detector);
55+
56+
declare.in(img);
57+
Mat mask;
58+
vector<KeyPoint> points;
59+
Mat descriptors;
60+
61+
TEST_CYCLE() detector->detectAndCompute(img, mask, points, descriptors, false);
62+
63+
EXPECT_GT(points.size(), 20u);
64+
EXPECT_EQ((size_t)descriptors.rows, points.size());
65+
SANITY_CHECK_NOTHING();
66+
}

0 commit comments

Comments
 (0)