From fc06a2384b836dbdbf2d6229dc4281691c207cda Mon Sep 17 00:00:00 2001 From: Vadim Pisarevsky Date: Mon, 18 May 2015 19:01:00 +0300 Subject: [PATCH] added test for batch detection/descriptor extraction (http://code.opencv.org/issues/3943) --- .../test/test_descriptors_regression.cpp | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/modules/features2d/test/test_descriptors_regression.cpp b/modules/features2d/test/test_descriptors_regression.cpp index e40fe9fb11..4fe448728b 100644 --- a/modules/features2d/test/test_descriptors_regression.cpp +++ b/modules/features2d/test/test_descriptors_regression.cpp @@ -347,3 +347,31 @@ TEST( Features2d_DescriptorExtractor_AKAZE, regression ) Hamming(), AKAZE::create()); test.safe_run(); } + +TEST( Features2d_DescriptorExtractor, batch ) +{ + string path = string(cvtest::TS::ptr()->get_data_path() + "detectors_descriptors_evaluation/images_datasets/graf"); + vector imgs, descriptors; + vector > keypoints; + int i, n = 6; + Ptr orb = ORB::create(); + + for( i = 0; i < n; i++ ) + { + string imgname = format("%s/img%d.png", path.c_str(), i+1); + Mat img = imread(imgname, 0); + imgs.push_back(img); + } + + orb->detect(imgs, keypoints); + orb->compute(imgs, keypoints, descriptors); + + ASSERT_EQ((int)keypoints.size(), n); + ASSERT_EQ((int)descriptors.size(), n); + + for( i = 0; i < n; i++ ) + { + EXPECT_GT((int)keypoints[i].size(), 100); + EXPECT_GT(descriptors[i].rows, 100); + } +}