From ca826f24d46a91ede9a75d0b7c1645c961db9db7 Mon Sep 17 00:00:00 2001 From: Jiri Horner Date: Fri, 9 Jun 2017 17:16:15 +0200 Subject: [PATCH] feature2d: added regression tests for AKAZE * test with both MLDB and KAZE keypoints --- .../test/test_descriptors_regression.cpp | 8 +++ .../test/test_detectors_regression.cpp | 7 +++ .../test_rotation_and_scale_invariance.cpp | 58 ++++++++++++++++++- 3 files changed, 71 insertions(+), 2 deletions(-) diff --git a/modules/features2d/test/test_descriptors_regression.cpp b/modules/features2d/test/test_descriptors_regression.cpp index 7f44bc2bdd..d6fd30d951 100644 --- a/modules/features2d/test/test_descriptors_regression.cpp +++ b/modules/features2d/test/test_descriptors_regression.cpp @@ -350,6 +350,14 @@ TEST( Features2d_DescriptorExtractor_AKAZE, regression ) test.safe_run(); } +TEST( Features2d_DescriptorExtractor_AKAZE_DESCRIPTOR_KAZE, regression ) +{ + CV_DescriptorExtractorTest< L2 > test( "descriptor-akaze-with-kaze-desc", 0.03f, + AKAZE::create(AKAZE::DESCRIPTOR_KAZE), + L2(), AKAZE::create(AKAZE::DESCRIPTOR_KAZE)); + test.safe_run(); +} + TEST( Features2d_DescriptorExtractor, batch ) { string path = string(cvtest::TS::ptr()->get_data_path() + "detectors_descriptors_evaluation/images_datasets/graf"); diff --git a/modules/features2d/test/test_detectors_regression.cpp b/modules/features2d/test/test_detectors_regression.cpp index 9b6d489535..895c6bfc63 100644 --- a/modules/features2d/test/test_detectors_regression.cpp +++ b/modules/features2d/test/test_detectors_regression.cpp @@ -302,6 +302,13 @@ TEST( Features2d_Detector_AKAZE, regression ) test.safe_run(); } +TEST( Features2d_Detector_AKAZE_DESCRIPTOR_KAZE, regression ) +{ + CV_FeatureDetectorTest test( "detector-akaze-with-kaze-desc", AKAZE::create(AKAZE::DESCRIPTOR_KAZE) ); + test.safe_run(); +} + + TEST( Features2d_Detector_AKAZE, detect_and_compute_split ) { Mat testImg(100, 100, CV_8U); diff --git a/modules/features2d/test/test_rotation_and_scale_invariance.cpp b/modules/features2d/test/test_rotation_and_scale_invariance.cpp index 072adc40df..5a5e59ce51 100644 --- a/modules/features2d/test/test_rotation_and_scale_invariance.cpp +++ b/modules/features2d/test/test_rotation_and_scale_invariance.cpp @@ -104,8 +104,12 @@ void rotateKeyPoints(const vector& src, const Mat& H, float angle, vec void scaleKeyPoints(const vector& src, vector& dst, float scale) { dst.resize(src.size()); - for(size_t i = 0; i < src.size(); i++) - dst[i] = KeyPoint(src[i].pt.x * scale, src[i].pt.y * scale, src[i].size * scale, src[i].angle); + for (size_t i = 0; i < src.size(); i++) { + dst[i] = src[i]; + dst[i].pt.x *= scale; + dst[i].pt.y *= scale; + dst[i].size *= scale; + } } static @@ -630,6 +634,22 @@ TEST(Features2d_RotationInvariance_Detector_ORB, regression) test.safe_run(); } +TEST(Features2d_RotationInvariance_Detector_AKAZE, regression) +{ + DetectorRotationInvarianceTest test(AKAZE::create(), + 0.5f, + 0.76f); + test.safe_run(); +} + +TEST(Features2d_RotationInvariance_Detector_AKAZE_DESCRIPTOR_KAZE, regression) +{ + DetectorRotationInvarianceTest test(AKAZE::create(AKAZE::DESCRIPTOR_KAZE), + 0.5f, + 0.76f); + test.safe_run(); +} + /* * Descriptors's rotation invariance check */ @@ -648,6 +668,20 @@ TEST(Features2d_RotationInvariance_Descriptor_ORB, regression) test.safe_run(); } +TEST(Features2d_RotationInvariance_Descriptor_AKAZE, regression) +{ + Ptr f2d = AKAZE::create(); + DescriptorRotationInvarianceTest test(f2d, f2d, f2d->defaultNorm(), 0.99f); + test.safe_run(); +} + +TEST(Features2d_RotationInvariance_Descriptor_AKAZE_DESCRIPTOR_KAZE, regression) +{ + Ptr f2d = AKAZE::create(AKAZE::DESCRIPTOR_KAZE); + DescriptorRotationInvarianceTest test(f2d, f2d, f2d->defaultNorm(), 0.99f); + test.safe_run(); +} + //TEST(Features2d_RotationInvariance_Descriptor_FREAK, regression) //{ // DescriptorRotationInvarianceTest test(Algorithm::create("Feature2D.ORB"), @@ -679,6 +713,12 @@ TEST(Features2d_ScaleInvariance_Detector_AKAZE, regression) test.safe_run(); } +TEST(Features2d_ScaleInvariance_Detector_AKAZE_DESCRIPTOR_KAZE, regression) +{ + DetectorScaleInvarianceTest test(AKAZE::create(AKAZE::DESCRIPTOR_KAZE), 0.08f, 0.49f); + test.safe_run(); +} + TEST(Features2d_ScaleInvariance_Detector_ORB, regression) { DetectorScaleInvarianceTest test(ORB::create(), 0.08f, 0.49f); @@ -689,6 +729,20 @@ TEST(Features2d_ScaleInvariance_Detector_ORB, regression) * Descriptor's scale invariance check */ +TEST(Features2d_ScaleInvariance_Descriptor_AKAZE, regression) +{ + Ptr akaze = AKAZE::create(); + DescriptorScaleInvarianceTest test(akaze, akaze, akaze->defaultNorm(), 0.01f); + test.safe_run(); +} + +TEST(Features2d_ScaleInvariance_Descriptor_AKAZE_DESCRIPTOR_KAZE, regression) +{ + Ptr akaze = AKAZE::create(AKAZE::DESCRIPTOR_KAZE); + DescriptorScaleInvarianceTest test(akaze, akaze, akaze->defaultNorm(), 0.01f); + test.safe_run(); +} + //TEST(Features2d_ScaleInvariance_Descriptor_BRISK, regression) //{ // DescriptorScaleInvarianceTest test(Algorithm::create("Feature2D.BRISK"),