changed tests for rotation/scale invariance of descriptors
This commit is contained in:
parent
ad7a6ec41f
commit
2556bb04f0
@ -85,6 +85,32 @@ Mat rotateImage(const Mat& srcImage, float angle, Mat& dstImage, Mat& dstMask)
|
|||||||
return H;
|
return H;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void rotateKeyPoints(const vector<KeyPoint>& src, const Mat& H, float angle, vector<KeyPoint>& dst)
|
||||||
|
{
|
||||||
|
// suppose that H is rotation given from rotateImage() and angle has value passed to rotateImage()
|
||||||
|
vector<Point2f> srcCenters, dstCenters;
|
||||||
|
KeyPoint::convert(src, srcCenters);
|
||||||
|
|
||||||
|
perspectiveTransform(srcCenters, dstCenters, H);
|
||||||
|
|
||||||
|
dst = src;
|
||||||
|
for(size_t i = 0; i < dst.size(); i++)
|
||||||
|
{
|
||||||
|
dst[i].pt = dstCenters[i];
|
||||||
|
float dstAngle = src[i].angle + angle;
|
||||||
|
if(dstAngle >= 360.f)
|
||||||
|
dstAngle -= 360.f;
|
||||||
|
dst[i].angle = dstAngle;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void scaleKeyPoints(const vector<KeyPoint>& src, vector<KeyPoint>& dst, float scale)
|
||||||
|
{
|
||||||
|
dst.resize(src.size());
|
||||||
|
for(size_t i = 0; i < src.size(); i++)
|
||||||
|
dst[i] = KeyPoint(src[i].pt.x * scale, src[i].pt.y * scale, src[i].size * scale);
|
||||||
|
}
|
||||||
|
|
||||||
static
|
static
|
||||||
float calcCirclesIntersectArea(const Point2f& p0, float r0, const Point2f& p1, float r1)
|
float calcCirclesIntersectArea(const Point2f& p0, float r0, const Point2f& p1, float r1)
|
||||||
{
|
{
|
||||||
@ -269,25 +295,16 @@ protected:
|
|||||||
float minAngleInliersRatio;
|
float minAngleInliersRatio;
|
||||||
};
|
};
|
||||||
|
|
||||||
void scaleKeyPoints(const vector<KeyPoint>& src, vector<KeyPoint>& dst, float scale)
|
|
||||||
{
|
|
||||||
dst.resize(src.size());
|
|
||||||
for(size_t i = 0; i < src.size(); i++)
|
|
||||||
dst[i] = KeyPoint(src[i].pt.x * scale, src[i].pt.y * scale, src[i].size * scale);
|
|
||||||
}
|
|
||||||
|
|
||||||
class DescriptorRotationInvarianceTest : public cvtest::BaseTest
|
class DescriptorRotationInvarianceTest : public cvtest::BaseTest
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
DescriptorRotationInvarianceTest(const Ptr<FeatureDetector>& _featureDetector,
|
DescriptorRotationInvarianceTest(const Ptr<FeatureDetector>& _featureDetector,
|
||||||
const Ptr<DescriptorExtractor>& _descriptorExtractor,
|
const Ptr<DescriptorExtractor>& _descriptorExtractor,
|
||||||
int _normType,
|
int _normType,
|
||||||
float _minKeyPointMatchesRatio,
|
|
||||||
float _minDescInliersRatio) :
|
float _minDescInliersRatio) :
|
||||||
featureDetector(_featureDetector),
|
featureDetector(_featureDetector),
|
||||||
descriptorExtractor(_descriptorExtractor),
|
descriptorExtractor(_descriptorExtractor),
|
||||||
normType(_normType),
|
normType(_normType),
|
||||||
minKeyPointMatchesRatio(_minKeyPointMatchesRatio),
|
|
||||||
minDescInliersRatio(_minDescInliersRatio)
|
minDescInliersRatio(_minDescInliersRatio)
|
||||||
{
|
{
|
||||||
CV_Assert(!featureDetector.empty());
|
CV_Assert(!featureDetector.empty());
|
||||||
@ -318,50 +335,33 @@ protected:
|
|||||||
|
|
||||||
BFMatcher bfmatcher(normType);
|
BFMatcher bfmatcher(normType);
|
||||||
|
|
||||||
|
const float minIntersectRatio = 0.5f;
|
||||||
const int maxAngle = 360, angleStep = 15;
|
const int maxAngle = 360, angleStep = 15;
|
||||||
for(int angle = 0; angle < maxAngle; angle += angleStep)
|
for(int angle = 0; angle < maxAngle; angle += angleStep)
|
||||||
{
|
{
|
||||||
Mat H = rotateImage(image0, angle, image1, mask1);
|
Mat H = rotateImage(image0, angle, image1, mask1);
|
||||||
|
|
||||||
vector<KeyPoint> keypoints1;
|
vector<KeyPoint> keypoints1;
|
||||||
|
rotateKeyPoints(keypoints0, H, angle, keypoints1);
|
||||||
Mat descriptors1;
|
Mat descriptors1;
|
||||||
featureDetector->detect(image1, keypoints1, mask1);
|
|
||||||
descriptorExtractor->compute(image1, keypoints1, descriptors1);
|
descriptorExtractor->compute(image1, keypoints1, descriptors1);
|
||||||
|
|
||||||
vector<DMatch> descMatches;
|
vector<DMatch> descMatches;
|
||||||
bfmatcher.match(descriptors0, descriptors1, descMatches);
|
bfmatcher.match(descriptors0, descriptors1, descMatches);
|
||||||
|
|
||||||
vector<DMatch> keyPointMatches;
|
|
||||||
matchKeyPoints(keypoints0, H, keypoints1, keyPointMatches);
|
|
||||||
|
|
||||||
const float minIntersectRatio = 0.5f;
|
|
||||||
int keyPointMatchesCount = 0;
|
|
||||||
for(size_t m = 0; m < keyPointMatches.size(); m++)
|
|
||||||
{
|
|
||||||
if(keyPointMatches[m].distance >= minIntersectRatio)
|
|
||||||
keyPointMatchesCount++;
|
|
||||||
}
|
|
||||||
int descInliersCount = 0;
|
int descInliersCount = 0;
|
||||||
for(size_t m = 0; m < descMatches.size(); m++)
|
for(size_t m = 0; m < descMatches.size(); m++)
|
||||||
{
|
{
|
||||||
int queryIdx = descMatches[m].queryIdx;
|
const KeyPoint& transformed_p0 = keypoints1[descMatches[m].queryIdx];
|
||||||
if(keyPointMatches[queryIdx].distance >= minIntersectRatio &&
|
const KeyPoint& p1 = keypoints1[descMatches[m].trainIdx];
|
||||||
descMatches[m].trainIdx == keyPointMatches[queryIdx].trainIdx)
|
if(calcIntersectRatio(transformed_p0.pt, 0.5f * transformed_p0.size,
|
||||||
|
p1.pt, 0.5f * p1.size) >= minIntersectRatio)
|
||||||
|
{
|
||||||
descInliersCount++;
|
descInliersCount++;
|
||||||
}
|
}
|
||||||
|
|
||||||
float keyPointMatchesRatio = static_cast<float>(keyPointMatchesCount) / keypoints0.size();
|
|
||||||
if(keyPointMatchesRatio < minKeyPointMatchesRatio)
|
|
||||||
{
|
|
||||||
ts->printf(cvtest::TS::LOG, "Incorrect keyPointMatchesRatio: curr = %f, min = %f.\n",
|
|
||||||
keyPointMatchesRatio, minKeyPointMatchesRatio);
|
|
||||||
ts->set_failed_test_info(cvtest::TS::FAIL_BAD_ACCURACY);
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(keyPointMatchesCount)
|
float descInliersRatio = static_cast<float>(descInliersCount) / keypoints0.size();
|
||||||
{
|
|
||||||
float descInliersRatio = static_cast<float>(descInliersCount) / keyPointMatchesCount;
|
|
||||||
if(descInliersRatio < minDescInliersRatio)
|
if(descInliersRatio < minDescInliersRatio)
|
||||||
{
|
{
|
||||||
ts->printf(cvtest::TS::LOG, "Incorrect descInliersRatio: curr = %f, min = %f.\n",
|
ts->printf(cvtest::TS::LOG, "Incorrect descInliersRatio: curr = %f, min = %f.\n",
|
||||||
@ -369,10 +369,8 @@ protected:
|
|||||||
ts->set_failed_test_info(cvtest::TS::FAIL_BAD_ACCURACY);
|
ts->set_failed_test_info(cvtest::TS::FAIL_BAD_ACCURACY);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
#if SHOW_DEBUG_LOG
|
#if SHOW_DEBUG_LOG
|
||||||
std::cout << "keyPointMatchesRatio - " << keyPointMatchesRatio
|
std::cout << "descInliersRatio " << static_cast<float>(descInliersCount) / keypoints0.size() << std::endl;
|
||||||
<< " - descInliersRatio " << static_cast<float>(descInliersCount) / keyPointMatchesCount << std::endl;
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
ts->set_failed_test_info( cvtest::TS::OK );
|
ts->set_failed_test_info( cvtest::TS::OK );
|
||||||
@ -381,9 +379,7 @@ protected:
|
|||||||
Ptr<FeatureDetector> featureDetector;
|
Ptr<FeatureDetector> featureDetector;
|
||||||
Ptr<DescriptorExtractor> descriptorExtractor;
|
Ptr<DescriptorExtractor> descriptorExtractor;
|
||||||
int normType;
|
int normType;
|
||||||
float minKeyPointMatchesRatio;
|
|
||||||
float minDescInliersRatio;
|
float minDescInliersRatio;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class DetectorScaleInvarianceTest : public cvtest::BaseTest
|
class DetectorScaleInvarianceTest : public cvtest::BaseTest
|
||||||
@ -419,8 +415,9 @@ protected:
|
|||||||
if(keypoints0.size() < 15)
|
if(keypoints0.size() < 15)
|
||||||
CV_Error(CV_StsAssert, "Detector gives too few points in a test image\n");
|
CV_Error(CV_StsAssert, "Detector gives too few points in a test image\n");
|
||||||
|
|
||||||
for(int scale = 2; scale <= 4; scale++)
|
for(float scaleIdx = 1; scaleIdx <= 3; scaleIdx++)
|
||||||
{
|
{
|
||||||
|
float scale = 1.f + scaleIdx * 0.5f;
|
||||||
Mat image1;
|
Mat image1;
|
||||||
resize(image0, image1, Size(), 1./scale, 1./scale);
|
resize(image0, image1, Size(), 1./scale, 1./scale);
|
||||||
|
|
||||||
@ -492,19 +489,6 @@ protected:
|
|||||||
std::cout << "keyPointMatchesRatio - " << keyPointMatchesRatio
|
std::cout << "keyPointMatchesRatio - " << keyPointMatchesRatio
|
||||||
<< " - scaleInliersRatio " << static_cast<float>(scaleInliersCount) / keyPointMatchesCount << std::endl;
|
<< " - scaleInliersRatio " << static_cast<float>(scaleInliersCount) / keyPointMatchesCount << std::endl;
|
||||||
#endif
|
#endif
|
||||||
/*vector<DMatch> filteredMatches;
|
|
||||||
for(size_t i = 0; i < matches.size(); i++)
|
|
||||||
{
|
|
||||||
if(matches[i].distance >= minIntersectRatio)
|
|
||||||
filteredMatches.push_back(matches[i]);
|
|
||||||
}
|
|
||||||
|
|
||||||
Mat out;
|
|
||||||
namedWindow("out", CV_WINDOW_NORMAL);
|
|
||||||
drawMatches(image1, keypoints1, image0, keypoints0, filteredMatches, out,
|
|
||||||
Scalar::all(-1), Scalar(-1), vector<char>(), DrawMatchesFlags::DEFAULT + DrawMatchesFlags::DRAW_RICH_KEYPOINTS);
|
|
||||||
imshow("out", out);
|
|
||||||
waitKey();*/
|
|
||||||
}
|
}
|
||||||
ts->set_failed_test_info( cvtest::TS::OK );
|
ts->set_failed_test_info( cvtest::TS::OK );
|
||||||
}
|
}
|
||||||
@ -520,12 +504,10 @@ public:
|
|||||||
DescriptorScaleInvarianceTest(const Ptr<FeatureDetector>& _featureDetector,
|
DescriptorScaleInvarianceTest(const Ptr<FeatureDetector>& _featureDetector,
|
||||||
const Ptr<DescriptorExtractor>& _descriptorExtractor,
|
const Ptr<DescriptorExtractor>& _descriptorExtractor,
|
||||||
int _normType,
|
int _normType,
|
||||||
float _minKeyPointMatchesRatio,
|
|
||||||
float _minDescInliersRatio) :
|
float _minDescInliersRatio) :
|
||||||
featureDetector(_featureDetector),
|
featureDetector(_featureDetector),
|
||||||
descriptorExtractor(_descriptorExtractor),
|
descriptorExtractor(_descriptorExtractor),
|
||||||
normType(_normType),
|
normType(_normType),
|
||||||
minKeyPointMatchesRatio(_minKeyPointMatchesRatio),
|
|
||||||
minDescInliersRatio(_minDescInliersRatio)
|
minDescInliersRatio(_minDescInliersRatio)
|
||||||
{
|
{
|
||||||
CV_Assert(!featureDetector.empty());
|
CV_Assert(!featureDetector.empty());
|
||||||
@ -555,66 +537,35 @@ protected:
|
|||||||
descriptorExtractor->compute(image0, keypoints0, descriptors0);
|
descriptorExtractor->compute(image0, keypoints0, descriptors0);
|
||||||
|
|
||||||
BFMatcher bfmatcher(normType);
|
BFMatcher bfmatcher(normType);
|
||||||
for(int scale = 2; scale <= 4; scale++)
|
for(float scaleIdx = 1; scaleIdx <= 3; scaleIdx++)
|
||||||
{
|
{
|
||||||
|
float scale = 1.f + scaleIdx * 0.5f;
|
||||||
|
|
||||||
Mat image1;
|
Mat image1;
|
||||||
resize(image0, image1, Size(), 1./scale, 1./scale);
|
resize(image0, image1, Size(), 1./scale, 1./scale);
|
||||||
|
|
||||||
vector<KeyPoint> keypoints1, osiKeypoints1; // osi - original size image
|
vector<KeyPoint> keypoints1;
|
||||||
featureDetector->detect(image1, keypoints1);
|
scaleKeyPoints(keypoints0, keypoints1, 1./scale);
|
||||||
if(keypoints1.size() < 15)
|
|
||||||
CV_Error(CV_StsAssert, "Detector gives too few points in a test image\n");
|
|
||||||
if(keypoints1.size() > keypoints0.size() )
|
|
||||||
{
|
|
||||||
ts->printf(cvtest::TS::LOG, "Strange behavior of the detector. "
|
|
||||||
"It gives more points count in an image of the smaller size.\n"
|
|
||||||
"original size (%d, %d), keypoints count = %d\n"
|
|
||||||
"reduced size (%d, %d), keypoints count = %d\n",
|
|
||||||
image0.cols, image0.rows, keypoints0.size(),
|
|
||||||
image1.cols, image1.rows, keypoints1.size());
|
|
||||||
ts->set_failed_test_info(cvtest::TS::FAIL_INVALID_OUTPUT);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
Mat descriptors1;
|
Mat descriptors1;
|
||||||
descriptorExtractor->compute(image1, keypoints1, descriptors1);
|
descriptorExtractor->compute(image1, keypoints1, descriptors1);
|
||||||
|
|
||||||
vector<DMatch> keyPointMatches, descMatches;
|
vector<DMatch> descMatches;
|
||||||
// image1 is query image (it's reduced image0)
|
bfmatcher.match(descriptors0, descriptors1, descMatches);
|
||||||
// image0 is train image
|
|
||||||
bfmatcher.match(descriptors1, descriptors0, descMatches);
|
|
||||||
|
|
||||||
scaleKeyPoints(keypoints1, osiKeypoints1, scale);
|
|
||||||
matchKeyPoints(osiKeypoints1, Mat(), keypoints0, keyPointMatches);
|
|
||||||
|
|
||||||
const float minIntersectRatio = 0.5f;
|
const float minIntersectRatio = 0.5f;
|
||||||
int keyPointMatchesCount = 0;
|
|
||||||
for(size_t m = 0; m < keyPointMatches.size(); m++)
|
|
||||||
{
|
|
||||||
if(keyPointMatches[m].distance >= minIntersectRatio)
|
|
||||||
keyPointMatchesCount++;
|
|
||||||
}
|
|
||||||
int descInliersCount = 0;
|
int descInliersCount = 0;
|
||||||
for(size_t m = 0; m < descMatches.size(); m++)
|
for(size_t m = 0; m < descMatches.size(); m++)
|
||||||
{
|
{
|
||||||
int queryIdx = descMatches[m].queryIdx;
|
const KeyPoint& transformed_p0 = keypoints0[descMatches[m].queryIdx];
|
||||||
if(keyPointMatches[queryIdx].distance >= minIntersectRatio &&
|
const KeyPoint& p1 = keypoints0[descMatches[m].trainIdx];
|
||||||
descMatches[m].trainIdx == keyPointMatches[queryIdx].trainIdx)
|
if(calcIntersectRatio(transformed_p0.pt, 0.5f * transformed_p0.size,
|
||||||
|
p1.pt, 0.5f * p1.size) >= minIntersectRatio)
|
||||||
|
{
|
||||||
descInliersCount++;
|
descInliersCount++;
|
||||||
}
|
}
|
||||||
|
|
||||||
float keyPointMatchesRatio = static_cast<float>(keyPointMatchesCount) / keypoints1.size();
|
|
||||||
if(keyPointMatchesRatio < minKeyPointMatchesRatio)
|
|
||||||
{
|
|
||||||
ts->printf(cvtest::TS::LOG, "Incorrect keyPointMatchesRatio: curr = %f, min = %f.\n",
|
|
||||||
keyPointMatchesRatio, minKeyPointMatchesRatio);
|
|
||||||
ts->set_failed_test_info(cvtest::TS::FAIL_BAD_ACCURACY);
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(keyPointMatchesCount)
|
float descInliersRatio = static_cast<float>(descInliersCount) / keypoints0.size();
|
||||||
{
|
|
||||||
float descInliersRatio = static_cast<float>(descInliersCount) / keyPointMatchesCount;
|
|
||||||
if(descInliersRatio < minDescInliersRatio)
|
if(descInliersRatio < minDescInliersRatio)
|
||||||
{
|
{
|
||||||
ts->printf(cvtest::TS::LOG, "Incorrect descInliersRatio: curr = %f, min = %f.\n",
|
ts->printf(cvtest::TS::LOG, "Incorrect descInliersRatio: curr = %f, min = %f.\n",
|
||||||
@ -622,10 +573,8 @@ protected:
|
|||||||
ts->set_failed_test_info(cvtest::TS::FAIL_BAD_ACCURACY);
|
ts->set_failed_test_info(cvtest::TS::FAIL_BAD_ACCURACY);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
#if SHOW_DEBUG_LOG
|
#if SHOW_DEBUG_LOG
|
||||||
std::cout << "keyPointMatchesRatio - " << keyPointMatchesRatio
|
std::cout << "descInliersRatio " << static_cast<float>(descInliersCount) / keypoints0.size() << std::endl;
|
||||||
<< " - descInliersRatio " << static_cast<float>(descInliersCount) / keyPointMatchesCount << std::endl;
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
ts->set_failed_test_info( cvtest::TS::OK );
|
ts->set_failed_test_info( cvtest::TS::OK );
|
||||||
@ -640,54 +589,68 @@ protected:
|
|||||||
|
|
||||||
// Tests registration
|
// Tests registration
|
||||||
|
|
||||||
// Detector's rotation invariance check
|
/*
|
||||||
|
* Detector's rotation invariance check
|
||||||
|
*/
|
||||||
TEST(Features2d_RotationInvariance_Detector_ORB, regression)
|
TEST(Features2d_RotationInvariance_Detector_ORB, regression)
|
||||||
{
|
{
|
||||||
DetectorRotationInvarianceTest test(Algorithm::create<FeatureDetector>("Feature2D.ORB"),
|
DetectorRotationInvarianceTest test(Algorithm::create<FeatureDetector>("Feature2D.ORB"),
|
||||||
0.45f,
|
0.47f,
|
||||||
0.75f);
|
0.77f);
|
||||||
test.safe_run();
|
test.safe_run();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Descriptors's rotation invariance check
|
/*
|
||||||
|
* Descriptors's rotation invariance check
|
||||||
|
*/
|
||||||
TEST(Features2d_RotationInvariance_Descriptor_ORB, regression)
|
TEST(Features2d_RotationInvariance_Descriptor_ORB, regression)
|
||||||
{
|
{
|
||||||
DescriptorRotationInvarianceTest test(Algorithm::create<FeatureDetector>("Feature2D.ORB"),
|
DescriptorRotationInvarianceTest test(Algorithm::create<FeatureDetector>("Feature2D.ORB"),
|
||||||
Algorithm::create<DescriptorExtractor>("Feature2D.ORB"),
|
Algorithm::create<DescriptorExtractor>("Feature2D.ORB"),
|
||||||
NORM_HAMMING,
|
NORM_HAMMING,
|
||||||
0.45f,
|
0.99f);
|
||||||
0.53f);
|
|
||||||
test.safe_run();
|
test.safe_run();
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Uncomment test for FREAK when it will work; add test for scale invariance for FREAK
|
|
||||||
//TEST(Features2d_RotationInvariance_Descriptor_FREAK, regression)
|
//TEST(Features2d_RotationInvariance_Descriptor_FREAK, regression)
|
||||||
//{
|
//{
|
||||||
// DescriptorRotationInvarianceTest test(Algorithm::create<FeatureDetector>("Feature2D.ORB"),
|
// DescriptorRotationInvarianceTest test(Algorithm::create<FeatureDetector>("Feature2D.ORB"),
|
||||||
// Algorithm::create<DescriptorExtractor>("Feature2D.FREAK"),
|
// Algorithm::create<DescriptorExtractor>("Feature2D.FREAK"),
|
||||||
// NORM_HAMMING(?),
|
// NORM_HAMMING,
|
||||||
// 0.45f,
|
// 0.f);
|
||||||
// 0.?f);
|
|
||||||
// test.safe_run();
|
// test.safe_run();
|
||||||
//}
|
//}
|
||||||
|
|
||||||
/* TODO: Why ORB has bad scale invariance in this tests?
|
/*
|
||||||
// Detector's scale invariance check
|
* Detector's scale invariance check
|
||||||
TEST(Features2d_ScaleInvariance_Detector_ORB, regression)
|
*/
|
||||||
{
|
|
||||||
DetectorScaleInvarianceTest test(Algorithm::create<FeatureDetector>("Feature2D.ORB"),
|
|
||||||
0.13f,
|
|
||||||
0.0f);
|
|
||||||
test.safe_run();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Descriptor's scale invariance check
|
//TEST(Features2d_ScaleInvariance_Detector_ORB, regression)
|
||||||
TEST(Features2d_ScaleInvariance_Descriptor_ORB, regression)
|
//{
|
||||||
{
|
// DetectorScaleInvarianceTest test(Algorithm::create<FeatureDetector>("Feature2D.ORB"),
|
||||||
DescriptorScaleInvarianceTest test(Algorithm::create<FeatureDetector>("Feature2D.ORB"),
|
// 0.22f,
|
||||||
Algorithm::create<DescriptorExtractor>("Feature2D.ORB"),
|
// 0.83f);
|
||||||
NORM_HAMMING,
|
// test.safe_run();
|
||||||
0.13f,
|
//}
|
||||||
0.36f);
|
|
||||||
test.safe_run();
|
/*
|
||||||
}*/
|
* Descriptor's scale invariance check
|
||||||
|
*/
|
||||||
|
|
||||||
|
//TEST(Features2d_ScaleInvariance_Descriptor_ORB, regression)
|
||||||
|
//{
|
||||||
|
// DescriptorScaleInvarianceTest test(Algorithm::create<FeatureDetector>("Feature2D.ORB"),
|
||||||
|
// Algorithm::create<DescriptorExtractor>("Feature2D.ORB"),
|
||||||
|
// NORM_HAMMING,
|
||||||
|
// 0.01f);
|
||||||
|
// test.safe_run();
|
||||||
|
//}
|
||||||
|
|
||||||
|
//TEST(Features2d_ScaleInvariance_Descriptor_FREAK, regression)
|
||||||
|
//{
|
||||||
|
// DescriptorScaleInvarianceTest test(Algorithm::create<FeatureDetector>("Feature2D.ORB"),
|
||||||
|
// Algorithm::create<DescriptorExtractor>("Feature2D.FREAK"),
|
||||||
|
// NORM_HAMMING,
|
||||||
|
// 0.01f);
|
||||||
|
// test.safe_run();
|
||||||
|
//}
|
||||||
|
@ -85,6 +85,32 @@ Mat rotateImage(const Mat& srcImage, float angle, Mat& dstImage, Mat& dstMask)
|
|||||||
return H;
|
return H;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void rotateKeyPoints(const vector<KeyPoint>& src, const Mat& H, float angle, vector<KeyPoint>& dst)
|
||||||
|
{
|
||||||
|
// suppose that H is rotation given from rotateImage() and angle has value passed to rotateImage()
|
||||||
|
vector<Point2f> srcCenters, dstCenters;
|
||||||
|
KeyPoint::convert(src, srcCenters);
|
||||||
|
|
||||||
|
perspectiveTransform(srcCenters, dstCenters, H);
|
||||||
|
|
||||||
|
dst = src;
|
||||||
|
for(size_t i = 0; i < dst.size(); i++)
|
||||||
|
{
|
||||||
|
dst[i].pt = dstCenters[i];
|
||||||
|
float dstAngle = src[i].angle + angle;
|
||||||
|
if(dstAngle >= 360.f)
|
||||||
|
dstAngle -= 360.f;
|
||||||
|
dst[i].angle = dstAngle;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void scaleKeyPoints(const vector<KeyPoint>& src, vector<KeyPoint>& dst, float scale)
|
||||||
|
{
|
||||||
|
dst.resize(src.size());
|
||||||
|
for(size_t i = 0; i < src.size(); i++)
|
||||||
|
dst[i] = KeyPoint(src[i].pt.x * scale, src[i].pt.y * scale, src[i].size * scale);
|
||||||
|
}
|
||||||
|
|
||||||
static
|
static
|
||||||
float calcCirclesIntersectArea(const Point2f& p0, float r0, const Point2f& p1, float r1)
|
float calcCirclesIntersectArea(const Point2f& p0, float r0, const Point2f& p1, float r1)
|
||||||
{
|
{
|
||||||
@ -269,25 +295,16 @@ protected:
|
|||||||
float minAngleInliersRatio;
|
float minAngleInliersRatio;
|
||||||
};
|
};
|
||||||
|
|
||||||
void scaleKeyPoints(const vector<KeyPoint>& src, vector<KeyPoint>& dst, float scale)
|
|
||||||
{
|
|
||||||
dst.resize(src.size());
|
|
||||||
for(size_t i = 0; i < src.size(); i++)
|
|
||||||
dst[i] = KeyPoint(src[i].pt.x * scale, src[i].pt.y * scale, src[i].size * scale);
|
|
||||||
}
|
|
||||||
|
|
||||||
class DescriptorRotationInvarianceTest : public cvtest::BaseTest
|
class DescriptorRotationInvarianceTest : public cvtest::BaseTest
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
DescriptorRotationInvarianceTest(const Ptr<FeatureDetector>& _featureDetector,
|
DescriptorRotationInvarianceTest(const Ptr<FeatureDetector>& _featureDetector,
|
||||||
const Ptr<DescriptorExtractor>& _descriptorExtractor,
|
const Ptr<DescriptorExtractor>& _descriptorExtractor,
|
||||||
int _normType,
|
int _normType,
|
||||||
float _minKeyPointMatchesRatio,
|
|
||||||
float _minDescInliersRatio) :
|
float _minDescInliersRatio) :
|
||||||
featureDetector(_featureDetector),
|
featureDetector(_featureDetector),
|
||||||
descriptorExtractor(_descriptorExtractor),
|
descriptorExtractor(_descriptorExtractor),
|
||||||
normType(_normType),
|
normType(_normType),
|
||||||
minKeyPointMatchesRatio(_minKeyPointMatchesRatio),
|
|
||||||
minDescInliersRatio(_minDescInliersRatio)
|
minDescInliersRatio(_minDescInliersRatio)
|
||||||
{
|
{
|
||||||
CV_Assert(!featureDetector.empty());
|
CV_Assert(!featureDetector.empty());
|
||||||
@ -318,50 +335,33 @@ protected:
|
|||||||
|
|
||||||
BFMatcher bfmatcher(normType);
|
BFMatcher bfmatcher(normType);
|
||||||
|
|
||||||
|
const float minIntersectRatio = 0.5f;
|
||||||
const int maxAngle = 360, angleStep = 15;
|
const int maxAngle = 360, angleStep = 15;
|
||||||
for(int angle = 0; angle < maxAngle; angle += angleStep)
|
for(int angle = 0; angle < maxAngle; angle += angleStep)
|
||||||
{
|
{
|
||||||
Mat H = rotateImage(image0, angle, image1, mask1);
|
Mat H = rotateImage(image0, angle, image1, mask1);
|
||||||
|
|
||||||
vector<KeyPoint> keypoints1;
|
vector<KeyPoint> keypoints1;
|
||||||
|
rotateKeyPoints(keypoints0, H, angle, keypoints1);
|
||||||
Mat descriptors1;
|
Mat descriptors1;
|
||||||
featureDetector->detect(image1, keypoints1, mask1);
|
|
||||||
descriptorExtractor->compute(image1, keypoints1, descriptors1);
|
descriptorExtractor->compute(image1, keypoints1, descriptors1);
|
||||||
|
|
||||||
vector<DMatch> descMatches;
|
vector<DMatch> descMatches;
|
||||||
bfmatcher.match(descriptors0, descriptors1, descMatches);
|
bfmatcher.match(descriptors0, descriptors1, descMatches);
|
||||||
|
|
||||||
vector<DMatch> keyPointMatches;
|
|
||||||
matchKeyPoints(keypoints0, H, keypoints1, keyPointMatches);
|
|
||||||
|
|
||||||
const float minIntersectRatio = 0.5f;
|
|
||||||
int keyPointMatchesCount = 0;
|
|
||||||
for(size_t m = 0; m < keyPointMatches.size(); m++)
|
|
||||||
{
|
|
||||||
if(keyPointMatches[m].distance >= minIntersectRatio)
|
|
||||||
keyPointMatchesCount++;
|
|
||||||
}
|
|
||||||
int descInliersCount = 0;
|
int descInliersCount = 0;
|
||||||
for(size_t m = 0; m < descMatches.size(); m++)
|
for(size_t m = 0; m < descMatches.size(); m++)
|
||||||
{
|
{
|
||||||
int queryIdx = descMatches[m].queryIdx;
|
const KeyPoint& transformed_p0 = keypoints1[descMatches[m].queryIdx];
|
||||||
if(keyPointMatches[queryIdx].distance >= minIntersectRatio &&
|
const KeyPoint& p1 = keypoints1[descMatches[m].trainIdx];
|
||||||
descMatches[m].trainIdx == keyPointMatches[queryIdx].trainIdx)
|
if(calcIntersectRatio(transformed_p0.pt, 0.5f * transformed_p0.size,
|
||||||
|
p1.pt, 0.5f * p1.size) >= minIntersectRatio)
|
||||||
|
{
|
||||||
descInliersCount++;
|
descInliersCount++;
|
||||||
}
|
}
|
||||||
|
|
||||||
float keyPointMatchesRatio = static_cast<float>(keyPointMatchesCount) / keypoints0.size();
|
|
||||||
if(keyPointMatchesRatio < minKeyPointMatchesRatio)
|
|
||||||
{
|
|
||||||
ts->printf(cvtest::TS::LOG, "Incorrect keyPointMatchesRatio: curr = %f, min = %f.\n",
|
|
||||||
keyPointMatchesRatio, minKeyPointMatchesRatio);
|
|
||||||
ts->set_failed_test_info(cvtest::TS::FAIL_BAD_ACCURACY);
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(keyPointMatchesCount)
|
float descInliersRatio = static_cast<float>(descInliersCount) / keypoints0.size();
|
||||||
{
|
|
||||||
float descInliersRatio = static_cast<float>(descInliersCount) / keyPointMatchesCount;
|
|
||||||
if(descInliersRatio < minDescInliersRatio)
|
if(descInliersRatio < minDescInliersRatio)
|
||||||
{
|
{
|
||||||
ts->printf(cvtest::TS::LOG, "Incorrect descInliersRatio: curr = %f, min = %f.\n",
|
ts->printf(cvtest::TS::LOG, "Incorrect descInliersRatio: curr = %f, min = %f.\n",
|
||||||
@ -369,10 +369,8 @@ protected:
|
|||||||
ts->set_failed_test_info(cvtest::TS::FAIL_BAD_ACCURACY);
|
ts->set_failed_test_info(cvtest::TS::FAIL_BAD_ACCURACY);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
#if SHOW_DEBUG_LOG
|
#if SHOW_DEBUG_LOG
|
||||||
std::cout << "keyPointMatchesRatio - " << keyPointMatchesRatio
|
std::cout << "descInliersRatio " << static_cast<float>(descInliersCount) / keypoints0.size() << std::endl;
|
||||||
<< " - descInliersRatio " << static_cast<float>(descInliersCount) / keyPointMatchesCount << std::endl;
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
ts->set_failed_test_info( cvtest::TS::OK );
|
ts->set_failed_test_info( cvtest::TS::OK );
|
||||||
@ -381,9 +379,7 @@ protected:
|
|||||||
Ptr<FeatureDetector> featureDetector;
|
Ptr<FeatureDetector> featureDetector;
|
||||||
Ptr<DescriptorExtractor> descriptorExtractor;
|
Ptr<DescriptorExtractor> descriptorExtractor;
|
||||||
int normType;
|
int normType;
|
||||||
float minKeyPointMatchesRatio;
|
|
||||||
float minDescInliersRatio;
|
float minDescInliersRatio;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class DetectorScaleInvarianceTest : public cvtest::BaseTest
|
class DetectorScaleInvarianceTest : public cvtest::BaseTest
|
||||||
@ -419,8 +415,9 @@ protected:
|
|||||||
if(keypoints0.size() < 15)
|
if(keypoints0.size() < 15)
|
||||||
CV_Error(CV_StsAssert, "Detector gives too few points in a test image\n");
|
CV_Error(CV_StsAssert, "Detector gives too few points in a test image\n");
|
||||||
|
|
||||||
for(int scale = 2; scale <= 4; scale++)
|
for(float scaleIdx = 1; scaleIdx <= 3; scaleIdx++)
|
||||||
{
|
{
|
||||||
|
float scale = 1.f + scaleIdx * 0.5f;
|
||||||
Mat image1;
|
Mat image1;
|
||||||
resize(image0, image1, Size(), 1./scale, 1./scale);
|
resize(image0, image1, Size(), 1./scale, 1./scale);
|
||||||
|
|
||||||
@ -507,12 +504,10 @@ public:
|
|||||||
DescriptorScaleInvarianceTest(const Ptr<FeatureDetector>& _featureDetector,
|
DescriptorScaleInvarianceTest(const Ptr<FeatureDetector>& _featureDetector,
|
||||||
const Ptr<DescriptorExtractor>& _descriptorExtractor,
|
const Ptr<DescriptorExtractor>& _descriptorExtractor,
|
||||||
int _normType,
|
int _normType,
|
||||||
float _minKeyPointMatchesRatio,
|
|
||||||
float _minDescInliersRatio) :
|
float _minDescInliersRatio) :
|
||||||
featureDetector(_featureDetector),
|
featureDetector(_featureDetector),
|
||||||
descriptorExtractor(_descriptorExtractor),
|
descriptorExtractor(_descriptorExtractor),
|
||||||
normType(_normType),
|
normType(_normType),
|
||||||
minKeyPointMatchesRatio(_minKeyPointMatchesRatio),
|
|
||||||
minDescInliersRatio(_minDescInliersRatio)
|
minDescInliersRatio(_minDescInliersRatio)
|
||||||
{
|
{
|
||||||
CV_Assert(!featureDetector.empty());
|
CV_Assert(!featureDetector.empty());
|
||||||
@ -542,66 +537,35 @@ protected:
|
|||||||
descriptorExtractor->compute(image0, keypoints0, descriptors0);
|
descriptorExtractor->compute(image0, keypoints0, descriptors0);
|
||||||
|
|
||||||
BFMatcher bfmatcher(normType);
|
BFMatcher bfmatcher(normType);
|
||||||
for(int scale = 2; scale <= 4; scale++)
|
for(float scaleIdx = 1; scaleIdx <= 3; scaleIdx++)
|
||||||
{
|
{
|
||||||
|
float scale = 1.f + scaleIdx * 0.5f;
|
||||||
|
|
||||||
Mat image1;
|
Mat image1;
|
||||||
resize(image0, image1, Size(), 1./scale, 1./scale);
|
resize(image0, image1, Size(), 1./scale, 1./scale);
|
||||||
|
|
||||||
vector<KeyPoint> keypoints1, osiKeypoints1; // osi - original size image
|
vector<KeyPoint> keypoints1;
|
||||||
featureDetector->detect(image1, keypoints1);
|
scaleKeyPoints(keypoints0, keypoints1, 1./scale);
|
||||||
if(keypoints1.size() < 15)
|
|
||||||
CV_Error(CV_StsAssert, "Detector gives too few points in a test image\n");
|
|
||||||
if(keypoints1.size() > keypoints0.size() )
|
|
||||||
{
|
|
||||||
ts->printf(cvtest::TS::LOG, "Strange behavior of the detector. "
|
|
||||||
"It gives more points count in an image of the smaller size.\n"
|
|
||||||
"original size (%d, %d), keypoints count = %d\n"
|
|
||||||
"reduced size (%d, %d), keypoints count = %d\n",
|
|
||||||
image0.cols, image0.rows, keypoints0.size(),
|
|
||||||
image1.cols, image1.rows, keypoints1.size());
|
|
||||||
ts->set_failed_test_info(cvtest::TS::FAIL_INVALID_OUTPUT);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
Mat descriptors1;
|
Mat descriptors1;
|
||||||
descriptorExtractor->compute(image1, keypoints1, descriptors1);
|
descriptorExtractor->compute(image1, keypoints1, descriptors1);
|
||||||
|
|
||||||
vector<DMatch> keyPointMatches, descMatches;
|
vector<DMatch> descMatches;
|
||||||
// image1 is query image (it's reduced image0)
|
bfmatcher.match(descriptors0, descriptors1, descMatches);
|
||||||
// image0 is train image
|
|
||||||
bfmatcher.match(descriptors1, descriptors0, descMatches);
|
|
||||||
|
|
||||||
scaleKeyPoints(keypoints1, osiKeypoints1, scale);
|
|
||||||
matchKeyPoints(osiKeypoints1, Mat(), keypoints0, keyPointMatches);
|
|
||||||
|
|
||||||
const float minIntersectRatio = 0.5f;
|
const float minIntersectRatio = 0.5f;
|
||||||
int keyPointMatchesCount = 0;
|
|
||||||
for(size_t m = 0; m < keyPointMatches.size(); m++)
|
|
||||||
{
|
|
||||||
if(keyPointMatches[m].distance >= minIntersectRatio)
|
|
||||||
keyPointMatchesCount++;
|
|
||||||
}
|
|
||||||
int descInliersCount = 0;
|
int descInliersCount = 0;
|
||||||
for(size_t m = 0; m < descMatches.size(); m++)
|
for(size_t m = 0; m < descMatches.size(); m++)
|
||||||
{
|
{
|
||||||
int queryIdx = descMatches[m].queryIdx;
|
const KeyPoint& transformed_p0 = keypoints0[descMatches[m].queryIdx];
|
||||||
if(keyPointMatches[queryIdx].distance >= minIntersectRatio &&
|
const KeyPoint& p1 = keypoints0[descMatches[m].trainIdx];
|
||||||
descMatches[m].trainIdx == keyPointMatches[queryIdx].trainIdx)
|
if(calcIntersectRatio(transformed_p0.pt, 0.5f * transformed_p0.size,
|
||||||
|
p1.pt, 0.5f * p1.size) >= minIntersectRatio)
|
||||||
|
{
|
||||||
descInliersCount++;
|
descInliersCount++;
|
||||||
}
|
}
|
||||||
|
|
||||||
float keyPointMatchesRatio = static_cast<float>(keyPointMatchesCount) / keypoints1.size();
|
|
||||||
if(keyPointMatchesRatio < minKeyPointMatchesRatio)
|
|
||||||
{
|
|
||||||
ts->printf(cvtest::TS::LOG, "Incorrect keyPointMatchesRatio: curr = %f, min = %f.\n",
|
|
||||||
keyPointMatchesRatio, minKeyPointMatchesRatio);
|
|
||||||
ts->set_failed_test_info(cvtest::TS::FAIL_BAD_ACCURACY);
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(keyPointMatchesCount)
|
float descInliersRatio = static_cast<float>(descInliersCount) / keypoints0.size();
|
||||||
{
|
|
||||||
float descInliersRatio = static_cast<float>(descInliersCount) / keyPointMatchesCount;
|
|
||||||
if(descInliersRatio < minDescInliersRatio)
|
if(descInliersRatio < minDescInliersRatio)
|
||||||
{
|
{
|
||||||
ts->printf(cvtest::TS::LOG, "Incorrect descInliersRatio: curr = %f, min = %f.\n",
|
ts->printf(cvtest::TS::LOG, "Incorrect descInliersRatio: curr = %f, min = %f.\n",
|
||||||
@ -609,10 +573,8 @@ protected:
|
|||||||
ts->set_failed_test_info(cvtest::TS::FAIL_BAD_ACCURACY);
|
ts->set_failed_test_info(cvtest::TS::FAIL_BAD_ACCURACY);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
#if SHOW_DEBUG_LOG
|
#if SHOW_DEBUG_LOG
|
||||||
std::cout << "keyPointMatchesRatio - " << keyPointMatchesRatio
|
std::cout << "descInliersRatio " << static_cast<float>(descInliersCount) / keypoints0.size() << std::endl;
|
||||||
<< " - descInliersRatio " << static_cast<float>(descInliersCount) / keyPointMatchesCount << std::endl;
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
ts->set_failed_test_info( cvtest::TS::OK );
|
ts->set_failed_test_info( cvtest::TS::OK );
|
||||||
@ -627,11 +589,13 @@ protected:
|
|||||||
|
|
||||||
// Tests registration
|
// Tests registration
|
||||||
|
|
||||||
// Detector's rotation invariance check
|
/*
|
||||||
|
* Detector's rotation invariance check
|
||||||
|
*/
|
||||||
TEST(Features2d_RotationInvariance_Detector_SURF, regression)
|
TEST(Features2d_RotationInvariance_Detector_SURF, regression)
|
||||||
{
|
{
|
||||||
DetectorRotationInvarianceTest test(Algorithm::create<FeatureDetector>("Feature2D.SURF"),
|
DetectorRotationInvarianceTest test(Algorithm::create<FeatureDetector>("Feature2D.SURF"),
|
||||||
0.44f,
|
0.45f,
|
||||||
0.76f);
|
0.76f);
|
||||||
test.safe_run();
|
test.safe_run();
|
||||||
}
|
}
|
||||||
@ -639,19 +603,20 @@ TEST(Features2d_RotationInvariance_Detector_SURF, regression)
|
|||||||
TEST(Features2d_RotationInvariance_Detector_SIFT, regression)
|
TEST(Features2d_RotationInvariance_Detector_SIFT, regression)
|
||||||
{
|
{
|
||||||
DetectorRotationInvarianceTest test(Algorithm::create<FeatureDetector>("Feature2D.SIFT"),
|
DetectorRotationInvarianceTest test(Algorithm::create<FeatureDetector>("Feature2D.SIFT"),
|
||||||
0.64f,
|
0.75f,
|
||||||
0.74f);
|
0.76f);
|
||||||
test.safe_run();
|
test.safe_run();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Descriptors's rotation invariance check
|
/*
|
||||||
|
* Descriptors's rotation invariance check
|
||||||
|
*/
|
||||||
TEST(Features2d_RotationInvariance_Descriptor_SURF, regression)
|
TEST(Features2d_RotationInvariance_Descriptor_SURF, regression)
|
||||||
{
|
{
|
||||||
DescriptorRotationInvarianceTest test(Algorithm::create<FeatureDetector>("Feature2D.SURF"),
|
DescriptorRotationInvarianceTest test(Algorithm::create<FeatureDetector>("Feature2D.SURF"),
|
||||||
Algorithm::create<DescriptorExtractor>("Feature2D.SURF"),
|
Algorithm::create<DescriptorExtractor>("Feature2D.SURF"),
|
||||||
NORM_L1,
|
NORM_L1,
|
||||||
0.44f,
|
0.83f);
|
||||||
0.63f);
|
|
||||||
test.safe_run();
|
test.safe_run();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -660,45 +625,46 @@ TEST(Features2d_RotationInvariance_Descriptor_SIFT, regression)
|
|||||||
DescriptorRotationInvarianceTest test(Algorithm::create<FeatureDetector>("Feature2D.SIFT"),
|
DescriptorRotationInvarianceTest test(Algorithm::create<FeatureDetector>("Feature2D.SIFT"),
|
||||||
Algorithm::create<DescriptorExtractor>("Feature2D.SIFT"),
|
Algorithm::create<DescriptorExtractor>("Feature2D.SIFT"),
|
||||||
NORM_L1,
|
NORM_L1,
|
||||||
0.64f,
|
0.98f);
|
||||||
0.72f);
|
|
||||||
test.safe_run();
|
test.safe_run();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Detector's scale invariance check
|
/*
|
||||||
|
* Detector's scale invariance check
|
||||||
|
*/
|
||||||
TEST(Features2d_ScaleInvariance_Detector_SURF, regression)
|
TEST(Features2d_ScaleInvariance_Detector_SURF, regression)
|
||||||
{
|
{
|
||||||
DetectorScaleInvarianceTest test(Algorithm::create<FeatureDetector>("Feature2D.SURF"),
|
DetectorScaleInvarianceTest test(Algorithm::create<FeatureDetector>("Feature2D.SURF"),
|
||||||
0.62f,
|
0.64f,
|
||||||
0.68f);
|
0.84f);
|
||||||
test.safe_run();
|
test.safe_run();
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(Features2d_ScaleInvariance_Detector_SIFT, regression)
|
TEST(Features2d_ScaleInvariance_Detector_SIFT, regression)
|
||||||
{
|
{
|
||||||
DetectorScaleInvarianceTest test(Algorithm::create<FeatureDetector>("Feature2D.SIFT"),
|
DetectorScaleInvarianceTest test(Algorithm::create<FeatureDetector>("Feature2D.SIFT"),
|
||||||
0.59f,
|
0.69f,
|
||||||
0.94f);
|
0.99f);
|
||||||
test.safe_run();
|
test.safe_run();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Descriptor's scale invariance check
|
/*
|
||||||
|
* Descriptor's scale invariance check
|
||||||
|
*/
|
||||||
TEST(Features2d_ScaleInvariance_Descriptor_SURF, regression)
|
TEST(Features2d_ScaleInvariance_Descriptor_SURF, regression)
|
||||||
{
|
{
|
||||||
DescriptorScaleInvarianceTest test(Algorithm::create<FeatureDetector>("Feature2D.SURF"),
|
DescriptorScaleInvarianceTest test(Algorithm::create<FeatureDetector>("Feature2D.SURF"),
|
||||||
Algorithm::create<DescriptorExtractor>("Feature2D.SURF"),
|
Algorithm::create<DescriptorExtractor>("Feature2D.SURF"),
|
||||||
NORM_L1,
|
NORM_L1,
|
||||||
0.62f,
|
0.61f);
|
||||||
0.68f);
|
|
||||||
test.safe_run();
|
test.safe_run();
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(Features2d_ScaleInvariance_Descriptor_SIFT, regression)
|
//TEST(Features2d_ScaleInvariance_Descriptor_SIFT, regression)
|
||||||
{
|
//{
|
||||||
DescriptorScaleInvarianceTest test(Algorithm::create<FeatureDetector>("Feature2D.SIFT"),
|
// DescriptorScaleInvarianceTest test(Algorithm::create<FeatureDetector>("Feature2D.SIFT"),
|
||||||
Algorithm::create<DescriptorExtractor>("Feature2D.SIFT"),
|
// Algorithm::create<DescriptorExtractor>("Feature2D.SIFT"),
|
||||||
NORM_L1,
|
// NORM_L1,
|
||||||
0.59f,
|
// 0.14f);
|
||||||
0.78f);
|
// test.safe_run();
|
||||||
test.safe_run();
|
//}
|
||||||
}
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user