vendor: OpenCV 5.0.0 snapshot at 755e50675d97db9b7d449d8bd6b09888646f6c6e
This commit is contained in:
@@ -0,0 +1,138 @@
|
||||
/*M///////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
|
||||
//
|
||||
// By downloading, copying, installing or using the software you agree to this license.
|
||||
// If you do not agree to this license, do not download, install,
|
||||
// copy or use the software.
|
||||
//
|
||||
//
|
||||
// License Agreement
|
||||
// For Open Source Computer Vision Library
|
||||
//
|
||||
// Copyright (C) 2000-2008, Intel Corporation, all rights reserved.
|
||||
// Copyright (C) 2009, Willow Garage Inc., all rights reserved.
|
||||
// Third party copyrights are property of their respective owners.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without modification,
|
||||
// are permitted provided that the following conditions are met:
|
||||
//
|
||||
// * Redistribution's of source code must retain the above copyright notice,
|
||||
// this list of conditions and the following disclaimer.
|
||||
//
|
||||
// * Redistribution's in binary form must reproduce the above copyright notice,
|
||||
// this list of conditions and the following disclaimer in the documentation
|
||||
// and/or other materials provided with the distribution.
|
||||
//
|
||||
// * The name of the copyright holders may not be used to endorse or promote products
|
||||
// derived from this software without specific prior written permission.
|
||||
//
|
||||
// This software is provided by the copyright holders and contributors "as is" and
|
||||
// any express or implied warranties, including, but not limited to, the implied
|
||||
// warranties of merchantability and fitness for a particular purpose are disclaimed.
|
||||
// In no event shall the Intel Corporation or contributors be liable for any direct,
|
||||
// indirect, incidental, special, exemplary, or consequential damages
|
||||
// (including, but not limited to, procurement of substitute goods or services;
|
||||
// loss of use, data, or profits; or business interruption) however caused
|
||||
// and on any theory of liability, whether in contract, strict liability,
|
||||
// or tort (including negligence or otherwise) arising in any way out of
|
||||
// the use of this software, even if advised of the possibility of such damage.
|
||||
//
|
||||
//M*/
|
||||
|
||||
#include "test_precomp.hpp"
|
||||
|
||||
namespace opencv_test { namespace {
|
||||
|
||||
class CV_AgastTest : public cvtest::BaseTest
|
||||
{
|
||||
public:
|
||||
CV_AgastTest();
|
||||
~CV_AgastTest();
|
||||
protected:
|
||||
void run(int);
|
||||
};
|
||||
|
||||
CV_AgastTest::CV_AgastTest() {}
|
||||
CV_AgastTest::~CV_AgastTest() {}
|
||||
|
||||
void CV_AgastTest::run( int )
|
||||
{
|
||||
for(int type=0; type <= 2; ++type) {
|
||||
Mat image1 = imread(string(ts->get_data_path()) + "inpaint/orig.png");
|
||||
Mat image2 = imread(string(ts->get_data_path()) + "cameracalibration/chess9.png");
|
||||
string xml = string(ts->get_data_path()) + format("agast/result%d.xml", type);
|
||||
|
||||
if (image1.empty() || image2.empty())
|
||||
{
|
||||
ts->set_failed_test_info( cvtest::TS::FAIL_INVALID_TEST_DATA );
|
||||
return;
|
||||
}
|
||||
|
||||
Mat gray1, gray2;
|
||||
cvtColor(image1, gray1, COLOR_BGR2GRAY);
|
||||
cvtColor(image2, gray2, COLOR_BGR2GRAY);
|
||||
|
||||
vector<KeyPoint> keypoints1;
|
||||
vector<KeyPoint> keypoints2;
|
||||
AGAST(gray1, keypoints1, 30, true, static_cast<AgastFeatureDetector::DetectorType>(type));
|
||||
AGAST(gray2, keypoints2, (type > 0 ? 30 : 20), true, static_cast<AgastFeatureDetector::DetectorType>(type));
|
||||
|
||||
for(size_t i = 0; i < keypoints1.size(); ++i)
|
||||
{
|
||||
const KeyPoint& kp = keypoints1[i];
|
||||
cv::circle(image1, kp.pt, cvRound(kp.size/2), Scalar(255, 0, 0));
|
||||
}
|
||||
|
||||
for(size_t i = 0; i < keypoints2.size(); ++i)
|
||||
{
|
||||
const KeyPoint& kp = keypoints2[i];
|
||||
cv::circle(image2, kp.pt, cvRound(kp.size/2), Scalar(255, 0, 0));
|
||||
}
|
||||
|
||||
Mat kps1(1, (int)(keypoints1.size() * sizeof(KeyPoint)), CV_8U, &keypoints1[0]);
|
||||
Mat kps2(1, (int)(keypoints2.size() * sizeof(KeyPoint)), CV_8U, &keypoints2[0]);
|
||||
|
||||
FileStorage fs(xml, FileStorage::READ);
|
||||
if (!fs.isOpened())
|
||||
{
|
||||
fs.open(xml, FileStorage::WRITE);
|
||||
if (!fs.isOpened())
|
||||
{
|
||||
ts->set_failed_test_info(cvtest::TS::FAIL_INVALID_TEST_DATA);
|
||||
return;
|
||||
}
|
||||
fs << "exp_kps1" << kps1;
|
||||
fs << "exp_kps2" << kps2;
|
||||
fs.release();
|
||||
fs.open(xml, FileStorage::READ);
|
||||
if (!fs.isOpened())
|
||||
{
|
||||
ts->set_failed_test_info(cvtest::TS::FAIL_INVALID_TEST_DATA);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
Mat exp_kps1, exp_kps2;
|
||||
read( fs["exp_kps1"], exp_kps1, Mat() );
|
||||
read( fs["exp_kps2"], exp_kps2, Mat() );
|
||||
fs.release();
|
||||
|
||||
if ( exp_kps1.size != kps1.size || 0 != cvtest::norm(exp_kps1, kps1, NORM_L2) ||
|
||||
exp_kps2.size != kps2.size || 0 != cvtest::norm(exp_kps2, kps2, NORM_L2))
|
||||
{
|
||||
ts->set_failed_test_info(cvtest::TS::FAIL_MISMATCH);
|
||||
return;
|
||||
}
|
||||
|
||||
/*cv::namedWindow("Img1"); cv::imshow("Img1", image1);
|
||||
cv::namedWindow("Img2"); cv::imshow("Img2", image2);
|
||||
cv::waitKey(0);*/
|
||||
}
|
||||
|
||||
ts->set_failed_test_info(cvtest::TS::OK);
|
||||
}
|
||||
|
||||
TEST(Features2d_AGAST, regression) { CV_AgastTest test; test.safe_run(); }
|
||||
|
||||
}} // namespace
|
||||
@@ -0,0 +1,48 @@
|
||||
// This file is part of OpenCV project.
|
||||
// It is subject to the license terms in the LICENSE file found in the top-level directory
|
||||
// of this distribution and at http://opencv.org/license.html
|
||||
|
||||
#include "test_precomp.hpp"
|
||||
|
||||
namespace opencv_test { namespace {
|
||||
|
||||
TEST(Features2d_AKAZE, detect_and_compute_split)
|
||||
{
|
||||
Mat testImg(100, 100, CV_8U);
|
||||
RNG rng(101);
|
||||
rng.fill(testImg, RNG::UNIFORM, Scalar(0), Scalar(255), true);
|
||||
|
||||
Ptr<Feature2D> ext = AKAZE::create(AKAZE::DESCRIPTOR_MLDB, 0, 3, 0.001f, 1, 1, KAZE::DIFF_PM_G2);
|
||||
vector<KeyPoint> detAndCompKps;
|
||||
Mat desc;
|
||||
ext->detectAndCompute(testImg, noArray(), detAndCompKps, desc);
|
||||
|
||||
vector<KeyPoint> detKps;
|
||||
ext->detect(testImg, detKps);
|
||||
|
||||
ASSERT_EQ(detKps.size(), detAndCompKps.size());
|
||||
|
||||
for(size_t i = 0; i < detKps.size(); i++)
|
||||
ASSERT_EQ(detKps[i].hash(), detAndCompKps[i].hash());
|
||||
}
|
||||
|
||||
/**
|
||||
* This test is here to guard propagation of NaNs that happens on this image. NaNs are guarded
|
||||
* by debug asserts in AKAZE, which should fire for you if you are lucky.
|
||||
*
|
||||
* This test also reveals problems with uninitialized memory that happens only on this image.
|
||||
* This is very hard to hit and depends a lot on particular allocator. Run this test in valgrind and check
|
||||
* for uninitialized values if you think you are hitting this problem again.
|
||||
*/
|
||||
TEST(Features2d_AKAZE, uninitialized_and_nans)
|
||||
{
|
||||
Mat b1 = imread(cvtest::TS::ptr()->get_data_path() + "../stitching/b1.png");
|
||||
ASSERT_FALSE(b1.empty());
|
||||
|
||||
vector<KeyPoint> keypoints;
|
||||
Mat desc;
|
||||
Ptr<Feature2D> akaze = AKAZE::create();
|
||||
akaze->detectAndCompute(b1, noArray(), keypoints, desc);
|
||||
}
|
||||
|
||||
}} // namespace
|
||||
@@ -0,0 +1,108 @@
|
||||
/*M///////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
|
||||
//
|
||||
// By downloading, copying, installing or using the software you agree to this license.
|
||||
// If you do not agree to this license, do not download, install,
|
||||
// copy or use the software.
|
||||
//
|
||||
//
|
||||
// License Agreement
|
||||
// For Open Source Computer Vision Library
|
||||
//
|
||||
// Copyright (C) 2000-2008, Intel Corporation, all rights reserved.
|
||||
// Copyright (C) 2009, Willow Garage Inc., all rights reserved.
|
||||
// Third party copyrights are property of their respective owners.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without modification,
|
||||
// are permitted provided that the following conditions are met:
|
||||
//
|
||||
// * Redistribution's of source code must retain the above copyright notice,
|
||||
// this list of conditions and the following disclaimer.
|
||||
//
|
||||
// * Redistribution's in binary form must reproduce the above copyright notice,
|
||||
// this list of conditions and the following disclaimer in the documentation
|
||||
// and/or other materials provided with the distribution.
|
||||
//
|
||||
// * The name of the copyright holders may not be used to endorse or promote products
|
||||
// derived from this software without specific prior written permission.
|
||||
//
|
||||
// This software is provided by the copyright holders and contributors "as is" and
|
||||
// any express or implied warranties, including, but not limited to, the implied
|
||||
// warranties of merchantability and fitness for a particular purpose are disclaimed.
|
||||
// In no event shall the Intel Corporation or contributors be liable for any direct,
|
||||
// indirect, incidental, special, exemplary, or consequential damages
|
||||
// (including, but not limited to, procurement of substitute goods or services;
|
||||
// loss of use, data, or profits; or business interruption) however caused
|
||||
// and on any theory of liability, whether in contract, strict liability,
|
||||
// or tort (including negligence or otherwise) arising in any way out of
|
||||
// the use of this software, even if advised of the possibility of such damage.
|
||||
//
|
||||
//M*/
|
||||
|
||||
#include "test_precomp.hpp"
|
||||
|
||||
namespace opencv_test { namespace {
|
||||
|
||||
class CV_BRISKTest : public cvtest::BaseTest
|
||||
{
|
||||
public:
|
||||
CV_BRISKTest();
|
||||
~CV_BRISKTest();
|
||||
protected:
|
||||
void run(int);
|
||||
};
|
||||
|
||||
CV_BRISKTest::CV_BRISKTest() {}
|
||||
CV_BRISKTest::~CV_BRISKTest() {}
|
||||
|
||||
void CV_BRISKTest::run( int )
|
||||
{
|
||||
Mat image1 = imread(string(ts->get_data_path()) + "inpaint/orig.png");
|
||||
Mat image2 = imread(string(ts->get_data_path()) + "cameracalibration/chess9.png");
|
||||
|
||||
if (image1.empty() || image2.empty())
|
||||
{
|
||||
ts->set_failed_test_info( cvtest::TS::FAIL_INVALID_TEST_DATA );
|
||||
return;
|
||||
}
|
||||
|
||||
Mat gray1, gray2;
|
||||
cvtColor(image1, gray1, COLOR_BGR2GRAY);
|
||||
cvtColor(image2, gray2, COLOR_BGR2GRAY);
|
||||
|
||||
Ptr<FeatureDetector> detector = BRISK::create();
|
||||
|
||||
// Check parameter get/set functions.
|
||||
BRISK* detectorTyped = dynamic_cast<BRISK*>(detector.get());
|
||||
ASSERT_NE(nullptr, detectorTyped);
|
||||
detectorTyped->setOctaves(3);
|
||||
detectorTyped->setThreshold(30);
|
||||
ASSERT_EQ(detectorTyped->getOctaves(), 3);
|
||||
ASSERT_EQ(detectorTyped->getThreshold(), 30);
|
||||
detectorTyped->setOctaves(4);
|
||||
detectorTyped->setThreshold(29);
|
||||
ASSERT_EQ(detectorTyped->getOctaves(), 4);
|
||||
ASSERT_EQ(detectorTyped->getThreshold(), 29);
|
||||
|
||||
vector<KeyPoint> keypoints1;
|
||||
vector<KeyPoint> keypoints2;
|
||||
detector->detect(image1, keypoints1);
|
||||
detector->detect(image2, keypoints2);
|
||||
|
||||
for(size_t i = 0; i < keypoints1.size(); ++i)
|
||||
{
|
||||
const KeyPoint& kp = keypoints1[i];
|
||||
ASSERT_NE(kp.angle, -1);
|
||||
}
|
||||
|
||||
for(size_t i = 0; i < keypoints2.size(); ++i)
|
||||
{
|
||||
const KeyPoint& kp = keypoints2[i];
|
||||
ASSERT_NE(kp.angle, -1);
|
||||
}
|
||||
}
|
||||
|
||||
TEST(Features2d_BRISK, regression) { CV_BRISKTest test; test.safe_run(); }
|
||||
|
||||
}} // namespace
|
||||
@@ -0,0 +1,304 @@
|
||||
/*M///////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
|
||||
//
|
||||
// By downloading, copying, installing or using the software you agree to this license.
|
||||
// If you do not agree to this license, do not download, install,
|
||||
// copy or use the software.
|
||||
//
|
||||
//
|
||||
// License Agreement
|
||||
// For Open Source Computer Vision Library
|
||||
//
|
||||
// Copyright (C) 2000-2008, Intel Corporation, all rights reserved.
|
||||
// Copyright (C) 2009, Willow Garage Inc., all rights reserved.
|
||||
// Third party copyrights are property of their respective owners.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without modification,
|
||||
// are permitted provided that the following conditions are met:
|
||||
//
|
||||
// * Redistribution's of source code must retain the above copyright notice,
|
||||
// this list of conditions and the following disclaimer.
|
||||
//
|
||||
// * Redistribution's in binary form must reproduce the above copyright notice,
|
||||
// this list of conditions and the following disclaimer in the documentation
|
||||
// and/or other materials provided with the distribution.
|
||||
//
|
||||
// * The name of the copyright holders may not be used to endorse or promote products
|
||||
// derived from this software without specific prior written permission.
|
||||
//
|
||||
// This software is provided by the copyright holders and contributors "as is" and
|
||||
// any express or implied warranties, including, but not limited to, the implied
|
||||
// warranties of merchantability and fitness for a particular purpose are disclaimed.
|
||||
// In no event shall the Intel Corporation or contributors be liable for any direct,
|
||||
// indirect, incidental, special, exemplary, or consequential damages
|
||||
// (including, but not limited to, procurement of substitute goods or services;
|
||||
// loss of use, data, or profits; or business interruption) however caused
|
||||
// and on any theory of liability, whether in contract, strict liability,
|
||||
// or tort (including negligence or otherwise) arising in any way out of
|
||||
// the use of this software, even if advised of the possibility of such damage.
|
||||
//
|
||||
//M*/
|
||||
|
||||
#include "test_precomp.hpp"
|
||||
|
||||
namespace opencv_test { namespace {
|
||||
|
||||
class CV_DetectorsTest : public cvtest::BaseTest
|
||||
{
|
||||
public:
|
||||
CV_DetectorsTest();
|
||||
~CV_DetectorsTest();
|
||||
protected:
|
||||
void run(int);
|
||||
bool testDetector(const Mat& img, Ptr<Feature2D> detector, vector<KeyPoint>& expected);
|
||||
|
||||
void LoadExpected(const string& file, vector<KeyPoint>& out);
|
||||
};
|
||||
|
||||
CV_DetectorsTest::CV_DetectorsTest()
|
||||
{
|
||||
}
|
||||
CV_DetectorsTest::~CV_DetectorsTest() {}
|
||||
|
||||
void getRotation(const Mat& img, Mat& aff, Mat& out)
|
||||
{
|
||||
Point center(img.cols/2, img.rows/2);
|
||||
aff = getRotationMatrix2D(center, 30, 1);
|
||||
warpAffine( img, out, aff, img.size());
|
||||
}
|
||||
|
||||
void getZoom(const Mat& img, Mat& aff, Mat& out)
|
||||
{
|
||||
const double mult = 1.2;
|
||||
|
||||
aff.create(2, 3, CV_64F);
|
||||
double *data = aff.ptr<double>();
|
||||
data[0] = mult; data[1] = 0; data[2] = 0;
|
||||
data[3] = 0; data[4] = mult; data[5] = 0;
|
||||
|
||||
warpAffine( img, out, aff, img.size());
|
||||
}
|
||||
|
||||
void getBlur(const Mat& img, Mat& aff, Mat& out)
|
||||
{
|
||||
aff.create(2, 3, CV_64F);
|
||||
double *data = aff.ptr<double>();
|
||||
data[0] = 1; data[1] = 0; data[2] = 0;
|
||||
data[3] = 0; data[4] = 1; data[5] = 0;
|
||||
|
||||
GaussianBlur(img, out, Size(5, 5), 2);
|
||||
}
|
||||
|
||||
void getBrightness(const Mat& img, Mat& aff, Mat& out)
|
||||
{
|
||||
aff.create(2, 3, CV_64F);
|
||||
double *data = aff.ptr<double>();
|
||||
data[0] = 1; data[1] = 0; data[2] = 0;
|
||||
data[3] = 0; data[4] = 1; data[5] = 0;
|
||||
|
||||
cv::add(img, Mat(img.size(), img.type(), Scalar(15)), out);
|
||||
}
|
||||
|
||||
#if 0
|
||||
void showOrig(const Mat& img, const vector<KeyPoint>& orig_pts)
|
||||
{
|
||||
|
||||
Mat img_color;
|
||||
cvtColor(img, img_color, COLOR_GRAY2BGR);
|
||||
|
||||
for(size_t i = 0; i < orig_pts.size(); ++i)
|
||||
circle(img_color, orig_pts[i].pt, (int)orig_pts[i].size/2, Scalar(0, 255, 0));
|
||||
|
||||
namedWindow("O"); imshow("O", img_color);
|
||||
}
|
||||
|
||||
void show(const string& name, const Mat& new_img, const vector<KeyPoint>& new_pts, const vector<KeyPoint>& transf_pts)
|
||||
{
|
||||
|
||||
Mat new_img_color;
|
||||
cvtColor(new_img, new_img_color, COLOR_GRAY2BGR);
|
||||
|
||||
for(size_t i = 0; i < transf_pts.size(); ++i)
|
||||
circle(new_img_color, transf_pts[i].pt, (int)transf_pts[i].size/2, Scalar(255, 0, 0));
|
||||
|
||||
for(size_t i = 0; i < new_pts.size(); ++i)
|
||||
circle(new_img_color, new_pts[i].pt, (int)new_pts[i].size/2, Scalar(0, 0, 255));
|
||||
|
||||
namedWindow(name + "_T"); imshow(name + "_T", new_img_color);
|
||||
}
|
||||
#endif
|
||||
|
||||
struct WrapPoint
|
||||
{
|
||||
const double* R;
|
||||
WrapPoint(const Mat& rmat) : R(rmat.ptr<double>()) { };
|
||||
|
||||
KeyPoint operator()(const KeyPoint& kp) const
|
||||
{
|
||||
KeyPoint res = kp;
|
||||
res.pt.x = static_cast<float>(kp.pt.x * R[0] + kp.pt.y * R[1] + R[2]);
|
||||
res.pt.y = static_cast<float>(kp.pt.x * R[3] + kp.pt.y * R[4] + R[5]);
|
||||
return res;
|
||||
}
|
||||
};
|
||||
|
||||
struct sortByR { bool operator()(const KeyPoint& kp1, const KeyPoint& kp2) { return cv::norm(kp1.pt) < cv::norm(kp2.pt); } };
|
||||
|
||||
bool CV_DetectorsTest::testDetector(const Mat& img, Ptr<Feature2D> detector, vector<KeyPoint>& exp)
|
||||
{
|
||||
vector<KeyPoint> orig_kpts;
|
||||
detector->detect(img, orig_kpts);
|
||||
|
||||
typedef void (*TransfFunc )(const Mat&, Mat&, Mat& FransfFunc);
|
||||
const TransfFunc transfFunc[] = { getRotation, getZoom, getBlur, getBrightness };
|
||||
//const string names[] = { "Rotation", "Zoom", "Blur", "Brightness" };
|
||||
const size_t case_num = sizeof(transfFunc)/sizeof(transfFunc[0]);
|
||||
|
||||
vector<Mat> affs(case_num);
|
||||
vector<Mat> new_imgs(case_num);
|
||||
|
||||
vector< vector<KeyPoint> > new_kpts(case_num);
|
||||
vector< vector<KeyPoint> > transf_kpts(case_num);
|
||||
|
||||
//showOrig(img, orig_kpts);
|
||||
for(size_t i = 0; i < case_num; ++i)
|
||||
{
|
||||
transfFunc[i](img, affs[i], new_imgs[i]);
|
||||
detector->detect(new_imgs[i], new_kpts[i]);
|
||||
transform(orig_kpts.begin(), orig_kpts.end(), back_inserter(transf_kpts[i]), WrapPoint(affs[i]));
|
||||
//show(names[i], new_imgs[i], new_kpts[i], transf_kpts[i]);
|
||||
}
|
||||
|
||||
const float thres = 3;
|
||||
const float nthres = 3;
|
||||
|
||||
vector<KeyPoint> result;
|
||||
for(size_t i = 0; i < orig_kpts.size(); ++i)
|
||||
{
|
||||
const KeyPoint& okp = orig_kpts[i];
|
||||
int foundCounter = 0;
|
||||
for(size_t j = 0; j < case_num; ++j)
|
||||
{
|
||||
const KeyPoint& tkp = transf_kpts[j][i];
|
||||
|
||||
size_t k = 0;
|
||||
|
||||
for(; k < new_kpts[j].size(); ++k)
|
||||
if (cv::norm(new_kpts[j][k].pt - tkp.pt) < nthres && fabs(new_kpts[j][k].size - tkp.size) < thres)
|
||||
break;
|
||||
|
||||
if (k != new_kpts[j].size())
|
||||
++foundCounter;
|
||||
|
||||
}
|
||||
if (foundCounter == (int)case_num)
|
||||
result.push_back(okp);
|
||||
}
|
||||
|
||||
sort(result.begin(), result.end(), sortByR());
|
||||
sort(exp.begin(), exp.end(), sortByR());
|
||||
|
||||
if (result.size() != exp.size())
|
||||
{
|
||||
ts->set_failed_test_info(cvtest::TS::FAIL_INVALID_TEST_DATA);
|
||||
return false;
|
||||
}
|
||||
|
||||
int foundCounter1 = 0;
|
||||
for(size_t i = 0; i < exp.size(); ++i)
|
||||
{
|
||||
const KeyPoint& e = exp[i];
|
||||
size_t j = 0;
|
||||
for(; j < result.size(); ++j)
|
||||
{
|
||||
const KeyPoint& r = result[i];
|
||||
if (cv::norm(r.pt-e.pt) < nthres && fabs(r.size - e.size) < thres)
|
||||
break;
|
||||
}
|
||||
if (j != result.size())
|
||||
++foundCounter1;
|
||||
}
|
||||
|
||||
int foundCounter2 = 0;
|
||||
for(size_t i = 0; i < result.size(); ++i)
|
||||
{
|
||||
const KeyPoint& r = result[i];
|
||||
size_t j = 0;
|
||||
for(; j < exp.size(); ++j)
|
||||
{
|
||||
const KeyPoint& e = exp[i];
|
||||
if (cv::norm(r.pt-e.pt) < nthres && fabs(r.size - e.size) < thres)
|
||||
break;
|
||||
}
|
||||
if (j != exp.size())
|
||||
++foundCounter2;
|
||||
}
|
||||
//showOrig(img, result); waitKey();
|
||||
|
||||
const float errorRate = 0.9f;
|
||||
if (float(foundCounter1)/exp.size() < errorRate || float(foundCounter2)/result.size() < errorRate)
|
||||
{
|
||||
ts->set_failed_test_info( cvtest::TS::FAIL_MISMATCH);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void CV_DetectorsTest::LoadExpected(const string& file, vector<KeyPoint>& out)
|
||||
{
|
||||
Mat mat_exp;
|
||||
FileStorage fs(file, FileStorage::READ);
|
||||
if (fs.isOpened())
|
||||
{
|
||||
read( fs["ResultVectorData"], mat_exp, Mat() );
|
||||
out.resize(mat_exp.cols / sizeof(KeyPoint));
|
||||
copy(mat_exp.ptr<KeyPoint>(), mat_exp.ptr<KeyPoint>() + out.size(), out.begin());
|
||||
}
|
||||
else
|
||||
{
|
||||
ts->set_failed_test_info( cvtest::TS::FAIL_INVALID_TEST_DATA);
|
||||
out.clear();
|
||||
}
|
||||
}
|
||||
|
||||
void CV_DetectorsTest::run( int /*start_from*/ )
|
||||
{
|
||||
Mat img = imread(string(ts->get_data_path()) + "shared/graffiti.png", 0);
|
||||
|
||||
if (img.empty())
|
||||
{
|
||||
ts->set_failed_test_info( cvtest::TS::FAIL_INVALID_TEST_DATA );
|
||||
return;
|
||||
}
|
||||
|
||||
Mat to_test(img.size() * 2, img.type(), Scalar(0));
|
||||
Mat roi = to_test(Rect(img.rows/2, img.cols/2, img.cols, img.rows));
|
||||
img.copyTo(roi);
|
||||
GaussianBlur(to_test, to_test, Size(3, 3), 1.5);
|
||||
|
||||
vector<KeyPoint> exp;
|
||||
|
||||
#ifdef OPENCV_ENABLE_NONFREE
|
||||
LoadExpected(string(ts->get_data_path()) + "detectors/surf.xml", exp);
|
||||
if (exp.empty())
|
||||
return;
|
||||
|
||||
if (!testDetector(to_test, SURF::create(1536+512+512, 2, 2, true, false), exp))
|
||||
return;
|
||||
#endif
|
||||
|
||||
LoadExpected(string(ts->get_data_path()) + "detectors/star.xml", exp);
|
||||
if (exp.empty())
|
||||
return;
|
||||
|
||||
if (!testDetector(to_test, StarDetector::create(45, 30, 10, 8, 5), exp))
|
||||
return;
|
||||
|
||||
ts->set_failed_test_info( cvtest::TS::OK);
|
||||
}
|
||||
|
||||
// BUG:
|
||||
TEST(Features2d_Detectors, DISABLED_regression) { CV_DetectorsTest test; test.safe_run(); }
|
||||
|
||||
}} // namespace
|
||||
@@ -0,0 +1,73 @@
|
||||
// This file is part of OpenCV project.
|
||||
// It is subject to the license terms in the LICENSE file found in the top-level directory
|
||||
// of this distribution and at http://opencv.org/license.html
|
||||
|
||||
#include "test_precomp.hpp"
|
||||
#include "cvconfig.h"
|
||||
#include "opencv2/ts/ocl_test.hpp"
|
||||
#include <functional>
|
||||
|
||||
#ifdef HAVE_OPENCL
|
||||
|
||||
namespace opencv_test {
|
||||
namespace ocl {
|
||||
|
||||
#define TEST_IMAGES testing::Values(\
|
||||
"detectors_descriptors_evaluation/images_datasets/leuven/img1.png",\
|
||||
"../stitching/a3.png", \
|
||||
"../stitching/s2.jpg")
|
||||
|
||||
PARAM_TEST_CASE(Feature2DFixture, std::function<Ptr<Feature2D>()>, std::string)
|
||||
{
|
||||
std::string filename;
|
||||
Mat image, descriptors;
|
||||
vector<KeyPoint> keypoints;
|
||||
UMat uimage, udescriptors;
|
||||
vector<KeyPoint> ukeypoints;
|
||||
Ptr<Feature2D> feature;
|
||||
|
||||
virtual void SetUp()
|
||||
{
|
||||
feature = GET_PARAM(0)();
|
||||
filename = GET_PARAM(1);
|
||||
|
||||
image = readImage(filename);
|
||||
|
||||
ASSERT_FALSE(image.empty());
|
||||
|
||||
image.copyTo(uimage);
|
||||
|
||||
OCL_OFF(feature->detect(image, keypoints));
|
||||
OCL_ON(feature->detect(uimage, ukeypoints));
|
||||
// note: we use keypoints from CPU for GPU too, to test descriptors separately
|
||||
OCL_OFF(feature->compute(image, keypoints, descriptors));
|
||||
OCL_ON(feature->compute(uimage, keypoints, udescriptors));
|
||||
}
|
||||
};
|
||||
|
||||
OCL_TEST_P(Feature2DFixture, KeypointsSame)
|
||||
{
|
||||
EXPECT_EQ(keypoints.size(), ukeypoints.size());
|
||||
|
||||
for (size_t i = 0; i < keypoints.size(); ++i)
|
||||
{
|
||||
EXPECT_GE(KeyPoint::overlap(keypoints[i], ukeypoints[i]), 0.95);
|
||||
EXPECT_NEAR(keypoints[i].angle, ukeypoints[i].angle, 0.05);
|
||||
}
|
||||
}
|
||||
|
||||
OCL_TEST_P(Feature2DFixture, DescriptorsSame)
|
||||
{
|
||||
EXPECT_MAT_NEAR(descriptors, udescriptors, 0.001);
|
||||
}
|
||||
|
||||
OCL_INSTANTIATE_TEST_CASE_P(AKAZE, Feature2DFixture,
|
||||
testing::Combine(testing::Values([]() { return AKAZE::create(); }), TEST_IMAGES));
|
||||
|
||||
OCL_INSTANTIATE_TEST_CASE_P(AKAZE_DESCRIPTOR_KAZE, Feature2DFixture,
|
||||
testing::Combine(testing::Values([]() { return AKAZE::create(AKAZE::DESCRIPTOR_KAZE); }), TEST_IMAGES));
|
||||
|
||||
}//ocl
|
||||
}//cvtest
|
||||
|
||||
#endif //HAVE_OPENCL
|
||||
@@ -0,0 +1,599 @@
|
||||
/*M///////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
|
||||
//
|
||||
// By downloading, copying, installing or using the software you agree to this license.
|
||||
// If you do not agree to this license, do not download, install,
|
||||
// copy or use the software.
|
||||
//
|
||||
//
|
||||
// Intel License Agreement
|
||||
// For Open Source Computer Vision Library
|
||||
//
|
||||
// Copyright (C) 2000, Intel Corporation, all rights reserved.
|
||||
// Third party copyrights are property of their respective owners.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without modification,
|
||||
// are permitted provided that the following conditions are met:
|
||||
//
|
||||
// * Redistribution's of source code must retain the above copyright notice,
|
||||
// this list of conditions and the following disclaimer.
|
||||
//
|
||||
// * Redistribution's in binary form must reproduce the above copyright notice,
|
||||
// this list of conditions and the following disclaimer in the documentation
|
||||
// and/or other materials provided with the distribution.
|
||||
//
|
||||
// * The name of Intel Corporation may not be used to endorse or promote products
|
||||
// derived from this software without specific prior written permission.
|
||||
//
|
||||
// This software is provided by the copyright holders and contributors "as is" and
|
||||
// any express or implied warranties, including, but not limited to, the implied
|
||||
// warranties of merchantability and fitness for a particular purpose are disclaimed.
|
||||
// In no event shall the Intel Corporation or contributors be liable for any direct,
|
||||
// indirect, incidental, special, exemplary, or consequential damages
|
||||
// (including, but not limited to, procurement of substitute goods or services;
|
||||
// loss of use, data, or profits; or business interruption) however caused
|
||||
// and on any theory of liability, whether in contract, strict liability,
|
||||
// or tort (including negligence or otherwise) arising in any way out of
|
||||
// the use of this software, even if advised of the possibility of such damage.
|
||||
//
|
||||
//M*/
|
||||
|
||||
#include "test_precomp.hpp"
|
||||
|
||||
namespace opencv_test { namespace {
|
||||
const string FEATURES2D_DIR = "features2d";
|
||||
const string DETECTOR_DIR = FEATURES2D_DIR + "/feature_detectors";
|
||||
const string DESCRIPTOR_DIR = FEATURES2D_DIR + "/descriptor_extractors";
|
||||
const string IMAGE_FILENAME = "tsukuba.png";
|
||||
}} // namespace
|
||||
|
||||
#include "features/test/test_detectors_regression.impl.hpp"
|
||||
#include "features/test/test_descriptors_regression.impl.hpp"
|
||||
|
||||
namespace opencv_test { namespace {
|
||||
|
||||
#ifdef OPENCV_ENABLE_NONFREE
|
||||
TEST( Features2d_Detector_SURF, regression )
|
||||
{
|
||||
CV_FeatureDetectorTest test( "detector-surf", SURF::create() );
|
||||
test.safe_run();
|
||||
}
|
||||
#endif
|
||||
|
||||
TEST( Features2d_Detector_STAR, regression )
|
||||
{
|
||||
CV_FeatureDetectorTest test( "detector-star", StarDetector::create() );
|
||||
test.safe_run();
|
||||
}
|
||||
|
||||
TEST( Features2d_Detector_Harris_Laplace, regression )
|
||||
{
|
||||
CV_FeatureDetectorTest test( "detector-harris-laplace", HarrisLaplaceFeatureDetector::create() );
|
||||
test.safe_run();
|
||||
}
|
||||
|
||||
TEST( Features2d_Detector_Harris_Laplace_Affine_Keypoint_Invariance, regression )
|
||||
{
|
||||
CV_FeatureDetectorTest test( "detector-harris-laplace", AffineFeature2D::create(HarrisLaplaceFeatureDetector::create()));
|
||||
test.safe_run();
|
||||
}
|
||||
|
||||
TEST( Features2d_Detector_Harris_Laplace_Affine, regression )
|
||||
{
|
||||
CV_FeatureDetectorTest test( "detector-harris-laplace-affine", AffineFeature2D::create(HarrisLaplaceFeatureDetector::create()));
|
||||
test.safe_run();
|
||||
}
|
||||
|
||||
TEST(Features2d_Detector_TBMR_Affine, regression)
|
||||
{
|
||||
CV_FeatureDetectorTest test("detector-tbmr-affine", TBMR::create());
|
||||
test.safe_run();
|
||||
}
|
||||
|
||||
TEST( Features2d_Detector_BRISK, regression )
|
||||
{
|
||||
CV_FeatureDetectorTest test( "detector-brisk", BRISK::create() );
|
||||
test.safe_run();
|
||||
}
|
||||
|
||||
TEST( Features2d_Detector_AGAST, regression )
|
||||
{
|
||||
CV_FeatureDetectorTest test( "detector-agast", AgastFeatureDetector::create() );
|
||||
test.safe_run();
|
||||
}
|
||||
|
||||
TEST( Features2d_Detector_KAZE, regression )
|
||||
{
|
||||
CV_FeatureDetectorTest test( "detector-kaze", KAZE::create() );
|
||||
test.safe_run();
|
||||
}
|
||||
|
||||
TEST( Features2d_Detector_AKAZE, regression )
|
||||
{
|
||||
CV_FeatureDetectorTest test( "detector-akaze", AKAZE::create() );
|
||||
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();
|
||||
}
|
||||
|
||||
/*
|
||||
* Descriptors
|
||||
*/
|
||||
|
||||
#ifdef OPENCV_ENABLE_NONFREE
|
||||
TEST( Features2d_DescriptorExtractor_SURF, regression )
|
||||
{
|
||||
#ifdef HAVE_OPENCL
|
||||
bool useOCL = cv::ocl::useOpenCL();
|
||||
cv::ocl::setUseOpenCL(false);
|
||||
#endif
|
||||
|
||||
CV_DescriptorExtractorTest<L2<float> > test( "descriptor-surf", 0.05f,
|
||||
SURF::create() );
|
||||
test.safe_run();
|
||||
|
||||
#ifdef HAVE_OPENCL
|
||||
cv::ocl::setUseOpenCL(useOCL);
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef HAVE_OPENCL
|
||||
TEST( Features2d_DescriptorExtractor_SURF_OCL, regression )
|
||||
{
|
||||
bool useOCL = cv::ocl::useOpenCL();
|
||||
cv::ocl::setUseOpenCL(true);
|
||||
if(cv::ocl::useOpenCL())
|
||||
{
|
||||
CV_DescriptorExtractorTest<L2<float> > test( "descriptor-surf_ocl", 0.05f,
|
||||
SURF::create() );
|
||||
test.safe_run();
|
||||
}
|
||||
cv::ocl::setUseOpenCL(useOCL);
|
||||
}
|
||||
#endif
|
||||
#endif // NONFREE
|
||||
|
||||
TEST( Features2d_DescriptorExtractor_DAISY, regression )
|
||||
{
|
||||
CV_DescriptorExtractorTest<L2<float> > test( "descriptor-daisy", 0.05f,
|
||||
DAISY::create() );
|
||||
test.safe_run();
|
||||
}
|
||||
|
||||
TEST( Features2d_DescriptorExtractor_FREAK, regression )
|
||||
{
|
||||
CV_DescriptorExtractorTest<Hamming> test("descriptor-freak", (CV_DescriptorExtractorTest<Hamming>::DistanceType)12.f,
|
||||
FREAK::create());
|
||||
test.safe_run();
|
||||
}
|
||||
|
||||
TEST( Features2d_DescriptorExtractor_BRIEF, regression )
|
||||
{
|
||||
CV_DescriptorExtractorTest<Hamming> test( "descriptor-brief", 1,
|
||||
BriefDescriptorExtractor::create() );
|
||||
test.safe_run();
|
||||
}
|
||||
|
||||
template <int threshold = 0>
|
||||
struct LUCIDEqualityDistance
|
||||
{
|
||||
typedef unsigned char ValueType;
|
||||
typedef int ResultType;
|
||||
|
||||
ResultType operator()( const unsigned char* a, const unsigned char* b, int size ) const
|
||||
{
|
||||
int res = 0;
|
||||
for (int i = 0; i < size; i++)
|
||||
{
|
||||
if (threshold == 0)
|
||||
res += (a[i] != b[i]) ? 1 : 0;
|
||||
else
|
||||
res += abs(a[i] - b[i]) > threshold ? 1 : 0;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
};
|
||||
|
||||
TEST( Features2d_DescriptorExtractor_LUCID, regression )
|
||||
{
|
||||
CV_DescriptorExtractorTest< LUCIDEqualityDistance<1/*used blur is not bit-exact*/> > test(
|
||||
"descriptor-lucid", 2,
|
||||
LUCID::create(1, 2)
|
||||
);
|
||||
test.safe_run();
|
||||
}
|
||||
|
||||
TEST( Features2d_DescriptorExtractor_LATCH, regression )
|
||||
{
|
||||
CV_DescriptorExtractorTest<Hamming> test( "descriptor-latch", 1,
|
||||
LATCH::create(32, true, 3, 0) );
|
||||
test.safe_run();
|
||||
}
|
||||
|
||||
TEST(Features2d_DescriptorExtractor_BEBLID, regression )
|
||||
{
|
||||
CV_DescriptorExtractorTest<Hamming> test("descriptor-beblid", 1,
|
||||
BEBLID::create(6.75));
|
||||
test.safe_run();
|
||||
}
|
||||
|
||||
TEST(Features2d_DescriptorExtractor_TEBLID, regression )
|
||||
{
|
||||
CV_DescriptorExtractorTest<Hamming> test("descriptor-teblid", 1,
|
||||
TEBLID::create(6.75));
|
||||
test.safe_run();
|
||||
}
|
||||
|
||||
TEST( Features2d_DescriptorExtractor_BRISK, regression )
|
||||
{
|
||||
CV_DescriptorExtractorTest<Hamming> test( "descriptor-brisk",
|
||||
(CV_DescriptorExtractorTest<Hamming>::DistanceType)2.f,
|
||||
BRISK::create() );
|
||||
test.safe_run();
|
||||
}
|
||||
|
||||
TEST( Features2d_DescriptorExtractor_KAZE, regression )
|
||||
{
|
||||
CV_DescriptorExtractorTest< L2<float> > test( "descriptor-kaze", 0.03f,
|
||||
KAZE::create(),
|
||||
L2<float>(), KAZE::create() );
|
||||
test.safe_run();
|
||||
}
|
||||
|
||||
TEST( Features2d_DescriptorExtractor_AKAZE, regression )
|
||||
{
|
||||
CV_DescriptorExtractorTest<Hamming> test( "descriptor-akaze",
|
||||
(CV_DescriptorExtractorTest<Hamming>::DistanceType)(486*0.05f),
|
||||
AKAZE::create(),
|
||||
Hamming(), AKAZE::create());
|
||||
test.safe_run();
|
||||
}
|
||||
|
||||
TEST( Features2d_DescriptorExtractor_AKAZE_DESCRIPTOR_KAZE, regression )
|
||||
{
|
||||
CV_DescriptorExtractorTest< L2<float> > test( "descriptor-akaze-with-kaze-desc", 0.03f,
|
||||
AKAZE::create(AKAZE::DESCRIPTOR_KAZE),
|
||||
L2<float>(), AKAZE::create(AKAZE::DESCRIPTOR_KAZE));
|
||||
test.safe_run();
|
||||
}
|
||||
|
||||
#ifdef OPENCV_XFEATURES2D_HAS_VGG_DATA
|
||||
TEST( Features2d_DescriptorExtractor_VGG, regression )
|
||||
{
|
||||
CV_DescriptorExtractorTest<L2<float> > test( "descriptor-vgg", 0.03f,
|
||||
VGG::create() );
|
||||
test.safe_run();
|
||||
}
|
||||
#endif // OPENCV_XFEATURES2D_HAS_VGG_DATA
|
||||
|
||||
#ifdef OPENCV_XFEATURES2D_HAS_BOOST_DATA
|
||||
TEST( Features2d_DescriptorExtractor_BGM, regression )
|
||||
{
|
||||
CV_DescriptorExtractorTest<Hamming> test( "descriptor-boostdesc-bgm",
|
||||
(CV_DescriptorExtractorTest<Hamming>::DistanceType)12.f,
|
||||
BoostDesc::create(BoostDesc::BGM) );
|
||||
test.safe_run();
|
||||
}
|
||||
|
||||
TEST( Features2d_DescriptorExtractor_BGM_HARD, regression )
|
||||
{
|
||||
CV_DescriptorExtractorTest<Hamming> test( "descriptor-boostdesc-bgm_hard",
|
||||
(CV_DescriptorExtractorTest<Hamming>::DistanceType)12.f,
|
||||
BoostDesc::create(BoostDesc::BGM_HARD) );
|
||||
test.safe_run();
|
||||
}
|
||||
|
||||
TEST( Features2d_DescriptorExtractor_BGM_BILINEAR, regression )
|
||||
{
|
||||
CV_DescriptorExtractorTest<Hamming> test( "descriptor-boostdesc-bgm_bilinear",
|
||||
(CV_DescriptorExtractorTest<Hamming>::DistanceType)15.f,
|
||||
BoostDesc::create(BoostDesc::BGM_BILINEAR) );
|
||||
test.safe_run();
|
||||
}
|
||||
|
||||
TEST( Features2d_DescriptorExtractor_LBGM, regression )
|
||||
{
|
||||
CV_DescriptorExtractorTest<L2<float> > test( "descriptor-boostdesc-lbgm",
|
||||
1.0f,
|
||||
BoostDesc::create(BoostDesc::LBGM) );
|
||||
test.safe_run();
|
||||
}
|
||||
|
||||
TEST( Features2d_DescriptorExtractor_BINBOOST_64, regression )
|
||||
{
|
||||
CV_DescriptorExtractorTest<Hamming> test( "descriptor-boostdesc-binboost_64",
|
||||
(CV_DescriptorExtractorTest<Hamming>::DistanceType)12.f,
|
||||
BoostDesc::create(BoostDesc::BINBOOST_64) );
|
||||
test.safe_run();
|
||||
}
|
||||
|
||||
TEST( Features2d_DescriptorExtractor_BINBOOST_128, regression )
|
||||
{
|
||||
CV_DescriptorExtractorTest<Hamming> test( "descriptor-boostdesc-binboost_128",
|
||||
(CV_DescriptorExtractorTest<Hamming>::DistanceType)12.f,
|
||||
BoostDesc::create(BoostDesc::BINBOOST_128) );
|
||||
test.safe_run();
|
||||
}
|
||||
|
||||
TEST( Features2d_DescriptorExtractor_BINBOOST_256, regression )
|
||||
{
|
||||
CV_DescriptorExtractorTest<Hamming> test( "descriptor-boostdesc-binboost_256",
|
||||
(CV_DescriptorExtractorTest<Hamming>::DistanceType)12.f,
|
||||
BoostDesc::create(BoostDesc::BINBOOST_256) );
|
||||
test.safe_run();
|
||||
}
|
||||
#endif // OPENCV_XFEATURES2D_HAS_BOOST_DATA
|
||||
|
||||
#ifdef OPENCV_ENABLE_NONFREE
|
||||
TEST(Features2d_BruteForceDescriptorMatcher_knnMatch, regression)
|
||||
{
|
||||
const int sz = 100;
|
||||
const int k = 3;
|
||||
|
||||
Ptr<DescriptorExtractor> ext = SURF::create();
|
||||
ASSERT_TRUE(ext);
|
||||
|
||||
Ptr<FeatureDetector> det = SURF::create();
|
||||
//"%YAML:1.0\nhessianThreshold: 8000.\noctaves: 3\noctaveLayers: 4\nupright: 0\n"
|
||||
ASSERT_TRUE(det);
|
||||
|
||||
Ptr<DescriptorMatcher> matcher = DescriptorMatcher::create("BruteForce");
|
||||
ASSERT_TRUE(matcher);
|
||||
|
||||
Mat imgT(256, 256, CV_8U, Scalar(255));
|
||||
line(imgT, Point(20, sz/2), Point(sz-21, sz/2), Scalar(100), 2);
|
||||
line(imgT, Point(sz/2, 20), Point(sz/2, sz-21), Scalar(100), 2);
|
||||
vector<KeyPoint> kpT;
|
||||
kpT.push_back( KeyPoint(50, 50, 16, 0, 20000, 1, -1) );
|
||||
kpT.push_back( KeyPoint(42, 42, 16, 160, 10000, 1, -1) );
|
||||
Mat descT;
|
||||
ext->compute(imgT, kpT, descT);
|
||||
|
||||
Mat imgQ(256, 256, CV_8U, Scalar(255));
|
||||
line(imgQ, Point(30, sz/2), Point(sz-31, sz/2), Scalar(100), 3);
|
||||
line(imgQ, Point(sz/2, 30), Point(sz/2, sz-31), Scalar(100), 3);
|
||||
vector<KeyPoint> kpQ;
|
||||
det->detect(imgQ, kpQ);
|
||||
Mat descQ;
|
||||
ext->compute(imgQ, kpQ, descQ);
|
||||
|
||||
vector<vector<DMatch> > matches;
|
||||
|
||||
matcher->knnMatch(descQ, descT, matches, k);
|
||||
|
||||
//cout << "\nBest " << k << " matches to " << descT.rows << " train desc-s." << endl;
|
||||
ASSERT_EQ(descQ.rows, static_cast<int>(matches.size()));
|
||||
for(size_t i = 0; i<matches.size(); i++)
|
||||
{
|
||||
//cout << "\nmatches[" << i << "].size()==" << matches[i].size() << endl;
|
||||
ASSERT_GE(min(k, descT.rows), static_cast<int>(matches[i].size()));
|
||||
for(size_t j = 0; j<matches[i].size(); j++)
|
||||
{
|
||||
//cout << "\t" << matches[i][j].queryIdx << " -> " << matches[i][j].trainIdx << endl;
|
||||
ASSERT_EQ(matches[i][j].queryIdx, static_cast<int>(i));
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
class DescriptorImage : public TestWithParam<std::string>
|
||||
{
|
||||
protected:
|
||||
virtual void SetUp() {
|
||||
pattern = GetParam();
|
||||
}
|
||||
|
||||
std::string pattern;
|
||||
};
|
||||
|
||||
TEST_P(DescriptorImage, no_crash)
|
||||
{
|
||||
vector<String> fnames;
|
||||
glob(cvtest::TS::ptr()->get_data_path() + pattern, fnames, false);
|
||||
std::sort(fnames.begin(), fnames.end());
|
||||
|
||||
Ptr<AKAZE> akaze_mldb = AKAZE::create(AKAZE::DESCRIPTOR_MLDB);
|
||||
Ptr<AKAZE> akaze_mldb_upright = AKAZE::create(AKAZE::DESCRIPTOR_MLDB_UPRIGHT);
|
||||
Ptr<AKAZE> akaze_mldb_256 = AKAZE::create(AKAZE::DESCRIPTOR_MLDB, 256);
|
||||
Ptr<AKAZE> akaze_mldb_upright_256 = AKAZE::create(AKAZE::DESCRIPTOR_MLDB_UPRIGHT, 256);
|
||||
Ptr<AKAZE> akaze_kaze = AKAZE::create(AKAZE::DESCRIPTOR_KAZE);
|
||||
Ptr<AKAZE> akaze_kaze_upright = AKAZE::create(AKAZE::DESCRIPTOR_KAZE_UPRIGHT);
|
||||
Ptr<KAZE> kaze = KAZE::create();
|
||||
Ptr<BRISK> brisk = BRISK::create();
|
||||
size_t n = fnames.size();
|
||||
vector<KeyPoint> keypoints;
|
||||
Mat descriptors;
|
||||
|
||||
for(size_t i = 0; i < n; i++ )
|
||||
{
|
||||
printf("%d. image: %s:\n", (int)i, fnames[i].c_str());
|
||||
if( strstr(fnames[i].c_str(), "MP.png") != 0 )
|
||||
{
|
||||
printf("\tskip\n");
|
||||
continue;
|
||||
}
|
||||
bool checkCount = strstr(fnames[i].c_str(), "templ.png") == 0;
|
||||
|
||||
Mat img = imread(fnames[i], -1);
|
||||
|
||||
printf("\t%dx%d\n", img.cols, img.rows);
|
||||
|
||||
#define TEST_DETECTOR(name, descriptor) \
|
||||
keypoints.clear(); descriptors.release(); \
|
||||
printf("\t" name "\n"); fflush(stdout); \
|
||||
descriptor->detectAndCompute(img, noArray(), keypoints, descriptors); \
|
||||
printf("\t\t\t(%d keypoints, descriptor size = %d)\n", (int)keypoints.size(), descriptors.cols); fflush(stdout); \
|
||||
if (checkCount) \
|
||||
{ \
|
||||
EXPECT_GT((int)keypoints.size(), 0); \
|
||||
} \
|
||||
ASSERT_EQ(descriptors.rows, (int)keypoints.size());
|
||||
|
||||
TEST_DETECTOR("AKAZE:MLDB", akaze_mldb);
|
||||
TEST_DETECTOR("AKAZE:MLDB_UPRIGHT", akaze_mldb_upright);
|
||||
TEST_DETECTOR("AKAZE:MLDB_256", akaze_mldb_256);
|
||||
TEST_DETECTOR("AKAZE:MLDB_UPRIGHT_256", akaze_mldb_upright_256);
|
||||
TEST_DETECTOR("AKAZE:KAZE", akaze_kaze);
|
||||
TEST_DETECTOR("AKAZE:KAZE_UPRIGHT", akaze_kaze_upright);
|
||||
TEST_DETECTOR("KAZE", kaze);
|
||||
TEST_DETECTOR("BRISK", brisk);
|
||||
}
|
||||
}
|
||||
|
||||
class CV_DetectPlanarTest : public cvtest::BaseTest
|
||||
{
|
||||
public:
|
||||
CV_DetectPlanarTest(const string& _fname, int _min_ninliers, const Ptr<Feature2D>& _f2d)
|
||||
: fname(_fname), min_ninliers(_min_ninliers), f2d(_f2d) {}
|
||||
|
||||
protected:
|
||||
void run(int)
|
||||
{
|
||||
if(f2d.empty())
|
||||
return;
|
||||
string path = string(ts->get_data_path()) + "detectors_descriptors_evaluation/planar/";
|
||||
string imgname1 = path + "box.png";
|
||||
string imgname2 = path + "box_in_scene.png";
|
||||
Mat img1 = imread(imgname1, 0);
|
||||
Mat img2 = imread(imgname2, 0);
|
||||
if( img1.empty() || img2.empty() )
|
||||
{
|
||||
ts->printf( cvtest::TS::LOG, "missing %s and/or %s\n", imgname1.c_str(), imgname2.c_str());
|
||||
ts->set_failed_test_info( cvtest::TS::FAIL_INVALID_TEST_DATA );
|
||||
return;
|
||||
}
|
||||
vector<KeyPoint> kpt1, kpt2;
|
||||
Mat d1, d2;
|
||||
#ifdef HAVE_OPENCL
|
||||
if (cv::ocl::useOpenCL())
|
||||
{
|
||||
cv::UMat uimg1;
|
||||
img1.copyTo(uimg1);
|
||||
f2d->detectAndCompute(uimg1, Mat(), kpt1, d1);
|
||||
f2d->detectAndCompute(uimg1, Mat(), kpt2, d2);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
f2d->detectAndCompute(img1, Mat(), kpt1, d1);
|
||||
f2d->detectAndCompute(img1, Mat(), kpt2, d2);
|
||||
}
|
||||
for( size_t i = 0; i < kpt1.size(); i++ )
|
||||
CV_Assert(kpt1[i].response > 0 );
|
||||
for( size_t i = 0; i < kpt2.size(); i++ )
|
||||
CV_Assert(kpt2[i].response > 0 );
|
||||
|
||||
vector<DMatch> matches;
|
||||
BFMatcher(f2d->defaultNorm(), true).match(d1, d2, matches);
|
||||
|
||||
vector<Point2f> pt1, pt2;
|
||||
for( size_t i = 0; i < matches.size(); i++ ) {
|
||||
pt1.push_back(kpt1[matches[i].queryIdx].pt);
|
||||
pt2.push_back(kpt2[matches[i].trainIdx].pt);
|
||||
}
|
||||
|
||||
Mat inliers, H = findHomography(pt1, pt2, RANSAC, 10, inliers);
|
||||
int ninliers = countNonZero(inliers);
|
||||
|
||||
if( ninliers < min_ninliers )
|
||||
{
|
||||
ts->printf( cvtest::TS::LOG, "too little inliers (%d) vs expected %d\n", ninliers, min_ninliers);
|
||||
ts->set_failed_test_info( cvtest::TS::FAIL_INVALID_TEST_DATA );
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
string fname;
|
||||
int min_ninliers;
|
||||
Ptr<Feature2D> f2d;
|
||||
};
|
||||
|
||||
TEST(Features2d_SIFTHomographyTest, regression) { CV_DetectPlanarTest test("SIFT", 80, SIFT::create()); test.safe_run(); }
|
||||
|
||||
#ifdef OPENCV_ENABLE_NONFREE
|
||||
TEST(Features2d_SURFHomographyTest, regression) { CV_DetectPlanarTest test("SURF", 80, SURF::create()); test.safe_run(); }
|
||||
#endif
|
||||
|
||||
class FeatureDetectorUsingMaskTest : public cvtest::BaseTest
|
||||
{
|
||||
public:
|
||||
FeatureDetectorUsingMaskTest(const Ptr<FeatureDetector>& featureDetector) :
|
||||
featureDetector_(featureDetector)
|
||||
{
|
||||
CV_Assert(featureDetector_);
|
||||
}
|
||||
|
||||
protected:
|
||||
|
||||
void run(int)
|
||||
{
|
||||
const int nStepX = 2;
|
||||
const int nStepY = 2;
|
||||
|
||||
const string imageFilename = string(ts->get_data_path()) + "/features2d/tsukuba.png";
|
||||
|
||||
Mat image = imread(imageFilename);
|
||||
if(image.empty())
|
||||
{
|
||||
ts->printf(cvtest::TS::LOG, "Image %s can not be read.\n", imageFilename.c_str());
|
||||
ts->set_failed_test_info(cvtest::TS::FAIL_INVALID_TEST_DATA);
|
||||
return;
|
||||
}
|
||||
|
||||
Mat mask(image.size(), CV_8U);
|
||||
|
||||
const int stepX = image.size().width / nStepX;
|
||||
const int stepY = image.size().height / nStepY;
|
||||
|
||||
vector<KeyPoint> keyPoints;
|
||||
vector<Point2f> points;
|
||||
for(int i=0; i<nStepX; ++i)
|
||||
for(int j=0; j<nStepY; ++j)
|
||||
{
|
||||
|
||||
mask.setTo(0);
|
||||
Rect whiteArea(i * stepX, j * stepY, stepX, stepY);
|
||||
mask(whiteArea).setTo(255);
|
||||
|
||||
featureDetector_->detect(image, keyPoints, mask);
|
||||
KeyPoint::convert(keyPoints, points);
|
||||
|
||||
for(size_t k=0; k<points.size(); ++k)
|
||||
{
|
||||
// Workaround for https://github.com/opencv/opencv/issues/26016
|
||||
// To keep its behaviour, points casts to Point_<int>.
|
||||
if ( !whiteArea.contains(Point_<int>(points[k])) )
|
||||
{
|
||||
ts->printf(cvtest::TS::LOG, "The feature point is outside of the mask.");
|
||||
ts->set_failed_test_info(cvtest::TS::FAIL_INVALID_OUTPUT);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ts->set_failed_test_info( cvtest::TS::OK );
|
||||
}
|
||||
|
||||
Ptr<FeatureDetector> featureDetector_;
|
||||
};
|
||||
|
||||
TEST(Features2d_SIFT_using_mask, regression)
|
||||
{
|
||||
FeatureDetectorUsingMaskTest test(SIFT::create());
|
||||
test.safe_run();
|
||||
}
|
||||
|
||||
#ifdef OPENCV_ENABLE_NONFREE
|
||||
TEST(DISABLED_Features2d_SURF_using_mask, regression)
|
||||
{
|
||||
FeatureDetectorUsingMaskTest test(SURF::create());
|
||||
test.safe_run();
|
||||
}
|
||||
#endif // NONFREE
|
||||
|
||||
}} // namespace
|
||||
@@ -0,0 +1,116 @@
|
||||
// This file is part of OpenCV project.
|
||||
// It is subject to the license terms in the LICENSE file found in the top-level directory
|
||||
// of this distribution and at http://opencv.org/license.html.
|
||||
|
||||
#include "test_precomp.hpp"
|
||||
|
||||
namespace opencv_test { namespace {
|
||||
|
||||
class CV_GMSMatcherTest : public cvtest::BaseTest
|
||||
{
|
||||
public:
|
||||
CV_GMSMatcherTest();
|
||||
~CV_GMSMatcherTest();
|
||||
|
||||
protected:
|
||||
virtual void run(int);
|
||||
|
||||
bool combinations[4][2];
|
||||
double eps[3][4]; //3 imgs x 4 combinations
|
||||
double correctMatchDistThreshold;
|
||||
};
|
||||
|
||||
CV_GMSMatcherTest::CV_GMSMatcherTest()
|
||||
{
|
||||
combinations[0][0] = false; combinations[0][1] = false;
|
||||
combinations[1][0] = false; combinations[1][1] = true;
|
||||
combinations[2][0] = true; combinations[2][1] = false;
|
||||
combinations[3][0] = true; combinations[3][1] = true;
|
||||
|
||||
eps[0][0] = 0.91;
|
||||
eps[0][1] = 0.91;
|
||||
eps[0][2] = 0.91;
|
||||
eps[0][3] = 0.91;
|
||||
|
||||
eps[1][0] = 0.80;
|
||||
eps[1][1] = 0.78;
|
||||
eps[1][2] = 0.80;
|
||||
eps[1][3] = 0.78;
|
||||
|
||||
eps[2][0] = 0.6;
|
||||
eps[2][1] = 0.6;
|
||||
eps[2][2] = 0.6;
|
||||
eps[2][3] = 0.6;
|
||||
|
||||
correctMatchDistThreshold = 5.0;
|
||||
}
|
||||
|
||||
CV_GMSMatcherTest::~CV_GMSMatcherTest() {}
|
||||
|
||||
void CV_GMSMatcherTest::run( int )
|
||||
{
|
||||
ts->set_failed_test_info(cvtest::TS::OK);
|
||||
|
||||
Mat imgRef = imread(string(ts->get_data_path()) + "detectors_descriptors_evaluation/images_datasets/graf/img1.png");
|
||||
|
||||
Ptr<Feature2D> orb = ORB::create(10000);
|
||||
vector<KeyPoint> keypointsRef, keypointsCur;
|
||||
Mat descriptorsRef, descriptorsCur;
|
||||
orb->detectAndCompute(imgRef, noArray(), keypointsRef, descriptorsRef);
|
||||
|
||||
vector<DMatch> matchesAll, matchesGMS;
|
||||
Ptr<DescriptorMatcher> matcher = DescriptorMatcher::create("BruteForce-Hamming");
|
||||
|
||||
const int startImg = 2;
|
||||
const int nImgs = 3;
|
||||
for (int num = startImg; num < startImg+nImgs; num++)
|
||||
{
|
||||
string fileName = cv::format("img%d.png", num);
|
||||
string imgPath = string(ts->get_data_path()) + "detectors_descriptors_evaluation/images_datasets/graf/" + fileName;
|
||||
Mat imgCur = imread(imgPath);
|
||||
orb->detectAndCompute(imgCur, noArray(), keypointsCur, descriptorsCur);
|
||||
|
||||
matcher->match(descriptorsCur, descriptorsRef, matchesAll);
|
||||
|
||||
string xml = string(ts->get_data_path()) + format("detectors_descriptors_evaluation/images_datasets/graf/H1to%dp.xml", num);
|
||||
FileStorage fs(xml, FileStorage::READ);
|
||||
if (!fs.isOpened())
|
||||
{
|
||||
ts->set_failed_test_info(cvtest::TS::FAIL_INVALID_TEST_DATA);
|
||||
return;
|
||||
}
|
||||
|
||||
Mat H1toCur;
|
||||
fs[format("H1%d", num)] >> H1toCur;
|
||||
|
||||
for (int comb = 0; comb < 4; comb++)
|
||||
{
|
||||
matchGMS(imgCur.size(), imgRef.size(), keypointsCur, keypointsRef, matchesAll, matchesGMS, combinations[comb][0], combinations[comb][1]);
|
||||
|
||||
int nbCorrectMatches = 0;
|
||||
for (size_t i = 0; i < matchesGMS.size(); i++)
|
||||
{
|
||||
Point2f ptRef = keypointsRef[matchesGMS[i].trainIdx].pt;
|
||||
Point2f ptCur = keypointsCur[matchesGMS[i].queryIdx].pt;
|
||||
Mat matRef = (Mat_<double>(3,1) << ptRef.x, ptRef.y, 1);
|
||||
Mat matTrans = H1toCur * matRef;
|
||||
Point2f ptTrans( (float) (matTrans.at<double>(0,0)/matTrans.at<double>(2,0)),
|
||||
(float) (matTrans.at<double>(1,0)/matTrans.at<double>(2,0)));
|
||||
|
||||
if (cv::norm(ptTrans-ptCur) < correctMatchDistThreshold)
|
||||
nbCorrectMatches++;
|
||||
}
|
||||
|
||||
double ratio = nbCorrectMatches / (double) matchesGMS.size();
|
||||
EXPECT_GT(ratio, eps[num-startImg][comb]) <<
|
||||
cv::format("Invalid accuracy for image %s and combination withRotation=%d withScale=%d, "
|
||||
"matches ratio is %g, ratio threshold is %g, distance threshold is %g.",
|
||||
fileName.c_str(), combinations[comb][0], combinations[comb][1], ratio,
|
||||
eps[num-startImg][comb], correctMatchDistThreshold);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
TEST(XFeatures2d_GMSMatcher, gms_matcher_regression) { CV_GMSMatcherTest test; test.safe_run(); }
|
||||
|
||||
}} // namespace
|
||||
@@ -0,0 +1,175 @@
|
||||
/*M///////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
|
||||
//
|
||||
// By downloading, copying, installing or using the software you agree to this license.
|
||||
// If you do not agree to this license, do not download, install,
|
||||
// copy or use the software.
|
||||
//
|
||||
//
|
||||
// Intel License Agreement
|
||||
// For Open Source Computer Vision Library
|
||||
//
|
||||
// Copyright (C) 2000, Intel Corporation, all rights reserved.
|
||||
// Third party copyrights are property of their respective owners.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without modification,
|
||||
// are permitted provided that the following conditions are met:
|
||||
//
|
||||
// * Redistribution's of source code must retain the above copyright notice,
|
||||
// this list of conditions and the following disclaimer.
|
||||
//
|
||||
// * Redistribution's in binary form must reproduce the above copyright notice,
|
||||
// this list of conditions and the following disclaimer in the documentation
|
||||
// and/or other materials provided with the distribution.
|
||||
//
|
||||
// * The name of Intel Corporation may not be used to endorse or promote products
|
||||
// derived from this software without specific prior written permission.
|
||||
//
|
||||
// This software is provided by the copyright holders and contributors "as is" and
|
||||
// any express or implied warranties, including, but not limited to, the implied
|
||||
// warranties of merchantability and fitness for a particular purpose are disclaimed.
|
||||
// In no event shall the Intel Corporation or contributors be liable for any direct,
|
||||
// indirect, incidental, special, exemplary, or consequential damages
|
||||
// (including, but not limited to, procurement of substitute goods or services;
|
||||
// loss of use, data, or profits; or business interruption) however caused
|
||||
// and on any theory of liability, whether in contract, strict liability,
|
||||
// or tort (including negligence or otherwise) arising in any way out of
|
||||
// the use of this software, even if advised of the possibility of such damage.
|
||||
//
|
||||
//M*/
|
||||
|
||||
#include "test_precomp.hpp"
|
||||
|
||||
namespace opencv_test { namespace {
|
||||
|
||||
const string FEATURES2D_DIR = "features2d";
|
||||
const string IMAGE_FILENAME = "tsukuba.png";
|
||||
|
||||
/****************************************************************************************\
|
||||
* Test for KeyPoint *
|
||||
\****************************************************************************************/
|
||||
|
||||
class CV_FeatureDetectorKeypointsTest : public cvtest::BaseTest
|
||||
{
|
||||
public:
|
||||
explicit CV_FeatureDetectorKeypointsTest(const Ptr<Feature2D>& _detector) :
|
||||
detector(_detector) {}
|
||||
|
||||
protected:
|
||||
virtual void run(int)
|
||||
{
|
||||
CV_Assert(detector);
|
||||
string imgFilename = string(ts->get_data_path()) + FEATURES2D_DIR + "/" + IMAGE_FILENAME;
|
||||
|
||||
// Read the test image.
|
||||
Mat image = imread(imgFilename);
|
||||
if(image.empty())
|
||||
{
|
||||
ts->printf(cvtest::TS::LOG, "Image %s can not be read.\n", imgFilename.c_str());
|
||||
ts->set_failed_test_info(cvtest::TS::FAIL_INVALID_TEST_DATA);
|
||||
return;
|
||||
}
|
||||
|
||||
vector<KeyPoint> keypoints;
|
||||
detector->detect(image, keypoints);
|
||||
|
||||
if(keypoints.empty())
|
||||
{
|
||||
ts->printf(cvtest::TS::LOG, "Detector can't find keypoints in image.\n");
|
||||
ts->set_failed_test_info(cvtest::TS::FAIL_INVALID_OUTPUT);
|
||||
return;
|
||||
}
|
||||
|
||||
Rect r(0, 0, image.cols, image.rows);
|
||||
for(size_t i = 0; i < keypoints.size(); i++)
|
||||
{
|
||||
const KeyPoint& kp = keypoints[i];
|
||||
|
||||
// Workaround for https://github.com/opencv/opencv/issues/26016
|
||||
// To keep its behaviour, kp.pt casts to Point_<int>.
|
||||
if(!r.contains(Point_<int>(kp.pt)))
|
||||
{
|
||||
ts->printf(cvtest::TS::LOG, "KeyPoint::pt is out of image (x=%f, y=%f).\n", kp.pt.x, kp.pt.y);
|
||||
ts->set_failed_test_info(cvtest::TS::FAIL_INVALID_OUTPUT);
|
||||
return;
|
||||
}
|
||||
|
||||
if(kp.size <= 0.f)
|
||||
{
|
||||
ts->printf(cvtest::TS::LOG, "KeyPoint::size is not positive (%f).\n", kp.size);
|
||||
ts->set_failed_test_info(cvtest::TS::FAIL_INVALID_OUTPUT);
|
||||
return;
|
||||
}
|
||||
|
||||
if((kp.angle < 0.f && kp.angle != -1.f) || kp.angle >= 360.f)
|
||||
{
|
||||
ts->printf(cvtest::TS::LOG, "KeyPoint::angle is out of range [0, 360). It's %f.\n", kp.angle);
|
||||
ts->set_failed_test_info(cvtest::TS::FAIL_INVALID_OUTPUT);
|
||||
return;
|
||||
}
|
||||
}
|
||||
ts->set_failed_test_info(cvtest::TS::OK);
|
||||
}
|
||||
|
||||
Ptr<Feature2D> detector;
|
||||
};
|
||||
|
||||
|
||||
// Registration of tests
|
||||
#ifdef OPENCV_ENABLE_NONFREE
|
||||
TEST(Features2d_Detector_Keypoints_SURF, validation)
|
||||
{
|
||||
CV_FeatureDetectorKeypointsTest test(xfeatures2d::SURF::create());
|
||||
test.safe_run();
|
||||
}
|
||||
#endif // NONFREE
|
||||
|
||||
|
||||
TEST(Features2d_Detector_Keypoints_Star, validation)
|
||||
{
|
||||
CV_FeatureDetectorKeypointsTest test(xfeatures2d::StarDetector::create());
|
||||
test.safe_run();
|
||||
}
|
||||
|
||||
|
||||
TEST(Features2d_Detector_Keypoints_MSDDetector, validation)
|
||||
{
|
||||
CV_FeatureDetectorKeypointsTest test(xfeatures2d::MSDDetector::create());
|
||||
test.safe_run();
|
||||
}
|
||||
|
||||
TEST(Features2d_Detector_Keypoints_TBMRDetector, validation)
|
||||
{
|
||||
CV_FeatureDetectorKeypointsTest test(xfeatures2d::TBMR::create());
|
||||
test.safe_run();
|
||||
}
|
||||
|
||||
TEST(Features2d_Detector_Keypoints_BRISK, validation)
|
||||
{
|
||||
CV_FeatureDetectorKeypointsTest test(BRISK::create());
|
||||
test.safe_run();
|
||||
}
|
||||
|
||||
TEST(Features2d_Detector_Keypoints_AGAST, validation)
|
||||
{
|
||||
CV_FeatureDetectorKeypointsTest test(AgastFeatureDetector::create());
|
||||
test.safe_run();
|
||||
}
|
||||
|
||||
TEST(Features2d_Detector_Keypoints_KAZE, validation)
|
||||
{
|
||||
CV_FeatureDetectorKeypointsTest test(KAZE::create());
|
||||
test.safe_run();
|
||||
}
|
||||
|
||||
TEST(Features2d_Detector_Keypoints_AKAZE, validation)
|
||||
{
|
||||
CV_FeatureDetectorKeypointsTest test_kaze(AKAZE::create(AKAZE::DESCRIPTOR_KAZE));
|
||||
test_kaze.safe_run();
|
||||
|
||||
CV_FeatureDetectorKeypointsTest test_mldb(AKAZE::create(AKAZE::DESCRIPTOR_MLDB));
|
||||
test_mldb.safe_run();
|
||||
}
|
||||
|
||||
}} // namespace
|
||||
@@ -0,0 +1,152 @@
|
||||
// This file is part of OpenCV project.
|
||||
// It is subject to the license terms in the LICENSE file found in the top-level directory
|
||||
// of this distribution and at http://opencv.org/license.html.
|
||||
|
||||
#include "test_precomp.hpp"
|
||||
|
||||
namespace opencv_test { namespace {
|
||||
|
||||
static void loadKeypoints(const std::string& vP_path,
|
||||
const std::string& oP_path,
|
||||
const std::string& sP_path,
|
||||
const std::string& w_path,
|
||||
std::vector<cv::KeyPoint>& keypoints,
|
||||
std::vector<int>& nn)
|
||||
{
|
||||
{
|
||||
std::ifstream file(vP_path.c_str());
|
||||
if (file.is_open())
|
||||
{
|
||||
float x = 0, y = 0;
|
||||
while (file >> x >> y)
|
||||
{
|
||||
keypoints.push_back(cv::KeyPoint(x, y, 0));
|
||||
}
|
||||
}
|
||||
}
|
||||
{
|
||||
std::ifstream file(oP_path.c_str());
|
||||
if (file.is_open())
|
||||
{
|
||||
float orientation = 0;
|
||||
size_t idx = 0;
|
||||
while (file >> orientation)
|
||||
{
|
||||
keypoints[idx].angle = static_cast<float>(orientation * 180.0 / CV_PI);
|
||||
idx++;
|
||||
}
|
||||
}
|
||||
}
|
||||
{
|
||||
std::ifstream file(sP_path.c_str());
|
||||
if (file.is_open())
|
||||
{
|
||||
float scale = 0;
|
||||
size_t idx = 0;
|
||||
while (file >> scale)
|
||||
{
|
||||
keypoints[idx].size = scale;
|
||||
idx++;
|
||||
}
|
||||
}
|
||||
}
|
||||
{
|
||||
std::ifstream file(w_path.c_str());
|
||||
if (file.is_open())
|
||||
{
|
||||
int neighborIdx = 0;
|
||||
while (file >> neighborIdx)
|
||||
{
|
||||
nn.push_back(neighborIdx);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ASSERT_TRUE(!keypoints.empty());
|
||||
}
|
||||
|
||||
static void loadGroundTruth(const std::string& d1_path,
|
||||
const std::string& b1_path,
|
||||
std::vector<cv::DMatch>& groundTruth)
|
||||
{
|
||||
std::vector<int> d1_vec;
|
||||
{
|
||||
std::ifstream file(d1_path.c_str());
|
||||
if (file.is_open())
|
||||
{
|
||||
int idx = 0;
|
||||
while (file >> idx)
|
||||
{
|
||||
d1_vec.push_back(idx-1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
std::vector<int> b1_vec;
|
||||
{
|
||||
std::ifstream file(b1_path.c_str());
|
||||
if (file.is_open())
|
||||
{
|
||||
int idx = 0;
|
||||
while (file >> idx)
|
||||
{
|
||||
b1_vec.push_back(idx-1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ASSERT_TRUE(!d1_vec.empty());
|
||||
ASSERT_EQ(d1_vec.size(), b1_vec.size());
|
||||
|
||||
for (size_t i = 0; i < d1_vec.size(); i++)
|
||||
{
|
||||
groundTruth.push_back(cv::DMatch(d1_vec[i], b1_vec[i], 0));
|
||||
}
|
||||
}
|
||||
|
||||
TEST(XFeatures2d_LogosMatcher, logos_matcher_regression)
|
||||
{
|
||||
const std::string vP1_path = cvtest::findDataFile("detectors_descriptors_evaluation/matching/LOGOS/vP1.txt");
|
||||
const std::string oP1_path = cvtest::findDataFile("detectors_descriptors_evaluation/matching/LOGOS/oP1.txt");
|
||||
const std::string sP1_path = cvtest::findDataFile("detectors_descriptors_evaluation/matching/LOGOS/sP1.txt");
|
||||
const std::string w1_path = cvtest::findDataFile("detectors_descriptors_evaluation/matching/LOGOS/w1.txt");
|
||||
|
||||
const std::string vP2_path = cvtest::findDataFile("detectors_descriptors_evaluation/matching/LOGOS/vP2.txt");
|
||||
const std::string oP2_path = cvtest::findDataFile("detectors_descriptors_evaluation/matching/LOGOS/oP2.txt");
|
||||
const std::string sP2_path = cvtest::findDataFile("detectors_descriptors_evaluation/matching/LOGOS/sP2.txt");
|
||||
const std::string w2_path = cvtest::findDataFile("detectors_descriptors_evaluation/matching/LOGOS/w2.txt");
|
||||
|
||||
std::vector<cv::KeyPoint> keypoints1, keypoints2;
|
||||
std::vector<int> nn1, nn2;
|
||||
loadKeypoints(vP1_path, oP1_path, sP1_path, w1_path, keypoints1, nn1);
|
||||
loadKeypoints(vP2_path, oP2_path, sP2_path, w2_path, keypoints2, nn2);
|
||||
|
||||
std::vector<cv::DMatch> matchesLogos;
|
||||
matchLOGOS(keypoints1, keypoints2, nn1, nn2, matchesLogos);
|
||||
|
||||
std::vector<cv::DMatch> groundTruth;
|
||||
const std::string d1_path = cvtest::findDataFile("detectors_descriptors_evaluation/matching/LOGOS/d1.txt");
|
||||
const std::string b1_path = cvtest::findDataFile("detectors_descriptors_evaluation/matching/LOGOS/b1.txt");
|
||||
loadGroundTruth(d1_path, b1_path, groundTruth);
|
||||
|
||||
int correctMatches = 0;
|
||||
for (size_t i = 0; i < matchesLogos.size(); i++)
|
||||
{
|
||||
for (size_t j = 0; j < groundTruth.size(); j++)
|
||||
{
|
||||
if (groundTruth[j].queryIdx == matchesLogos[i].queryIdx &&
|
||||
groundTruth[j].trainIdx == matchesLogos[j].trainIdx)
|
||||
{
|
||||
correctMatches++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ASSERT_EQ(static_cast<int>(groundTruth.size()), correctMatches)
|
||||
<< "groundTruth: " << groundTruth.size()
|
||||
<< " ; matchesLogos: " << matchesLogos.size()
|
||||
<< " ; correctMatches: " << correctMatches;
|
||||
}
|
||||
|
||||
}} // namespace
|
||||
@@ -0,0 +1,6 @@
|
||||
// This file is part of OpenCV project.
|
||||
// It is subject to the license terms in the LICENSE file found in the top-level directory
|
||||
// of this distribution and at http://opencv.org/license.html.
|
||||
#include "test_precomp.hpp"
|
||||
|
||||
CV_TEST_MAIN("cv")
|
||||
@@ -0,0 +1,26 @@
|
||||
// This file is part of OpenCV project.
|
||||
// It is subject to the license terms in the LICENSE file found in the top-level directory
|
||||
// of this distribution and at http://opencv.org/license.html.
|
||||
#ifndef __OPENCV_TEST_PRECOMP_HPP__
|
||||
#define __OPENCV_TEST_PRECOMP_HPP__
|
||||
|
||||
#include "opencv2/ts.hpp"
|
||||
#include "opencv2/ts/cuda_test.hpp"
|
||||
#include "opencv2/xfeatures2d.hpp"
|
||||
#include "opencv2/geometry.hpp"
|
||||
|
||||
#include "cvconfig.h"
|
||||
|
||||
#ifdef HAVE_OPENCL
|
||||
# include "opencv2/core/ocl.hpp"
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CUDA
|
||||
# include "opencv2/xfeatures2d/cuda.hpp"
|
||||
#endif
|
||||
|
||||
namespace opencv_test {
|
||||
using namespace cv::xfeatures2d;
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,345 @@
|
||||
// This file is part of OpenCV project.
|
||||
// It is subject to the license terms in the LICENSE file found in the top-level directory
|
||||
// of this distribution and at http://opencv.org/license.html
|
||||
|
||||
#include "test_precomp.hpp"
|
||||
|
||||
#include "features/test/test_detectors_invariance.impl.hpp" // main OpenCV repo
|
||||
#include "features/test/test_descriptors_invariance.impl.hpp" // main OpenCV repo
|
||||
|
||||
namespace opencv_test { namespace {
|
||||
|
||||
static const char* const IMAGE_TSUKUBA = "features2d/tsukuba.png";
|
||||
#if defined(OPENCV_ENABLE_NONFREE) || defined (OPENCV_XFEATURES2D_HAS_VGG_DATA)
|
||||
static const char* const IMAGE_BIKES = "detectors_descriptors_evaluation/images_datasets/bikes/img1.png";
|
||||
#endif // OPENCV_ENABLE_NONFREE
|
||||
// ========================== ROTATION INVARIANCE =============================
|
||||
|
||||
#ifdef OPENCV_ENABLE_NONFREE
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(SURF, DetectorRotationInvariance, Values(
|
||||
make_tuple(IMAGE_TSUKUBA, []() { return SURF::create(); }, 0.40f, 0.76f)
|
||||
));
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(SURF, DescriptorRotationInvariance, Values(
|
||||
make_tuple(IMAGE_TSUKUBA, []() { return SURF::create(); }, []() { return SURF::create(); }, 0.83f)
|
||||
));
|
||||
|
||||
#endif // NONFREE
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(BRISK, DetectorRotationInvariance, Values(
|
||||
make_tuple(IMAGE_TSUKUBA, []() { return BRISK::create(); }, 0.45f, 0.76f)
|
||||
));
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(AKAZE, DetectorRotationInvariance, Values(
|
||||
make_tuple(IMAGE_TSUKUBA, []() { return AKAZE::create(); }, 0.5f, 0.71f)
|
||||
));
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(AKAZE_DESCRIPTOR_KAZE, DetectorRotationInvariance, Values(
|
||||
make_tuple(IMAGE_TSUKUBA, []() { return AKAZE::create(AKAZE::DESCRIPTOR_KAZE); }, 0.5f, 0.71f)
|
||||
));
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(BRISK, DescriptorRotationInvariance, Values(
|
||||
make_tuple(IMAGE_TSUKUBA, []() { return BRISK::create(); }, []() { return BRISK::create(); }, 0.99f)
|
||||
));
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(AKAZE, DescriptorRotationInvariance, Values(
|
||||
make_tuple(IMAGE_TSUKUBA, []() { return AKAZE::create(); }, []() { return AKAZE::create();} , 0.99f)
|
||||
));
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(AKAZE_DESCRIPTOR_KAZE, DescriptorRotationInvariance, Values(
|
||||
make_tuple(IMAGE_TSUKUBA,
|
||||
[]() { return AKAZE::create(AKAZE::DESCRIPTOR_KAZE); },
|
||||
[]() { return AKAZE::create(AKAZE::DESCRIPTOR_KAZE); },
|
||||
0.99f)
|
||||
));
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(LATCH, DescriptorRotationInvariance, Values(
|
||||
make_tuple(IMAGE_TSUKUBA, []() { return SIFT::create(); }, []() { return LATCH::create(); }, 0.98f)
|
||||
));
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(BEBLID, DescriptorRotationInvariance, Values(
|
||||
make_tuple(IMAGE_TSUKUBA, []() { return SIFT::create(); }, []() { return BEBLID::create(6.75); }, 0.98f)
|
||||
));
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(TEBLID, DescriptorRotationInvariance, Values(
|
||||
make_tuple(IMAGE_TSUKUBA, []() { return SIFT::create(); }, []() { return TEBLID::create(6.75); }, 0.98f)
|
||||
));
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(DAISY, DescriptorRotationInvariance, Values(
|
||||
make_tuple(IMAGE_TSUKUBA,
|
||||
[]() { return BRISK::create(); },
|
||||
[]() { return DAISY::create(15, 3, 8, 8, DAISY::NRM_NONE, noArray(), true, true); },
|
||||
0.79f)
|
||||
));
|
||||
|
||||
#ifdef OPENCV_XFEATURES2D_HAS_VGG_DATA
|
||||
INSTANTIATE_TEST_CASE_P(VGG120, DescriptorRotationInvariance, Values(
|
||||
make_tuple(IMAGE_TSUKUBA,
|
||||
[]() { return KAZE::create(); },
|
||||
[]() { return VGG::create(VGG::VGG_120, 1.4f, true, true, 48.0f, false); },
|
||||
0.97f)
|
||||
));
|
||||
INSTANTIATE_TEST_CASE_P(VGG80, DescriptorRotationInvariance, Values(
|
||||
make_tuple(IMAGE_TSUKUBA,
|
||||
[]() { return KAZE::create(); },
|
||||
[]() { return VGG::create(VGG::VGG_80, 1.4f, true, true, 48.0f, false); },
|
||||
0.97f)
|
||||
));
|
||||
INSTANTIATE_TEST_CASE_P(VGG64, DescriptorRotationInvariance, Values(
|
||||
make_tuple(IMAGE_TSUKUBA,
|
||||
[]() { return KAZE::create(); },
|
||||
[]() { return VGG::create(VGG::VGG_64, 1.4f, true, true, 48.0f, false); },
|
||||
0.97f)
|
||||
));
|
||||
INSTANTIATE_TEST_CASE_P(VGG48, DescriptorRotationInvariance, Values(
|
||||
make_tuple(IMAGE_TSUKUBA,
|
||||
[]() { return KAZE::create(); },
|
||||
[]() { return VGG::create(VGG::VGG_48, 1.4f, true, true, 48.0f, false); },
|
||||
0.97f)
|
||||
));
|
||||
#endif // OPENCV_XFEATURES2D_HAS_VGG_DATA
|
||||
|
||||
#ifdef OPENCV_ENABLE_NONFREE
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(BRIEF_64, DescriptorRotationInvariance, Values(
|
||||
make_tuple(IMAGE_TSUKUBA,
|
||||
[]() { return SURF::create(); },
|
||||
[]() { return BriefDescriptorExtractor::create(64,true); },
|
||||
0.98f)
|
||||
));
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(BRIEF_32, DescriptorRotationInvariance, Values(
|
||||
make_tuple(IMAGE_TSUKUBA,
|
||||
[]() { return SURF::create(); },
|
||||
[]() { return BriefDescriptorExtractor::create(32,true); },
|
||||
0.97f)
|
||||
));
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(BRIEF_16, DescriptorRotationInvariance, Values(
|
||||
make_tuple(IMAGE_TSUKUBA,
|
||||
[]() { return SURF::create(); },
|
||||
[]() { return BriefDescriptorExtractor::create(16, true); },
|
||||
0.98f)
|
||||
));
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(FREAK, DescriptorRotationInvariance, Values(
|
||||
make_tuple(IMAGE_TSUKUBA,
|
||||
[]() { return SURF::create(); },
|
||||
[]() { return FREAK::create(); },
|
||||
0.90f)
|
||||
));
|
||||
|
||||
#ifdef OPENCV_XFEATURES2D_HAS_BOOST_DATA
|
||||
INSTANTIATE_TEST_CASE_P(BoostDesc_BGM, DescriptorRotationInvariance, Values(
|
||||
make_tuple(IMAGE_TSUKUBA,
|
||||
[]() { return SURF::create(); },
|
||||
[]() { return BoostDesc::create(BoostDesc::BGM, true, 6.25f); },
|
||||
0.999f)
|
||||
));
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(BoostDesc_BGM_HARD, DescriptorRotationInvariance, Values(
|
||||
make_tuple(IMAGE_TSUKUBA,
|
||||
[]() { return SURF::create(); },
|
||||
[]() { return BoostDesc::create(BoostDesc::BGM_HARD, true, 6.25f); },
|
||||
0.98f)
|
||||
));
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(BoostDesc_BGM_BILINEAR, DescriptorRotationInvariance, Values(
|
||||
make_tuple(IMAGE_TSUKUBA,
|
||||
[]() { return SURF::create(); },
|
||||
[]() { return BoostDesc::create(BoostDesc::BGM_BILINEAR, true, 6.25f); },
|
||||
0.98f)
|
||||
));
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(BoostDesc_BGM_LBGM, DescriptorRotationInvariance, Values(
|
||||
make_tuple(IMAGE_TSUKUBA,
|
||||
[]() { return SURF::create(); },
|
||||
[]() { return BoostDesc::create(BoostDesc::LBGM, true, 6.25f); },
|
||||
0.999f)
|
||||
));
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(BoostDesc_BINBOOST_64, DescriptorRotationInvariance, Values(
|
||||
make_tuple(IMAGE_TSUKUBA,
|
||||
[]() { return SURF::create(); },
|
||||
[]() { return BoostDesc::create(BoostDesc::BINBOOST_64, true, 6.25f); },
|
||||
0.98f)
|
||||
));
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(BoostDesc_BINBOOST_128, DescriptorRotationInvariance, Values(
|
||||
make_tuple(IMAGE_TSUKUBA,
|
||||
[]() { return SURF::create(); },
|
||||
[]() { return BoostDesc::create(BoostDesc::BINBOOST_128, true, 6.25f); },
|
||||
0.98f)
|
||||
));
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(BoostDesc_BINBOOST_256, DescriptorRotationInvariance, Values(
|
||||
make_tuple(IMAGE_TSUKUBA,
|
||||
[]() { return SURF::create(); },
|
||||
[]() { return BoostDesc::create(BoostDesc::BINBOOST_256, true, 6.25f); },
|
||||
0.999f)
|
||||
));
|
||||
#endif // OPENCV_XFEATURES2D_HAS_BOOST_DATA
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
// ============================ SCALE INVARIANCE ==============================
|
||||
|
||||
#ifdef OPENCV_ENABLE_NONFREE
|
||||
INSTANTIATE_TEST_CASE_P(SURF, DetectorScaleInvariance, Values(
|
||||
make_tuple(IMAGE_BIKES, []() { return SURF::create(); }, 0.64f, 0.84f)
|
||||
));
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(SURF, DescriptorScaleInvariance, Values(
|
||||
make_tuple(IMAGE_BIKES, []() { return SURF::create(); }, []() { return SURF::create(); }, 0.7f)
|
||||
));
|
||||
#endif // NONFREE
|
||||
|
||||
|
||||
#if 0 // DAISY is not scale invariant
|
||||
INSTANTIATE_TEST_CASE_P(DISABLED_DAISY, DescriptorScaleInvariance, Values(
|
||||
make_tuple(IMAGE_BIKES,
|
||||
[]() { return BRISK::create(); },
|
||||
[]() { return DAISY::create(15, 3, 8, 8, DAISY::NRM_NONE, noArray(), true, true); },
|
||||
0.1f)
|
||||
));
|
||||
#endif
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(BRISK, DetectorScaleInvariance, Values(
|
||||
make_tuple(IMAGE_BIKES, []() { return BRISK::create(); }, 0.08f, 0.49f)
|
||||
));
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(KAZE, DetectorScaleInvariance, Values(
|
||||
make_tuple(IMAGE_BIKES, []() { return KAZE::create(); }, 0.08f, 0.49f)
|
||||
));
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(AKAZE, DetectorScaleInvariance, Values(
|
||||
make_tuple(IMAGE_BIKES, []() { return AKAZE::create(); }, 0.08f, 0.49f)
|
||||
));
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(AKAZE_DESCRIPTOR_KAZE, DetectorScaleInvariance, Values(
|
||||
make_tuple(IMAGE_BIKES, []() { return AKAZE::create(AKAZE::DESCRIPTOR_KAZE); }, 0.08f, 0.49f)
|
||||
));
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(AKAZE, DescriptorScaleInvariance, Values(
|
||||
make_tuple(IMAGE_BIKES, []() { return AKAZE::create(); }, []() { return AKAZE::create(); }, 0.6f)
|
||||
));
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(AKAZE_DESCRIPTOR_KAZE, DescriptorScaleInvariance, Values(
|
||||
make_tuple(IMAGE_BIKES,
|
||||
[]() { return AKAZE::create(AKAZE::DESCRIPTOR_KAZE); },
|
||||
[]() { return AKAZE::create(AKAZE::DESCRIPTOR_KAZE); },
|
||||
0.55f)
|
||||
));
|
||||
|
||||
#ifdef OPENCV_XFEATURES2D_HAS_VGG_DATA
|
||||
INSTANTIATE_TEST_CASE_P(VGG120, DescriptorScaleInvariance, Values(
|
||||
make_tuple(IMAGE_BIKES,
|
||||
[]() { return KAZE::create(); },
|
||||
[]() { return VGG::create(VGG::VGG_120, 1.4f, true, true, 48.0f, false); },
|
||||
0.98f)
|
||||
));
|
||||
INSTANTIATE_TEST_CASE_P(VGG80, DescriptorScaleInvariance, Values(
|
||||
make_tuple(IMAGE_BIKES,
|
||||
[]() { return KAZE::create(); },
|
||||
[]() { return VGG::create(VGG::VGG_80, 1.4f, true, true, 48.0f, false); },
|
||||
0.98f)
|
||||
));
|
||||
INSTANTIATE_TEST_CASE_P(VGG64, DescriptorScaleInvariance, Values(
|
||||
make_tuple(IMAGE_BIKES,
|
||||
[]() { return KAZE::create(); },
|
||||
[]() { return VGG::create(VGG::VGG_64, 1.4f, true, true, 48.0f, false); },
|
||||
0.97f)
|
||||
));
|
||||
INSTANTIATE_TEST_CASE_P(VGG48, DescriptorScaleInvariance, Values(
|
||||
make_tuple(IMAGE_BIKES,
|
||||
[]() { return KAZE::create(); },
|
||||
[]() { return VGG::create(VGG::VGG_48, 1.4f, true, true, 48.0f, false); },
|
||||
0.93f)
|
||||
));
|
||||
#endif // OPENCV_XFEATURES2D_HAS_VGG_DATA
|
||||
|
||||
#ifdef OPENCV_ENABLE_NONFREE // SURF detector is used in tests
|
||||
#ifdef OPENCV_XFEATURES2D_HAS_BOOST_DATA
|
||||
INSTANTIATE_TEST_CASE_P(BoostDesc_BGM, DescriptorScaleInvariance, Values(
|
||||
make_tuple(IMAGE_BIKES,
|
||||
[]() { return SURF::create(); },
|
||||
[]() { return BoostDesc::create(BoostDesc::BGM, true, 6.25f); },
|
||||
0.98f)
|
||||
));
|
||||
INSTANTIATE_TEST_CASE_P(BoostDesc_BGM_HARD, DescriptorScaleInvariance, Values(
|
||||
make_tuple(IMAGE_BIKES,
|
||||
[]() { return SURF::create(); },
|
||||
[]() { return BoostDesc::create(BoostDesc::BGM_HARD, true, 6.25f); },
|
||||
0.75f)
|
||||
));
|
||||
INSTANTIATE_TEST_CASE_P(BoostDesc_BGM_BILINEAR, DescriptorScaleInvariance, Values(
|
||||
make_tuple(IMAGE_BIKES,
|
||||
[]() { return SURF::create(); },
|
||||
[]() { return BoostDesc::create(BoostDesc::BGM_BILINEAR, true, 6.25f); },
|
||||
0.95f)
|
||||
));
|
||||
INSTANTIATE_TEST_CASE_P(BoostDesc_LBGM, DescriptorScaleInvariance, Values(
|
||||
make_tuple(IMAGE_BIKES,
|
||||
[]() { return SURF::create(); },
|
||||
[]() { return BoostDesc::create(BoostDesc::LBGM, true, 6.25f); },
|
||||
0.95f)
|
||||
));
|
||||
INSTANTIATE_TEST_CASE_P(BoostDesc_BINBOOST_64, DescriptorScaleInvariance, Values(
|
||||
make_tuple(IMAGE_BIKES,
|
||||
[]() { return SURF::create(); },
|
||||
[]() { return BoostDesc::create(BoostDesc::BINBOOST_64, true, 6.25f); },
|
||||
0.75f)
|
||||
));
|
||||
INSTANTIATE_TEST_CASE_P(BoostDesc_BINBOOST_128, DescriptorScaleInvariance, Values(
|
||||
make_tuple(IMAGE_BIKES,
|
||||
[]() { return SURF::create(); },
|
||||
[]() { return BoostDesc::create(BoostDesc::BINBOOST_128, true, 6.25f); },
|
||||
0.95f)
|
||||
));
|
||||
INSTANTIATE_TEST_CASE_P(BoostDesc_BINBOOST_256, DescriptorScaleInvariance, Values(
|
||||
make_tuple(IMAGE_BIKES,
|
||||
[]() { return SURF::create(); },
|
||||
[]() { return BoostDesc::create(BoostDesc::BINBOOST_256, true, 6.25f); },
|
||||
0.98f)
|
||||
));
|
||||
#endif // OPENCV_XFEATURES2D_HAS_BOOST_DATA
|
||||
#endif // NONFREE
|
||||
|
||||
|
||||
|
||||
// ============================== OTHER TESTS =================================
|
||||
|
||||
#ifdef OPENCV_ENABLE_NONFREE
|
||||
TEST(Features2d_RotationInvariance2_Detector_SURF, regression)
|
||||
{
|
||||
Mat cross(100, 100, CV_8UC1, Scalar(255));
|
||||
line(cross, Point(30, 50), Point(69, 50), Scalar(100), 3);
|
||||
line(cross, Point(50, 30), Point(50, 69), Scalar(100), 3);
|
||||
|
||||
Ptr<SURF> surf = SURF::create(8000., 3, 4, true, false);
|
||||
|
||||
vector<KeyPoint> keypoints;
|
||||
surf->detect(cross, keypoints);
|
||||
|
||||
// Expect 5 keypoints. One keypoint has coordinates (50.0, 50.0).
|
||||
// The other 4 keypoints should have the same response.
|
||||
// The order of the keypoints is indeterminate.
|
||||
ASSERT_EQ(keypoints.size(), (vector<KeyPoint>::size_type) 5);
|
||||
|
||||
int i1 = -1;
|
||||
for(int i = 0; i < 5; i++)
|
||||
{
|
||||
if(keypoints[i].pt.x == 50.0f)
|
||||
;
|
||||
else if(i1 == -1)
|
||||
i1 = i;
|
||||
else
|
||||
ASSERT_LT(fabs(keypoints[i1].response - keypoints[i].response) / keypoints[i1].response, 1e-6);
|
||||
}
|
||||
}
|
||||
|
||||
#endif // NONFREE
|
||||
|
||||
}} // namespace
|
||||
@@ -0,0 +1,192 @@
|
||||
/*M///////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
|
||||
//
|
||||
// By downloading, copying, installing or using the software you agree to this license.
|
||||
// If you do not agree to this license, do not download, install,
|
||||
// copy or use the software.
|
||||
//
|
||||
//
|
||||
// License Agreement
|
||||
// For Open Source Computer Vision Library
|
||||
//
|
||||
// Copyright (C) 2000-2008, Intel Corporation, all rights reserved.
|
||||
// Copyright (C) 2009, Willow Garage Inc., all rights reserved.
|
||||
// Third party copyrights are property of their respective owners.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without modification,
|
||||
// are permitted provided that the following conditions are met:
|
||||
//
|
||||
// * Redistribution's of source code must retain the above copyright notice,
|
||||
// this list of conditions and the following disclaimer.
|
||||
//
|
||||
// * Redistribution's in binary form must reproduce the above copyright notice,
|
||||
// this list of conditions and the following disclaimer in the documentation
|
||||
// and/or other materials provided with the distribution.
|
||||
//
|
||||
// * The name of the copyright holders may not be used to endorse or promote products
|
||||
// derived from this software without specific prior written permission.
|
||||
//
|
||||
// This software is provided by the copyright holders and contributors "as is" and
|
||||
// any express or implied warranties, including, but not limited to, the implied
|
||||
// warranties of merchantability and fitness for a particular purpose are disclaimed.
|
||||
// In no event shall the Intel Corporation or contributors be liable for any direct,
|
||||
// indirect, incidental, special, exemplary, or consequential damages
|
||||
// (including, but not limited to, procurement of substitute goods or services;
|
||||
// loss of use, data, or profits; or business interruption) however caused
|
||||
// and on any theory of liability, whether in contract, strict liability,
|
||||
// or tort (including negligence or otherwise) arising in any way out of
|
||||
// the use of this software, even if advised of the possibility of such damage.
|
||||
//
|
||||
//M*/
|
||||
|
||||
#include "test_precomp.hpp"
|
||||
|
||||
#if defined(HAVE_CUDA) && defined(OPENCV_ENABLE_NONFREE)
|
||||
|
||||
namespace opencv_test { namespace {
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// SURF
|
||||
|
||||
#ifdef HAVE_OPENCV_CUDAARITHM
|
||||
|
||||
namespace
|
||||
{
|
||||
IMPLEMENT_PARAM_CLASS(SURF_HessianThreshold, double)
|
||||
IMPLEMENT_PARAM_CLASS(SURF_Octaves, int)
|
||||
IMPLEMENT_PARAM_CLASS(SURF_OctaveLayers, int)
|
||||
IMPLEMENT_PARAM_CLASS(SURF_Extended, bool)
|
||||
IMPLEMENT_PARAM_CLASS(SURF_Upright, bool)
|
||||
}
|
||||
|
||||
PARAM_TEST_CASE(CUDA_SURF, SURF_HessianThreshold, SURF_Octaves, SURF_OctaveLayers, SURF_Extended, SURF_Upright)
|
||||
{
|
||||
double hessianThreshold;
|
||||
int nOctaves;
|
||||
int nOctaveLayers;
|
||||
bool extended;
|
||||
bool upright;
|
||||
|
||||
virtual void SetUp()
|
||||
{
|
||||
hessianThreshold = GET_PARAM(0);
|
||||
nOctaves = GET_PARAM(1);
|
||||
nOctaveLayers = GET_PARAM(2);
|
||||
extended = GET_PARAM(3);
|
||||
upright = GET_PARAM(4);
|
||||
}
|
||||
};
|
||||
|
||||
CUDA_TEST_P(CUDA_SURF, Detector)
|
||||
{
|
||||
cv::Mat image = readImage("../gpu/features2d/aloe.png", cv::IMREAD_GRAYSCALE);
|
||||
ASSERT_FALSE(image.empty());
|
||||
|
||||
cv::cuda::SURF_CUDA surf;
|
||||
surf.hessianThreshold = hessianThreshold;
|
||||
surf.nOctaves = nOctaves;
|
||||
surf.nOctaveLayers = nOctaveLayers;
|
||||
surf.extended = extended;
|
||||
surf.upright = upright;
|
||||
surf.keypointsRatio = 0.05f;
|
||||
|
||||
std::vector<cv::KeyPoint> keypoints;
|
||||
surf(loadMat(image), cv::cuda::GpuMat(), keypoints);
|
||||
|
||||
cv::Ptr<cv::Feature2D> surf_gold = cv::xfeatures2d::SURF::create(hessianThreshold, nOctaves, nOctaveLayers, extended, upright);
|
||||
|
||||
std::vector<cv::KeyPoint> keypoints_gold;
|
||||
surf_gold->detect(image, keypoints_gold);
|
||||
|
||||
int lengthDiff = abs((int)keypoints_gold.size()) - ((int)keypoints.size());
|
||||
EXPECT_LE(lengthDiff, 1);
|
||||
int matchedCount = getMatchedPointsCount(keypoints_gold, keypoints);
|
||||
double matchedRatio = static_cast<double>(matchedCount) / keypoints_gold.size();
|
||||
|
||||
EXPECT_GT(matchedRatio, 0.95);
|
||||
}
|
||||
|
||||
CUDA_TEST_P(CUDA_SURF, Detector_Masked)
|
||||
{
|
||||
cv::Mat image = readImage("../gpu/features2d/aloe.png", cv::IMREAD_GRAYSCALE);
|
||||
ASSERT_FALSE(image.empty());
|
||||
|
||||
cv::Mat mask(image.size(), CV_8UC1, cv::Scalar::all(1));
|
||||
mask(cv::Range(0, image.rows / 2), cv::Range(0, image.cols / 2)).setTo(cv::Scalar::all(0));
|
||||
|
||||
cv::cuda::SURF_CUDA surf;
|
||||
surf.hessianThreshold = hessianThreshold;
|
||||
surf.nOctaves = nOctaves;
|
||||
surf.nOctaveLayers = nOctaveLayers;
|
||||
surf.extended = extended;
|
||||
surf.upright = upright;
|
||||
surf.keypointsRatio = 0.05f;
|
||||
|
||||
std::vector<cv::KeyPoint> keypoints;
|
||||
surf(loadMat(image), loadMat(mask), keypoints);
|
||||
|
||||
cv::Ptr<cv::Feature2D> surf_gold = cv::xfeatures2d::SURF::create(hessianThreshold, nOctaves, nOctaveLayers, extended, upright);
|
||||
|
||||
std::vector<cv::KeyPoint> keypoints_gold;
|
||||
surf_gold->detect(image, keypoints_gold, mask);
|
||||
|
||||
int lengthDiff = abs((int)keypoints_gold.size()) - ((int)keypoints.size());
|
||||
EXPECT_LE(lengthDiff, 1);
|
||||
int matchedCount = getMatchedPointsCount(keypoints_gold, keypoints);
|
||||
double matchedRatio = static_cast<double>(matchedCount) / keypoints_gold.size();
|
||||
|
||||
EXPECT_GT(matchedRatio, 0.95);
|
||||
}
|
||||
|
||||
CUDA_TEST_P(CUDA_SURF, Descriptor)
|
||||
{
|
||||
cv::Mat image = readImage("../gpu/features2d/aloe.png", cv::IMREAD_GRAYSCALE);
|
||||
ASSERT_FALSE(image.empty());
|
||||
|
||||
cv::cuda::SURF_CUDA surf;
|
||||
surf.hessianThreshold = hessianThreshold;
|
||||
surf.nOctaves = nOctaves;
|
||||
surf.nOctaveLayers = nOctaveLayers;
|
||||
surf.extended = extended;
|
||||
surf.upright = upright;
|
||||
surf.keypointsRatio = 0.05f;
|
||||
|
||||
cv::Ptr<cv::Feature2D> surf_gold = cv::xfeatures2d::SURF::create(hessianThreshold, nOctaves, nOctaveLayers, extended, upright);
|
||||
|
||||
std::vector<cv::KeyPoint> keypoints;
|
||||
surf_gold->detect(image, keypoints);
|
||||
|
||||
cv::cuda::GpuMat descriptors;
|
||||
surf(loadMat(image), cv::cuda::GpuMat(), keypoints, descriptors, true);
|
||||
|
||||
cv::Mat descriptors_gold;
|
||||
surf_gold->compute(image, keypoints, descriptors_gold);
|
||||
|
||||
cv::BFMatcher matcher(surf.defaultNorm());
|
||||
std::vector<cv::DMatch> matches;
|
||||
matcher.match(descriptors_gold, cv::Mat(descriptors), matches);
|
||||
|
||||
int matchedCount = getMatchedPointsCount(keypoints, keypoints, matches);
|
||||
double matchedRatio = static_cast<double>(matchedCount) / keypoints.size();
|
||||
|
||||
EXPECT_GT(matchedRatio, 0.6);
|
||||
}
|
||||
|
||||
testing::internal::ValueArray3<SURF_HessianThreshold, SURF_HessianThreshold, SURF_HessianThreshold> thresholdValues =
|
||||
testing::Values(
|
||||
SURF_HessianThreshold(100.0),
|
||||
SURF_HessianThreshold(500.0),
|
||||
SURF_HessianThreshold(1000.0));
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(CUDA_Features2D, CUDA_SURF, testing::Combine(
|
||||
thresholdValues,
|
||||
testing::Values(SURF_Octaves(3), SURF_Octaves(4)),
|
||||
testing::Values(SURF_OctaveLayers(2), SURF_OctaveLayers(3)),
|
||||
testing::Values(SURF_Extended(false), SURF_Extended(true)),
|
||||
testing::Values(SURF_Upright(false), SURF_Upright(true))));
|
||||
|
||||
#endif // HAVE_OPENCV_CUDAARITHM
|
||||
|
||||
}} // namespace
|
||||
#endif // HAVE_CUDA && OPENCV_ENABLE_NONFREE
|
||||
@@ -0,0 +1,226 @@
|
||||
/*M///////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
|
||||
//
|
||||
// By downloading, copying, installing or using the software you agree to this license.
|
||||
// If you do not agree to this license, do not download, install,
|
||||
// copy or use the software.
|
||||
//
|
||||
//
|
||||
// License Agreement
|
||||
// For Open Source Computer Vision Library
|
||||
//
|
||||
// Copyright (C) 2010-2012, Multicoreware, Inc., all rights reserved.
|
||||
// Copyright (C) 2010-2012, Advanced Micro Devices, Inc., all rights reserved.
|
||||
// Third party copyrights are property of their respective owners.
|
||||
//
|
||||
// @Authors
|
||||
// Peng Xiao, pengxiao@multicorewareinc.com
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without modification,
|
||||
// are permitted provided that the following conditions are met:
|
||||
//
|
||||
// * Redistribution's of source code must retain the above copyright notice,
|
||||
// this list of conditions and the following disclaimer.
|
||||
//
|
||||
// * Redistribution's in binary form must reproduce the above copyright notice,
|
||||
// this list of conditions and the following disclaimer in the documentation
|
||||
// and/or other materials provided with the distribution.
|
||||
//
|
||||
// * The name of the copyright holders may not be used to endorse or promote products
|
||||
// derived from this software without specific prior written permission.
|
||||
//
|
||||
// This software is provided by the copyright holders and contributors as is and
|
||||
// any express or implied warranties, including, but not limited to, the implied
|
||||
// warranties of merchantability and fitness for a particular purpose are disclaimed.
|
||||
// In no event shall the Intel Corporation or contributors be liable for any direct,
|
||||
// indirect, incidental, special, exemplary, or consequential damages
|
||||
// (including, but not limited to, procurement of substitute goods or services;
|
||||
// loss of use, data, or profits; or business interruption) however caused
|
||||
// and on any theory of liability, whether in contract, strict liability,
|
||||
// or tort (including negligence or otherwise) arising in any way out of
|
||||
// the use of this software, even if advised of the possibility of such damage.
|
||||
//
|
||||
//M*/
|
||||
|
||||
#include "test_precomp.hpp"
|
||||
|
||||
#if defined(HAVE_OPENCL) && defined(OPENCV_ENABLE_NONFREE)
|
||||
|
||||
namespace opencv_test { namespace {
|
||||
|
||||
static bool keyPointsEquals(const cv::KeyPoint& p1, const cv::KeyPoint& p2)
|
||||
{
|
||||
const double maxPtDif = 0.1;
|
||||
const double maxSizeDif = 0.1;
|
||||
const double maxAngleDif = 0.1;
|
||||
const double maxResponseDif = 0.01;
|
||||
|
||||
double dist = cv::norm(p1.pt - p2.pt);
|
||||
|
||||
if (dist < maxPtDif &&
|
||||
fabs(p1.size - p2.size) < maxSizeDif &&
|
||||
abs(p1.angle - p2.angle) < maxAngleDif &&
|
||||
abs(p1.response - p2.response) < maxResponseDif &&
|
||||
p1.octave == p2.octave &&
|
||||
p1.class_id == p2.class_id)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
static int getMatchedPointsCount(std::vector<cv::KeyPoint>& gold, std::vector<cv::KeyPoint>& actual)
|
||||
{
|
||||
std::sort(actual.begin(), actual.end(), perf::comparators::KeypointGreater());
|
||||
std::sort(gold.begin(), gold.end(), perf::comparators::KeypointGreater());
|
||||
|
||||
int validCount = 0;
|
||||
|
||||
if (actual.size() == gold.size())
|
||||
{
|
||||
for (size_t i = 0; i < gold.size(); ++i)
|
||||
{
|
||||
const cv::KeyPoint& p1 = gold[i];
|
||||
const cv::KeyPoint& p2 = actual[i];
|
||||
|
||||
if (keyPointsEquals(p1, p2))
|
||||
++validCount;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
std::vector<cv::KeyPoint>& shorter = gold;
|
||||
std::vector<cv::KeyPoint>& longer = actual;
|
||||
if (actual.size() < gold.size())
|
||||
{
|
||||
shorter = actual;
|
||||
longer = gold;
|
||||
}
|
||||
for (size_t i = 0; i < shorter.size(); ++i)
|
||||
{
|
||||
const cv::KeyPoint& p1 = shorter[i];
|
||||
const cv::KeyPoint& p2 = longer[i];
|
||||
const cv::KeyPoint& p3 = longer[i+1];
|
||||
|
||||
if (keyPointsEquals(p1, p2) || keyPointsEquals(p1, p3))
|
||||
++validCount;
|
||||
}
|
||||
}
|
||||
|
||||
return validCount;
|
||||
}
|
||||
|
||||
static int getMatchedPointsCount(const std::vector<cv::KeyPoint>& keypoints1, const std::vector<cv::KeyPoint>& keypoints2, const std::vector<cv::DMatch>& matches)
|
||||
{
|
||||
int validCount = 0;
|
||||
|
||||
for (size_t i = 0; i < matches.size(); ++i)
|
||||
{
|
||||
const cv::DMatch& m = matches[i];
|
||||
|
||||
const cv::KeyPoint& p1 = keypoints1[m.queryIdx];
|
||||
const cv::KeyPoint& p2 = keypoints2[m.trainIdx];
|
||||
|
||||
if (keyPointsEquals(p1, p2))
|
||||
++validCount;
|
||||
}
|
||||
|
||||
return validCount;
|
||||
}
|
||||
|
||||
IMPLEMENT_PARAM_CLASS(HessianThreshold, double)
|
||||
IMPLEMENT_PARAM_CLASS(Octaves, int)
|
||||
IMPLEMENT_PARAM_CLASS(OctaveLayers, int)
|
||||
IMPLEMENT_PARAM_CLASS(Extended, bool)
|
||||
IMPLEMENT_PARAM_CLASS(Upright, bool)
|
||||
|
||||
PARAM_TEST_CASE(SURF, HessianThreshold, Octaves, OctaveLayers, Extended, Upright)
|
||||
{
|
||||
bool useOpenCL;
|
||||
double hessianThreshold;
|
||||
int nOctaves;
|
||||
int nOctaveLayers;
|
||||
bool extended;
|
||||
bool upright;
|
||||
|
||||
virtual void SetUp()
|
||||
{
|
||||
useOpenCL = cv::ocl::useOpenCL();
|
||||
hessianThreshold = get<0>(GetParam());
|
||||
nOctaves = get<1>(GetParam());
|
||||
nOctaveLayers = get<2>(GetParam());
|
||||
extended = get<3>(GetParam());
|
||||
upright = get<4>(GetParam());
|
||||
}
|
||||
|
||||
virtual void TearDown()
|
||||
{
|
||||
cv::ocl::setUseOpenCL(useOpenCL);
|
||||
}
|
||||
};
|
||||
|
||||
TEST_P(SURF, Detector)
|
||||
{
|
||||
cv::UMat image;
|
||||
cv::ocl::setUseOpenCL(true);
|
||||
cv::imread(string(cvtest::TS::ptr()->get_data_path()) + "shared/fruits.png", cv::IMREAD_GRAYSCALE).copyTo(image);
|
||||
ASSERT_FALSE(image.empty());
|
||||
|
||||
cv::Ptr<cv::xfeatures2d::SURF> surf = cv::xfeatures2d::SURF::create(hessianThreshold, nOctaves, nOctaveLayers, extended, upright);
|
||||
std::vector<cv::KeyPoint> keypoints;
|
||||
surf->detect(image, keypoints, cv::noArray());
|
||||
|
||||
cv::ocl::setUseOpenCL(false);
|
||||
std::vector<cv::KeyPoint> keypoints_gold;
|
||||
surf->detect(image, keypoints_gold, cv::noArray());
|
||||
|
||||
int lengthDiff = abs((int)keypoints_gold.size()) - ((int)keypoints.size());
|
||||
EXPECT_LE(lengthDiff, 1);
|
||||
int matchedCount = getMatchedPointsCount(keypoints_gold, keypoints);
|
||||
double matchedRatio = static_cast<double>(matchedCount) / keypoints_gold.size();
|
||||
|
||||
EXPECT_GT(matchedRatio, 0.99);
|
||||
}
|
||||
|
||||
TEST_P(SURF, Descriptor)
|
||||
{
|
||||
cv::UMat image;
|
||||
cv::ocl::setUseOpenCL(true);
|
||||
cv::imread(string(cvtest::TS::ptr()->get_data_path()) + "shared/fruits.png", cv::IMREAD_GRAYSCALE).copyTo(image);
|
||||
ASSERT_FALSE(image.empty());
|
||||
|
||||
cv::Ptr<cv::xfeatures2d::SURF> surf = cv::xfeatures2d::SURF::create(hessianThreshold, nOctaves, nOctaveLayers, extended, upright);
|
||||
|
||||
std::vector<cv::KeyPoint> keypoints;
|
||||
surf->detect(image, keypoints, cv::noArray());
|
||||
|
||||
cv::UMat descriptors;
|
||||
|
||||
surf->detectAndCompute(image, cv::noArray(), keypoints, descriptors, true);
|
||||
|
||||
cv::ocl::setUseOpenCL(false);
|
||||
cv::Mat descriptors_gold;
|
||||
surf->detectAndCompute(image, cv::noArray(), keypoints, descriptors_gold, true);
|
||||
|
||||
cv::BFMatcher matcher(surf->defaultNorm());
|
||||
std::vector<cv::DMatch> matches;
|
||||
matcher.match(descriptors_gold, descriptors, matches);
|
||||
|
||||
int matchedCount = getMatchedPointsCount(keypoints, keypoints, matches);
|
||||
double matchedRatio = static_cast<double>(matchedCount) / keypoints.size();
|
||||
|
||||
EXPECT_GT(matchedRatio, 0.35);
|
||||
}
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(OCL_Features2D, SURF, testing::Combine(
|
||||
testing::Values(HessianThreshold(500.0), HessianThreshold(1000.0)),
|
||||
testing::Values(Octaves(3), Octaves(4)),
|
||||
testing::Values(OctaveLayers(2), OctaveLayers(3)),
|
||||
testing::Values(Extended(false), Extended(true)),
|
||||
testing::Values(Upright(false), Upright(true))));
|
||||
|
||||
}} // namespace
|
||||
|
||||
#endif // HAVE_OPENCL && OPENCV_ENABLE_NONFREE
|
||||
Reference in New Issue
Block a user