Skip to content

Commit e5f1294

Browse files
committed
brisk add detection threshold for custom sampling pattern
1 parent 87c27a0 commit e5f1294

File tree

2 files changed

+40
-0
lines changed

2 files changed

+40
-0
lines changed

modules/features2d/include/opencv2/features2d.hpp

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,23 @@ class CV_EXPORTS_W BRISK : public Feature2D
250250
@param indexChange index remapping of the bits. */
251251
CV_WRAP static Ptr<BRISK> create(const std::vector<float> &radiusList, const std::vector<int> &numberList,
252252
float dMax=5.85f, float dMin=8.2f, const std::vector<int>& indexChange=std::vector<int>());
253+
254+
/** @brief The BRISK constructor for a custom pattern, detection threshold and octaves
255+
256+
@param thresh AGAST detection threshold score.
257+
@param octaves detection octaves. Use 0 to do single scale.
258+
@param radiusList defines the radii (in pixels) where the samples around a keypoint are taken (for
259+
keypoint scale 1).
260+
@param numberList defines the number of sampling points on the sampling circle. Must be the same
261+
size as radiusList..
262+
@param dMax threshold for the short pairings used for descriptor formation (in pixels for keypoint
263+
scale 1).
264+
@param dMin threshold for the long pairings used for orientation determination (in pixels for
265+
keypoint scale 1).
266+
@param indexChange index remapping of the bits. */
267+
CV_WRAP static Ptr<BRISK> create(int thresh, int octaves, const std::vector<float> &radiusList,
268+
const std::vector<int> &numberList, float dMax=5.85f, float dMin=8.2f,
269+
const std::vector<int>& indexChange=std::vector<int>());
253270
};
254271

255272
/** @brief Class implementing the ORB (*oriented BRIEF*) keypoint detector and descriptor extractor

modules/features2d/src/brisk.cpp

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,10 @@ class BRISK_Impl : public BRISK
5959
explicit BRISK_Impl(const std::vector<float> &radiusList, const std::vector<int> &numberList,
6060
float dMax=5.85f, float dMin=8.2f, const std::vector<int> indexChange=std::vector<int>());
6161

62+
explicit BRISK_Impl(int thresh, int octaves, const std::vector<float> &radiusList,
63+
const std::vector<int> &numberList, float dMax=5.85f, float dMin=8.2f,
64+
const std::vector<int> indexChange=std::vector<int>());
65+
6266
virtual ~BRISK_Impl();
6367

6468
int descriptorSize() const
@@ -319,6 +323,18 @@ BRISK_Impl::BRISK_Impl(const std::vector<float> &radiusList,
319323
octaves = 3;
320324
}
321325

326+
BRISK_Impl::BRISK_Impl(int thresh,
327+
int octaves_in,
328+
const std::vector<float> &radiusList,
329+
const std::vector<int> &numberList,
330+
float dMax, float dMin,
331+
const std::vector<int> indexChange)
332+
{
333+
generateKernel(radiusList, numberList, dMax, dMin, indexChange);
334+
threshold = thresh;
335+
octaves = octaves_in;
336+
}
337+
322338
void
323339
BRISK_Impl::generateKernel(const std::vector<float> &radiusList,
324340
const std::vector<int> &numberList,
@@ -2318,4 +2334,11 @@ Ptr<BRISK> BRISK::create(const std::vector<float> &radiusList, const std::vector
23182334
return makePtr<BRISK_Impl>(radiusList, numberList, dMax, dMin, indexChange);
23192335
}
23202336

2337+
Ptr<BRISK> BRISK::create(int thresh, int octaves, const std::vector<float> &radiusList,
2338+
const std::vector<int> &numberList, float dMax, float dMin,
2339+
const std::vector<int>& indexChange)
2340+
{
2341+
return makePtr<BRISK_Impl>(thresh, octaves, radiusList, numberList, dMax, dMin, indexChange);
2342+
}
2343+
23212344
}

0 commit comments

Comments
 (0)