From: Maria Dimashova Date: Wed, 11 May 2011 12:59:36 +0000 (+0000) Subject: restored 2 methods (for backward compatibility) X-Git-Tag: accepted/tizen/6.0/unified/20201030.111113~7375 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=c46b510f4c700eae4723ba972dff7603f60bf9f5;p=platform%2Fupstream%2Fopencv.git restored 2 methods (for backward compatibility) --- diff --git a/modules/features2d/include/opencv2/features2d/features2d.hpp b/modules/features2d/include/opencv2/features2d/features2d.hpp index 489bf8d..a9e9739 100644 --- a/modules/features2d/include/opencv2/features2d/features2d.hpp +++ b/modules/features2d/include/opencv2/features2d/features2d.hpp @@ -1248,6 +1248,13 @@ public: protected: virtual void detectImpl( const Mat& image, vector& keypoints, const Mat& mask=Mat() ) const = 0; + + /* + * Remove keypoints that are not in the mask. + * Helper function, useful when wrapping a library call for keypoint detection that + * does not support a mask argument. + */ + static void removeInvalidPoints( const Mat& mask, vector& keypoints ); }; class CV_EXPORTS FastFeatureDetector : public FeatureDetector @@ -1258,7 +1265,7 @@ public: virtual void write( FileStorage& fs ) const; protected: - virtual void detectImpl( const Mat& image, vector& keypoints, const Mat& mask=Mat() ) const; + virtual void detectImpl( const Mat& image, vector& keypoints, const Mat& mask=Mat() ) const; int threshold; bool nonmaxSuppression; @@ -1291,9 +1298,9 @@ public: virtual void write( FileStorage& fs ) const; protected: - virtual void detectImpl( const Mat& image, vector& keypoints, const Mat& mask=Mat() ) const; - - Params params; + virtual void detectImpl( const Mat& image, vector& keypoints, const Mat& mask=Mat() ) const; + + Params params; }; class CV_EXPORTS MserFeatureDetector : public FeatureDetector @@ -1306,7 +1313,7 @@ public: virtual void write( FileStorage& fs ) const; protected: - virtual void detectImpl( const Mat& image, vector& keypoints, const Mat& mask=Mat() ) const; + virtual void detectImpl( const Mat& image, vector& keypoints, const Mat& mask=Mat() ) const; MSER mser; }; @@ -1321,7 +1328,7 @@ public: virtual void write( FileStorage& fs ) const; protected: - virtual void detectImpl( const Mat& image, vector& keypoints, const Mat& mask=Mat() ) const; + virtual void detectImpl( const Mat& image, vector& keypoints, const Mat& mask=Mat() ) const; StarDetector star; }; @@ -1340,7 +1347,7 @@ public: virtual void write( FileStorage& fs ) const; protected: - virtual void detectImpl( const Mat& image, vector& keypoints, const Mat& mask=Mat() ) const; + virtual void detectImpl( const Mat& image, vector& keypoints, const Mat& mask=Mat() ) const; SIFT sift; }; @@ -1353,7 +1360,7 @@ public: virtual void write( FileStorage& fs ) const; protected: - virtual void detectImpl( const Mat& image, vector& keypoints, const Mat& mask=Mat() ) const; + virtual void detectImpl( const Mat& image, vector& keypoints, const Mat& mask=Mat() ) const; SURF surf; }; @@ -1425,9 +1432,9 @@ public: // TODO implement read/write protected: - virtual void detectImpl( const Mat& image, vector& keypoints, const Mat& mask=Mat() ) const; + virtual void detectImpl( const Mat& image, vector& keypoints, const Mat& mask=Mat() ) const; - Params params; + Params params; }; /* @@ -1451,7 +1458,7 @@ public: virtual bool empty() const; protected: - virtual void detectImpl( const Mat& image, vector& keypoints, const Mat& mask=Mat() ) const; + virtual void detectImpl( const Mat& image, vector& keypoints, const Mat& mask=Mat() ) const; Ptr detector; int maxTotalKeypoints; @@ -1472,7 +1479,7 @@ public: virtual bool empty() const; protected: - virtual void detectImpl( const Mat& image, vector& keypoints, const Mat& mask=Mat() ) const; + virtual void detectImpl( const Mat& image, vector& keypoints, const Mat& mask=Mat() ) const; Ptr detector; int levels; @@ -1655,6 +1662,12 @@ public: protected: virtual void computeImpl( const Mat& image, vector& keypoints, Mat& descriptors ) const = 0; + + /* + * Remove keypoints within borderPixels of an image edge. + */ + static void removeBorderKeypoints( vector& keypoints, + Size imageSize, int borderSize ); }; /* diff --git a/modules/features2d/src/descriptors.cpp b/modules/features2d/src/descriptors.cpp index 82dffd3..fb0bfb4 100644 --- a/modules/features2d/src/descriptors.cpp +++ b/modules/features2d/src/descriptors.cpp @@ -89,6 +89,12 @@ bool DescriptorExtractor::empty() const return false; } +void DescriptorExtractor::removeBorderKeypoints( vector& keypoints, + Size imageSize, int borderSize ) +{ + KeyPointsFilter::runByImageBorder( keypoints, imageSize, borderSize ); +} + Ptr DescriptorExtractor::create(const string& descriptorExtractorType) { DescriptorExtractor* de = 0; diff --git a/modules/features2d/src/detectors.cpp b/modules/features2d/src/detectors.cpp index 552adf3..c6efe00 100644 --- a/modules/features2d/src/detectors.cpp +++ b/modules/features2d/src/detectors.cpp @@ -82,6 +82,11 @@ bool FeatureDetector::empty() const return false; } +void FeatureDetector::removeInvalidPoints( const Mat& mask, vector& keypoints ) +{ + KeyPointsFilter::runByPixelsMask( keypoints, mask ); +} + Ptr FeatureDetector::create( const string& detectorType ) { FeatureDetector* fd = 0;