Skip to content

Commit 070e89e

Browse files
committed
Merge pull request #473 from mshabunin:add_msd_detector
2 parents 742d9c9 + 6960aac commit 070e89e

File tree

5 files changed

+850
-1
lines changed

5 files changed

+850
-1
lines changed

modules/xfeatures2d/doc/xfeatures2d.bib

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,3 +64,10 @@ @article{Tola10
6464
volume = "32",
6565
number = "5"
6666
}
67+
68+
@inproceedings{Tombari14,
69+
title={Interest Points via Maximal Self-Dissimilarities},
70+
author={Tombari, Federico and Di Stefano, Luigi},
71+
booktitle={Asian Conference on Computer Vision -- ACCV 2014},
72+
year={2014}
73+
}

modules/xfeatures2d/include/opencv2/xfeatures2d.hpp

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ LATCH is a binary descriptor based on learned comparisons of triplets of image p
159159
* half_ssd_size - the size of half of the mini-patches size. For example, if we would like to compare triplets of patches of size 7x7x
160160
then the half_ssd_size should be (7-1)/2 = 3.
161161
162-
Note: the descriptor can be coupled with any keypoint extractor. The only demand is that if you use set rotationInvariance = True then
162+
Note: the descriptor can be coupled with any keypoint extractor. The only demand is that if you use set rotationInvariance = True then
163163
you will have to use an extractor which estimates the patch orientation (in degrees). Examples for such extractors are ORB and SIFT.
164164
165165
Note: a complete example can be found under /samples/cpp/tutorial_code/xfeatures2D/latch_match.cpp
@@ -258,6 +258,27 @@ class CV_EXPORTS_W DAISY : public Feature2D
258258

259259
};
260260

261+
/** @brief Class implementing the MSD (*Maximal Self-Dissimilarity*) keypoint detector, described in @cite Tombari14.
262+
263+
The algorithm implements a novel interest point detector stemming from the intuition that image patches
264+
which are highly dissimilar over a relatively large extent of their surroundings hold the property of
265+
being repeatable and distinctive. This concept of "contextual self-dissimilarity" reverses the key
266+
paradigm of recent successful techniques such as the Local Self-Similarity descriptor and the Non-Local
267+
Means filter, which build upon the presence of similar - rather than dissimilar - patches. Moreover,
268+
it extends to contextual information the local self-dissimilarity notion embedded in established
269+
detectors of corner-like interest points, thereby achieving enhanced repeatability, distinctiveness and
270+
localization accuracy.
271+
272+
*/
273+
274+
class CV_EXPORTS_W MSDDetector : public Feature2D {
275+
276+
public:
277+
278+
static Ptr<MSDDetector> create(int m_patch_radius = 3, int m_search_area_radius = 5,
279+
int m_nms_radius = 5, int m_nms_scale_radius = 0, float m_th_saliency = 250.0f, int m_kNN = 4,
280+
float m_scale_factor = 1.25f, int m_n_scales = -1, bool m_compute_orientation = false);
281+
};
261282

262283
//! @}
263284

modules/xfeatures2d/perf/perf_msd.cpp

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
#include "perf_precomp.hpp"
2+
3+
using namespace std;
4+
using namespace cv;
5+
using namespace xfeatures2d;
6+
using namespace perf;
7+
using std::tr1::make_tuple;
8+
using std::tr1::get;
9+
10+
typedef perf::TestBaseWithParam<std::string> msd;
11+
12+
#define MSD_IMAGES \
13+
"cv/detectors_descriptors_evaluation/images_datasets/leuven/img1.png",\
14+
"stitching/a3.png"
15+
16+
PERF_TEST_P(msd, detect, testing::Values(MSD_IMAGES))
17+
{
18+
string filename = getDataPath(GetParam());
19+
Mat frame = imread(filename, IMREAD_GRAYSCALE);
20+
21+
if (frame.empty())
22+
FAIL() << "Unable to load source image " << filename;
23+
24+
Mat mask;
25+
declare.in(frame);
26+
Ptr<MSDDetector> detector = MSDDetector::create();
27+
vector<KeyPoint> points;
28+
29+
TEST_CYCLE() detector->detect(frame, points, mask);
30+
31+
sort(points.begin(), points.end(), comparators::KeypointGreater());
32+
SANITY_CHECK_KEYPOINTS(points, 1e-3);
33+
}

0 commit comments

Comments
 (0)