Skip to content

Commit c52e7fc

Browse files
Merge pull request #3244 from hakaboom:extend_orb_interface_
2 parents f6a39c5 + 4c76620 commit c52e7fc

File tree

3 files changed

+41
-5
lines changed

3 files changed

+41
-5
lines changed

modules/cudafeatures2d/include/opencv2/cudafeatures2d.hpp

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -471,12 +471,36 @@ class CV_EXPORTS_W ORB : public Feature2DAsync
471471
int fastThreshold=20,
472472
bool blurForDescriptor=false);
473473

474-
//! if true, image will be blurred before descriptors calculation
475-
CV_WRAP virtual void setBlurForDescriptor(bool blurForDescriptor) = 0;
476-
CV_WRAP virtual bool getBlurForDescriptor() const = 0;
474+
CV_WRAP virtual void setMaxFeatures(int maxFeatures) = 0;
475+
CV_WRAP virtual int getMaxFeatures() const = 0;
476+
477+
CV_WRAP virtual void setScaleFactor(double scaleFactor) = 0;
478+
CV_WRAP virtual double getScaleFactor() const = 0;
479+
480+
CV_WRAP virtual void setNLevels(int nlevels) = 0;
481+
CV_WRAP virtual int getNLevels() const = 0;
482+
483+
CV_WRAP virtual void setEdgeThreshold(int edgeThreshold) = 0;
484+
CV_WRAP virtual int getEdgeThreshold() const = 0;
485+
486+
CV_WRAP virtual void setFirstLevel(int firstLevel) = 0;
487+
CV_WRAP virtual int getFirstLevel() const = 0;
488+
489+
CV_WRAP virtual void setWTA_K(int wta_k) = 0;
490+
CV_WRAP virtual int getWTA_K() const = 0;
491+
492+
CV_WRAP virtual void setScoreType(int scoreType) = 0;
493+
CV_WRAP virtual int getScoreType() const = 0;
494+
495+
CV_WRAP virtual void setPatchSize(int patchSize) = 0;
496+
CV_WRAP virtual int getPatchSize() const = 0;
477497

478498
CV_WRAP virtual void setFastThreshold(int fastThreshold) = 0;
479499
CV_WRAP virtual int getFastThreshold() const = 0;
500+
501+
//! if true, image will be blurred before descriptors calculation
502+
CV_WRAP virtual void setBlurForDescriptor(bool blurForDescriptor) = 0;
503+
CV_WRAP virtual bool getBlurForDescriptor() const = 0;
480504
};
481505

482506
//! @}

modules/cudafeatures2d/misc/python/test/test_cudafeatures2d.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,18 @@ def test_cudafeatures2d(self):
2727
_kps = fast.detectAsync(cuMat1)
2828

2929
orb = cv.cuda_ORB.create()
30+
31+
orb.setMaxFeatures(500)
32+
orb.setScaleFactor(1.2)
33+
orb.setNLevels(8)
34+
orb.setEdgeThreshold(31)
35+
orb.setFirstLevel(0)
36+
orb.setWTA_K(2)
37+
orb.setScoreType(cv.ORB_HARRIS_SCORE)
38+
orb.setPatchSize(31)
39+
orb.setFastThreshold(20)
40+
orb.setBlurForDescriptor(True)
41+
3042
_kps1, descs1 = orb.detectAndComputeAsync(cuMat1, None)
3143
_kps2, descs2 = orb.detectAndComputeAsync(cuMat2, None)
3244

modules/cudafeatures2d/src/orb.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -373,13 +373,13 @@ namespace
373373
virtual void setFirstLevel(int firstLevel) { firstLevel_ = firstLevel; }
374374
virtual int getFirstLevel() const { return firstLevel_; }
375375

376-
virtual void setWTA_K(int wta_k) { WTA_K_ = wta_k; }
376+
virtual void setWTA_K(int wta_k) { CV_Assert( wta_k == 2 || wta_k == 3 || wta_k == 4 ); WTA_K_ = wta_k; }
377377
virtual int getWTA_K() const { return WTA_K_; }
378378

379379
virtual void setScoreType(int scoreType) { scoreType_ = scoreType; }
380380
virtual int getScoreType() const { return scoreType_; }
381381

382-
virtual void setPatchSize(int patchSize) { patchSize_ = patchSize; }
382+
virtual void setPatchSize(int patchSize) { CV_Assert( patchSize >= 2 ); patchSize_ = patchSize; }
383383
virtual int getPatchSize() const { return patchSize_; }
384384

385385
virtual void setFastThreshold(int fastThreshold) { fastThreshold_ = fastThreshold; }

0 commit comments

Comments
 (0)