From db262fa76acb4f0796b8c6e47ddc6b17ad5681c1 Mon Sep 17 00:00:00 2001 From: Hamdi Sahloul Date: Thu, 16 Aug 2018 22:57:55 +0900 Subject: [PATCH] Avoid multi-inheritance in the cuda::features2d classes --- modules/cudafeatures2d/include/opencv2/cudafeatures2d.hpp | 11 ++++++----- modules/cudafeatures2d/src/fast.cpp | 6 +++--- modules/cudafeatures2d/src/orb.cpp | 4 ++-- 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/modules/cudafeatures2d/include/opencv2/cudafeatures2d.hpp b/modules/cudafeatures2d/include/opencv2/cudafeatures2d.hpp index 27a0ddd..2c8a0fb 100644 --- a/modules/cudafeatures2d/include/opencv2/cudafeatures2d.hpp +++ b/modules/cudafeatures2d/include/opencv2/cudafeatures2d.hpp @@ -374,7 +374,7 @@ public: /** @brief Abstract base class for CUDA asynchronous 2D image feature detectors and descriptor extractors. */ -class CV_EXPORTS Feature2DAsync +class CV_EXPORTS Feature2DAsync : public cv::Feature2D { public: virtual ~Feature2DAsync(); @@ -423,7 +423,7 @@ public: /** @brief Wrapping class for feature detection using the FAST method. */ -class CV_EXPORTS FastFeatureDetector : public cv::FastFeatureDetector, public Feature2DAsync +class CV_EXPORTS FastFeatureDetector : public Feature2DAsync { public: enum @@ -437,8 +437,9 @@ public: static Ptr create(int threshold=10, bool nonmaxSuppression=true, - int type=FastFeatureDetector::TYPE_9_16, + int type=cv::FastFeatureDetector::TYPE_9_16, int max_npoints = 5000); + virtual void setThreshold(int threshold) = 0; virtual void setMaxNumPoints(int max_npoints) = 0; virtual int getMaxNumPoints() const = 0; @@ -452,7 +453,7 @@ public: * * @sa cv::ORB */ -class CV_EXPORTS ORB : public cv::ORB, public Feature2DAsync +class CV_EXPORTS ORB : public Feature2DAsync { public: enum @@ -472,7 +473,7 @@ public: int edgeThreshold=31, int firstLevel=0, int WTA_K=2, - int scoreType=ORB::HARRIS_SCORE, + int scoreType=cv::ORB::HARRIS_SCORE, int patchSize=31, int fastThreshold=20, bool blurForDescriptor=false); diff --git a/modules/cudafeatures2d/src/fast.cpp b/modules/cudafeatures2d/src/fast.cpp index e48ef18..e2c13b0 100644 --- a/modules/cudafeatures2d/src/fast.cpp +++ b/modules/cudafeatures2d/src/fast.cpp @@ -81,8 +81,8 @@ namespace virtual void setMaxNumPoints(int max_npoints) { max_npoints_ = max_npoints; } virtual int getMaxNumPoints() const { return max_npoints_; } - virtual void setType(int type) { CV_Assert( type == TYPE_9_16 ); } - virtual int getType() const { return TYPE_9_16; } + virtual void setType(int type) { CV_Assert( type == cv::FastFeatureDetector::TYPE_9_16 ); } + virtual int getType() const { return cv::FastFeatureDetector::TYPE_9_16; } private: int threshold_; @@ -207,7 +207,7 @@ namespace Ptr cv::cuda::FastFeatureDetector::create(int threshold, bool nonmaxSuppression, int type, int max_npoints) { - CV_Assert( type == TYPE_9_16 ); + CV_Assert( type == cv::FastFeatureDetector::TYPE_9_16 ); return makePtr(threshold, nonmaxSuppression, max_npoints); } diff --git a/modules/cudafeatures2d/src/orb.cpp b/modules/cudafeatures2d/src/orb.cpp index 41a431d..75cdd7e 100644 --- a/modules/cudafeatures2d/src/orb.cpp +++ b/modules/cudafeatures2d/src/orb.cpp @@ -354,7 +354,7 @@ namespace virtual void convert(InputArray _gpu_keypoints, std::vector& keypoints); - virtual int descriptorSize() const { return kBytes; } + virtual int descriptorSize() const { return cv::ORB::kBytes; } virtual int descriptorType() const { return CV_8U; } virtual int defaultNorm() const { return NORM_HAMMING; } @@ -764,7 +764,7 @@ namespace const int n_features = static_cast(n_features_per_level_[level]); - if (scoreType_ == ORB::HARRIS_SCORE) + if (scoreType_ == cv::ORB::HARRIS_SCORE) { // Keep more points than necessary as FAST does not give amazing corners cull(keyPointsPyr_[level], keyPointsCount_[level], 2 * n_features, stream); -- 2.7.4