mirror of
https://github.com/opencv/opencv.git
synced 2024-11-30 06:10:02 +08:00
5f20e802d2
[GSOC] Speeding-up AKAZE, part #1 (#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 19538cac1e
.
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!
67 lines
1.8 KiB
C++
67 lines
1.8 KiB
C++
#include "perf_feature2d.hpp"
|
|
|
|
PERF_TEST_P(feature2d, detect, testing::Combine(Feature2DType::all(), TEST_IMAGES))
|
|
{
|
|
Ptr<Feature2D> detector = getFeature2D(get<0>(GetParam()));
|
|
std::string filename = getDataPath(get<1>(GetParam()));
|
|
Mat img = imread(filename, IMREAD_GRAYSCALE);
|
|
|
|
ASSERT_FALSE(img.empty());
|
|
ASSERT_TRUE(detector);
|
|
|
|
declare.in(img);
|
|
Mat mask;
|
|
vector<KeyPoint> points;
|
|
|
|
TEST_CYCLE() detector->detect(img, points, mask);
|
|
|
|
EXPECT_GT(points.size(), 20u);
|
|
SANITY_CHECK_NOTHING();
|
|
}
|
|
|
|
PERF_TEST_P(feature2d, extract, testing::Combine(testing::Values(DETECTORS_EXTRACTORS), TEST_IMAGES))
|
|
{
|
|
Ptr<Feature2D> detector = AKAZE::create();
|
|
Ptr<Feature2D> extractor = getFeature2D(get<0>(GetParam()));
|
|
std::string filename = getDataPath(get<1>(GetParam()));
|
|
Mat img = imread(filename, IMREAD_GRAYSCALE);
|
|
|
|
ASSERT_FALSE(img.empty());
|
|
ASSERT_TRUE(extractor);
|
|
|
|
declare.in(img);
|
|
Mat mask;
|
|
vector<KeyPoint> points;
|
|
detector->detect(img, points, mask);
|
|
|
|
EXPECT_GT(points.size(), 20u);
|
|
|
|
Mat descriptors;
|
|
|
|
TEST_CYCLE() extractor->compute(img, points, descriptors);
|
|
|
|
EXPECT_EQ((size_t)descriptors.rows, points.size());
|
|
SANITY_CHECK_NOTHING();
|
|
}
|
|
|
|
PERF_TEST_P(feature2d, detectAndExtract, testing::Combine(testing::Values(DETECTORS_EXTRACTORS), TEST_IMAGES))
|
|
{
|
|
Ptr<Feature2D> detector = getFeature2D(get<0>(GetParam()));
|
|
std::string filename = getDataPath(get<1>(GetParam()));
|
|
Mat img = imread(filename, IMREAD_GRAYSCALE);
|
|
|
|
ASSERT_FALSE(img.empty());
|
|
ASSERT_TRUE(detector);
|
|
|
|
declare.in(img);
|
|
Mat mask;
|
|
vector<KeyPoint> points;
|
|
Mat descriptors;
|
|
|
|
TEST_CYCLE() detector->detectAndCompute(img, mask, points, descriptors, false);
|
|
|
|
EXPECT_GT(points.size(), 20u);
|
|
EXPECT_EQ((size_t)descriptors.rows, points.size());
|
|
SANITY_CHECK_NOTHING();
|
|
}
|