diff --git a/modules/features2d/include/opencv2/features2d/features2d.hpp b/modules/features2d/include/opencv2/features2d/features2d.hpp index 91795a0b3c..3e49dfb8b6 100644 --- a/modules/features2d/include/opencv2/features2d/features2d.hpp +++ b/modules/features2d/include/opencv2/features2d/features2d.hpp @@ -508,12 +508,14 @@ public: * gridRows Grid rows count. * gridCols Grid column count. */ - CV_WRAP GridAdaptedFeatureDetector( const Ptr& detector, + CV_WRAP GridAdaptedFeatureDetector( const Ptr& detector=0, int maxTotalKeypoints=1000, int gridRows=4, int gridCols=4 ); // TODO implement read/write virtual bool empty() const; + + AlgorithmInfo* info() const; protected: virtual void detectImpl( const Mat& image, vector& keypoints, const Mat& mask=Mat() ) const; diff --git a/modules/features2d/src/features2d_init.cpp b/modules/features2d/src/features2d_init.cpp index 3312d9e915..6f9e07cfb5 100644 --- a/modules/features2d/src/features2d_init.cpp +++ b/modules/features2d/src/features2d_init.cpp @@ -133,15 +133,22 @@ CV_INIT_ALGORITHM(DenseFeatureDetector, "Feature2D.Dense", obj.info()->addParam(obj, "varyXyStepWithScale", obj.varyXyStepWithScale); obj.info()->addParam(obj, "varyImgBoundWithScale", obj.varyImgBoundWithScale)); +CV_INIT_ALGORITHM(GridAdaptedFeatureDetector, "Feature2D.Grid", + obj.info()->addParam(obj, "detector", (Ptr&)obj.detector); + obj.info()->addParam(obj, "maxTotalKeypoints", obj.maxTotalKeypoints); + obj.info()->addParam(obj, "gridRows", obj.gridRows); + obj.info()->addParam(obj, "gridCols", obj.gridCols)); + bool initModule_features2d(void) { Ptr brief = createBriefDescriptorExtractor(), orb = createORB(), star = createStarDetector(), fastd = createFastFeatureDetector(), mser = createMSER(), - dense = createDenseFeatureDetector(), gftt = createGFTTDetector(), harris = createHarrisDetector(); + dense = createDenseFeatureDetector(), gftt = createGFTTDetector(), + harris = createHarrisDetector(), grid = createGridAdaptedFeatureDetector(); return brief->info() != 0 && orb->info() != 0 && star->info() != 0 && fastd->info() != 0 && mser->info() != 0 && dense->info() != 0 && - gftt->info() != 0 && harris->info() != 0; + gftt->info() != 0 && harris->info() != 0 && grid->info() != 0; } }