/* Copyright (c) 2010-2016, Mathieu Labbe - IntRoLab - Universite de Sherbrooke All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of the Universite de Sherbrooke nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #ifndef FEATURES2D_H_ #define FEATURES2D_H_ #include "rtabmap/core/rtabmap_core_export.h" // DLL export/import defines #include #include #if CV_MAJOR_VERSION < 5 #include #else #include #endif #include #include #include "rtabmap/core/Parameters.h" #include "rtabmap/core/SensorData.h" #if CV_MAJOR_VERSION < 3 namespace cv{ class SURF; class SIFT; namespace gpu { class SURF_GPU; class ORB_GPU; class FAST_GPU; class GoodFeaturesToTrackDetector_GPU; } } typedef cv::SIFT CV_SIFT; typedef cv::SURF CV_SURF; typedef cv::FastFeatureDetector CV_FAST; typedef cv::FREAK CV_FREAK; typedef cv::GFTTDetector CV_GFTT; typedef cv::BriefDescriptorExtractor CV_BRIEF; typedef cv::BRISK CV_BRISK; typedef cv::gpu::SURF_GPU CV_SURF_GPU; typedef cv::gpu::ORB_GPU CV_ORB_GPU; typedef cv::gpu::FAST_GPU CV_FAST_GPU; typedef cv::gpu::GoodFeaturesToTrackDetector_GPU CV_GFTT_GPU; #else namespace cv{ namespace xfeatures2d { class FREAK; class DAISY; class BriefDescriptorExtractor; #if (CV_MAJOR_VERSION == 4 && CV_MINOR_VERSION <= 3) || (CV_MAJOR_VERSION == 3 && (CV_MINOR_VERSION < 4 || (CV_MINOR_VERSION==4 && CV_SUBMINOR_VERSION<11))) class SIFT; #endif class SURF; #if (CV_MAJOR_VERSION == 5) class BRISK; class KAZE; #endif } namespace cuda { class FastFeatureDetector; class ORB; class SURF_CUDA; class CornersDetector; } } #if (CV_MAJOR_VERSION == 4 && CV_MINOR_VERSION <= 3) || (CV_MAJOR_VERSION == 3 && (CV_MINOR_VERSION < 4 || (CV_MINOR_VERSION==4 && CV_SUBMINOR_VERSION<11))) typedef cv::xfeatures2d::SIFT CV_SIFT; #else typedef cv::SIFT CV_SIFT; // SIFT is back in features2d since 4.4.0 / 3.4.11 #endif typedef cv::xfeatures2d::SURF CV_SURF; typedef cv::FastFeatureDetector CV_FAST; typedef cv::xfeatures2d::FREAK CV_FREAK; typedef cv::xfeatures2d::DAISY CV_DAISY; typedef cv::GFTTDetector CV_GFTT; typedef cv::xfeatures2d::BriefDescriptorExtractor CV_BRIEF; #if (CV_MAJOR_VERSION < 5) typedef cv::BRISK CV_BRISK; typedef cv::KAZE CV_KAZE; #else typedef cv::xfeatures2d::BRISK CV_BRISK; typedef cv::xfeatures2d::KAZE CV_KAZE; #endif typedef cv::ORB CV_ORB; typedef cv::cuda::SURF_CUDA CV_SURF_GPU; typedef cv::cuda::ORB CV_ORB_GPU; typedef cv::cuda::FastFeatureDetector CV_FAST_GPU; typedef cv::cuda::CornersDetector CV_GFTT_GPU; #endif // CudaSift fork: https://github.com/matlabbe/CudaSift class SiftData; namespace rtabmap { class ORBextractor; class SPDetector; class SPDetectorRpautrat; class Stereo; #if CV_MAJOR_VERSION < 3 class CV_ORB; #endif /** * @class Feature2D * @brief Abstract 2D feature detector and descriptor extractor for visual SLAM. * * Factory @ref create() builds a concrete detector from @ref Type or from * **Kp/DetectorStrategy** in a @ref ParametersMap. Common tuning keys include * **Kp/MaxFeatures**, **Kp/GridRows**, **Kp/GridCols**, **Kp/SSC**, depth filters * (**Kp/MinDepth**, **Kp/MaxDepth**), ROI (**Kp/RoiRatios**), and sub-pixel refinement. * * Pipeline: @ref generateKeypoints() (grid + ROI + optional mask) then * @ref generateDescriptors(). Static helpers filter or cap keypoints before/after * matching. @ref generateKeypoints3D() projects features using stereo or depth when * available in @ref SensorData. * * @see Memory * @see RegistrationVis */ class RTABMAP_CORE_EXPORT Feature2D { public: /** @brief Built-in detector/descriptor strategy (Kp/DetectorStrategy). */ enum Type {kFeatureUndef=-1, kFeatureSurf=0, kFeatureSift=1, kFeatureOrb=2, kFeatureFastFreak=3, kFeatureFastBrief=4, kFeatureGfttFreak=5, kFeatureGfttBrief=6, kFeatureBrisk=7, kFeatureGfttOrb=8, //new 0.10.11 kFeatureKaze=9, //new 0.13.2 kFeatureOrbOctree=10, //new 0.19.2 kFeatureSuperPointTorch=11, //new 0.19.7 kFeatureSurfFreak=12, //new 0.20.4 kFeatureGfttDaisy=13, //new 0.20.6 kFeatureSurfDaisy=14, //new 0.20.6 kFeaturePyDetector=15, //new 0.20.8 kFeatureSuperPointRpautrat=16, // new 0.23.3 kFeatureEnd}; // Sentinel: always keep last. Used to iterate through types. /** @return Human-readable name for @p type (e.g. `"ORB"`, `"GFTT+BRIEF"`). */ static std::string typeName(Type type) { switch(type){ case kFeatureSurf: return "SURF"; case kFeatureSift: return "SIFT"; case kFeatureOrb: return "ORB"; case kFeatureFastFreak: return "FAST+FREAK"; case kFeatureFastBrief: return "FAST+BRIEF"; case kFeatureGfttFreak: return "GFTT+Freak"; case kFeatureGfttBrief: return "GFTT+Brief"; case kFeatureBrisk: return "BRISK"; case kFeatureGfttOrb: return "GFTT+ORB"; case kFeatureKaze: return "KAZE"; case kFeatureOrbOctree: return "ORB-OCTREE"; case kFeatureSuperPointTorch: return "SUPERPOINT"; case kFeatureSurfFreak: return "SURF+Freak"; case kFeatureGfttDaisy: return "GFTT+Daisy"; case kFeatureSurfDaisy: return "SURF+Daisy"; case kFeaturePyDetector: return "PyDetector"; case kFeatureSuperPointRpautrat: return "SUPERPOINT-RPAUTRAT"; default: return "Unknown"; } } /** @brief Creates a detector from **Kp/DetectorStrategy** in @p parameters. Caller owns the pointer. */ static Feature2D * create(const ParametersMap & parameters = ParametersMap()); /** @brief Creates a detector of the given @p type. Caller owns the pointer. */ static Feature2D * create(Feature2D::Type type, const ParametersMap & parameters = ParametersMap()); /** @brief Returns true if @p type is available (RTAB-Map is built with it). */ static bool isAvailable(Feature2D::Type type); /** @brief Keeps keypoints whose depth at (u,v) is in (@p minDepth, @p maxDepth). */ static void filterKeypointsByDepth( std::vector & keypoints, const cv::Mat & depth, float minDepth, float maxDepth); static void filterKeypointsByDepth( std::vector & keypoints, cv::Mat & descriptors, const cv::Mat & depth, float minDepth, float maxDepth); static void filterKeypointsByDepth( std::vector & keypoints, cv::Mat & descriptors, std::vector & keypoints3D, float minDepth, float maxDepth); /** @brief Keeps keypoints with stereo disparity ≥ @p minDisparity. */ static void filterKeypointsByDisparity( std::vector & keypoints, const cv::Mat & disparity, float minDisparity); static void filterKeypointsByDisparity( std::vector & keypoints, cv::Mat & descriptors, const cv::Mat & disparity, float minDisparity); /** @brief Reduces keypoint count (by response or SSC spatial distribution). */ static void limitKeypoints(std::vector & keypoints, int maxKeypoints, const cv::Size & imageSize = cv::Size(), bool ssc = false); static void limitKeypoints(std::vector & keypoints, cv::Mat & descriptors, int maxKeypoints, const cv::Size & imageSize = cv::Size(), bool ssc = false); static void limitKeypoints(std::vector & keypoints, std::vector & keypoints3D, cv::Mat & descriptors, int maxKeypoints, const cv::Size & imageSize = cv::Size(), bool ssc = false); static void limitKeypoints(const std::vector & keypoints, std::vector & inliers, int maxKeypoints, const cv::Size & imageSize = cv::Size(), bool ssc = false); static void limitKeypoints(const std::vector & keypoints, std::vector & inliers, int maxKeypoints, const cv::Size & imageSize, int gridRows, int gridCols, bool ssc = false); /** @brief ROI from **Kp/RoiRatios** string (`"left top right bottom"` fractions). */ static cv::Rect computeRoi(const cv::Mat & image, const std::string & roiRatios); static cv::Rect computeRoi(const cv::Mat & image, const std::vector & roiRatios); int getMaxFeatures() const {return maxFeatures_;} bool getSSC() const {return SSC_;} float getMinDepth() const {return _minDepth;} float getMaxDepth() const {return _maxDepth;} int getGridRows() const {return gridRows_;} int getGridCols() const {return gridCols_;} public: virtual ~Feature2D(); /** @brief Detects keypoints in a grayscale @p image (CV_8UC1); optional depth or 8U mask. */ std::vector generateKeypoints( const cv::Mat & image, const cv::Mat & mask = cv::Mat()); /** @brief Computes descriptors for @p keypoints (may shrink the list in some detectors). */ cv::Mat generateDescriptors( const cv::Mat & image, std::vector & keypoints) const; /** @brief Back-projects keypoints to 3D using depth or stereo in @p data. */ std::vector generateKeypoints3D( const SensorData & data, const std::vector & keypoints) const; virtual void parseParameters(const ParametersMap & parameters); virtual const ParametersMap & getParameters() const {return parameters_;} virtual Feature2D::Type getType() const = 0; /** @brief Returns true when a GPU/CUDA code path **could** be used by * this detector on this host: i.e. the build was compiled with the * matching GPU support AND a CUDA-capable device is detected at * runtime. This is a capability probe -- it does NOT reflect whether * the current instance is actually configured to run on GPU (that * depends on per-detector parameters like SURF/GpuVersion). Defaults * to false; subclasses with a GPU backend override it. */ virtual bool isGpuAvailable() const {return false;} protected: Feature2D(const ParametersMap & parameters = ParametersMap()); private: virtual std::vector generateKeypointsImpl(const cv::Mat & image, const cv::Rect & roi, const cv::Mat & mask = cv::Mat()) = 0; virtual cv::Mat generateDescriptorsImpl(const cv::Mat & image, std::vector & keypoints) const = 0; private: ParametersMap parameters_; int maxFeatures_; bool SSC_; float _maxDepth; // 0=inf float _minDepth; std::vector _roiRatios; // size 4 int _subPixWinSize; int _subPixIterations; double _subPixEps; int gridRows_; int gridCols_; // Stereo stuff Stereo * _stereo; }; /** @brief SURF detector and descriptor (non-free / xfeatures2d depending on OpenCV build). */ class RTABMAP_CORE_EXPORT SURF : public Feature2D { public: SURF(const ParametersMap & parameters = ParametersMap()); virtual ~SURF(); virtual void parseParameters(const ParametersMap & parameters) override; virtual Feature2D::Type getType() const override {return kFeatureSurf;} virtual bool isGpuAvailable() const override; private: virtual std::vector generateKeypointsImpl(const cv::Mat & image, const cv::Rect & roi, const cv::Mat & mask = cv::Mat()) override; virtual cv::Mat generateDescriptorsImpl(const cv::Mat & image, std::vector & keypoints) const override; private: double hessianThreshold_; int nOctaves_; int nOctaveLayers_; bool extended_; bool upright_; float gpuKeypointsRatio_; bool gpuVersion_; cv::Ptr _surf; cv::Ptr _gpuSurf; }; /** @brief SIFT detector and descriptor (optional GPU / CudaSift). */ class RTABMAP_CORE_EXPORT SIFT : public Feature2D { public: SIFT(const ParametersMap & parameters = ParametersMap()); virtual ~SIFT(); virtual void parseParameters(const ParametersMap & parameters) override; virtual Feature2D::Type getType() const override {return kFeatureSift;} virtual bool isGpuAvailable() const override; private: virtual std::vector generateKeypointsImpl(const cv::Mat & image, const cv::Rect & roi, const cv::Mat & mask = cv::Mat()) override; virtual cv::Mat generateDescriptorsImpl(const cv::Mat & image, std::vector & keypoints) const override; private: int nOctaveLayers_; double contrastThreshold_; double edgeThreshold_; double sigma_; bool preciseUpscale_; bool rootSIFT_; bool gpu_; float gaussianThreshold_; float maxGaussianThreshold_; bool upscale_; cv::Ptr sift_; SiftData * cudaSiftData_; float * cudaSiftMemory_; cv::Size cudaSiftMemorySize_; cv::Mat cudaSiftDescriptors_; bool cudaSiftUpscaling_; }; /** @brief ORB detector and descriptor (optional GPU). */ class RTABMAP_CORE_EXPORT ORB : public Feature2D { public: ORB(const ParametersMap & parameters = ParametersMap()); virtual ~ORB(); virtual void parseParameters(const ParametersMap & parameters) override; virtual Feature2D::Type getType() const override {return kFeatureOrb;} virtual bool isGpuAvailable() const override; private: virtual std::vector generateKeypointsImpl(const cv::Mat & image, const cv::Rect & roi, const cv::Mat & mask = cv::Mat()) override; virtual cv::Mat generateDescriptorsImpl(const cv::Mat & image, std::vector & keypoints) const override; private: float scaleFactor_; int nLevels_; int edgeThreshold_; int firstLevel_; int WTA_K_; int scoreType_; int patchSize_; bool gpu_; int fastThreshold_; bool nonmaxSuppresion_; cv::Ptr _orb; cv::Ptr _gpuOrb; }; /** @brief FAST corner detector only (no descriptor). */ class RTABMAP_CORE_EXPORT FAST : public Feature2D { public: FAST(const ParametersMap & parameters = ParametersMap()); virtual ~FAST(); virtual void parseParameters(const ParametersMap & parameters) override; virtual Feature2D::Type getType() const override {return kFeatureUndef;} virtual bool isGpuAvailable() const override; private: virtual std::vector generateKeypointsImpl(const cv::Mat & image, const cv::Rect & roi, const cv::Mat & mask = cv::Mat()) override; virtual cv::Mat generateDescriptorsImpl(const cv::Mat &, std::vector &) const override {return cv::Mat();} private: int threshold_; bool nonmaxSuppression_; bool gpu_; double gpuKeypointsRatio_; int minThreshold_; int maxThreshold_; int gridRows_; int gridCols_; int fastCV_; bool fastCVinit_; int fastCVMaxFeatures_; int fastCVLastImageHeight_; uint32_t* fastCVCorners_= NULL; uint32_t* fastCVCornerScores_ = NULL; void* fastCVTempBuf_ = NULL; cv::Ptr _fast; cv::Ptr _gpuFast; }; /** @brief FAST corners + BRIEF descriptors. */ class RTABMAP_CORE_EXPORT FAST_BRIEF : public FAST { public: FAST_BRIEF(const ParametersMap & parameters = ParametersMap()); virtual ~FAST_BRIEF(); virtual void parseParameters(const ParametersMap & parameters) override; virtual Feature2D::Type getType() const override {return kFeatureFastBrief;} private: virtual cv::Mat generateDescriptorsImpl(const cv::Mat & image, std::vector & keypoints) const override; private: int bytes_; cv::Ptr _brief; }; /** @brief FAST corners + FREAK descriptors. */ class RTABMAP_CORE_EXPORT FAST_FREAK : public FAST { public: FAST_FREAK(const ParametersMap & parameters = ParametersMap()); virtual ~FAST_FREAK(); virtual void parseParameters(const ParametersMap & parameters) override; virtual Feature2D::Type getType() const override {return kFeatureFastFreak;} private: virtual cv::Mat generateDescriptorsImpl(const cv::Mat & image, std::vector & keypoints) const override; private: bool orientationNormalized_; bool scaleNormalized_; float patternScale_; int nOctaves_; cv::Ptr _freak; }; /** @brief Good-features-to-track detector (Shi–Tomasi / Harris). */ class RTABMAP_CORE_EXPORT GFTT : public Feature2D { public: GFTT(const ParametersMap & parameters = ParametersMap()); virtual ~GFTT(); virtual void parseParameters(const ParametersMap & parameters) override; virtual bool isGpuAvailable() const override; private: virtual std::vector generateKeypointsImpl(const cv::Mat & image, const cv::Rect & roi, const cv::Mat & mask = cv::Mat()) override; private: double _qualityLevel; double _minDistance; int _blockSize; bool _useHarrisDetector; double _k; bool _gpu; cv::Ptr _gftt; cv::Ptr _gpuGftt; }; /** @brief GFTT corners + BRIEF descriptors. */ class RTABMAP_CORE_EXPORT GFTT_BRIEF : public GFTT { public: GFTT_BRIEF(const ParametersMap & parameters = ParametersMap()); virtual ~GFTT_BRIEF(); virtual void parseParameters(const ParametersMap & parameters) override; virtual Feature2D::Type getType() const override {return kFeatureGfttBrief;} private: virtual cv::Mat generateDescriptorsImpl(const cv::Mat & image, std::vector & keypoints) const override; private: int bytes_; cv::Ptr _brief; }; /** @brief GFTT corners + FREAK descriptors. */ class RTABMAP_CORE_EXPORT GFTT_FREAK : public GFTT { public: GFTT_FREAK(const ParametersMap & parameters = ParametersMap()); virtual ~GFTT_FREAK(); virtual void parseParameters(const ParametersMap & parameters) override; virtual Feature2D::Type getType() const override {return kFeatureGfttFreak;} private: virtual cv::Mat generateDescriptorsImpl(const cv::Mat & image, std::vector & keypoints) const override; private: bool orientationNormalized_; bool scaleNormalized_; float patternScale_; int nOctaves_; cv::Ptr _freak; }; /** @brief SURF detector + FREAK descriptors. */ class RTABMAP_CORE_EXPORT SURF_FREAK : public SURF { public: SURF_FREAK(const ParametersMap & parameters = ParametersMap()); virtual ~SURF_FREAK(); virtual void parseParameters(const ParametersMap & parameters) override; virtual Feature2D::Type getType() const override {return kFeatureSurfFreak;} private: virtual cv::Mat generateDescriptorsImpl(const cv::Mat & image, std::vector & keypoints) const override; private: bool orientationNormalized_; bool scaleNormalized_; float patternScale_; int nOctaves_; cv::Ptr _freak; }; /** @brief GFTT corners + ORB descriptors (common default when SURF is unavailable). */ class RTABMAP_CORE_EXPORT GFTT_ORB : public GFTT { public: GFTT_ORB(const ParametersMap & parameters = ParametersMap()); virtual ~GFTT_ORB(); virtual void parseParameters(const ParametersMap & parameters) override; virtual Feature2D::Type getType() const override {return kFeatureGfttOrb;} private: virtual cv::Mat generateDescriptorsImpl(const cv::Mat & image, std::vector & keypoints) const override; private: ORB _orb; }; /** @brief BRISK detector and descriptor. */ class RTABMAP_CORE_EXPORT BRISK : public Feature2D { public: BRISK(const ParametersMap & parameters = ParametersMap()); virtual ~BRISK(); virtual void parseParameters(const ParametersMap & parameters) override; virtual Feature2D::Type getType() const override {return kFeatureBrisk;} private: virtual std::vector generateKeypointsImpl(const cv::Mat & image, const cv::Rect & roi, const cv::Mat & mask = cv::Mat()) override; virtual cv::Mat generateDescriptorsImpl(const cv::Mat & image, std::vector & keypoints) const override; private: int thresh_; int octaves_; float patternScale_; cv::Ptr brisk_; }; /** @brief KAZE detector and descriptor (OpenCV 3+). */ class RTABMAP_CORE_EXPORT KAZE : public Feature2D { public: KAZE(const ParametersMap & parameters = ParametersMap()); virtual ~KAZE(); virtual void parseParameters(const ParametersMap & parameters) override; virtual Feature2D::Type getType() const override { return kFeatureKaze; } private: virtual std::vector generateKeypointsImpl(const cv::Mat & image, const cv::Rect & roi, const cv::Mat & mask = cv::Mat()) override; virtual cv::Mat generateDescriptorsImpl(const cv::Mat & image, std::vector & keypoints) const override; private: bool extended_; bool upright_; float threshold_; int nOctaves_; int nOctaveLayers_; int diffusivity_; #if CV_MAJOR_VERSION > 2 cv::Ptr kaze_; #endif }; /** @brief ORB with octree spatial distribution (RTAB-Map must be built with OCTREE enabled). */ class RTABMAP_CORE_EXPORT ORBOctree : public Feature2D { public: ORBOctree(const ParametersMap & parameters = ParametersMap()); virtual ~ORBOctree(); virtual void parseParameters(const ParametersMap & parameters) override; virtual Feature2D::Type getType() const override {return kFeatureOrbOctree;} private: virtual std::vector generateKeypointsImpl(const cv::Mat & image, const cv::Rect & roi, const cv::Mat & mask = cv::Mat()) override; virtual cv::Mat generateDescriptorsImpl(const cv::Mat & image, std::vector & keypoints) const override; private: float scaleFactor_; int nLevels_; int patchSize_; int edgeThreshold_; int fastThreshold_; int fastMinThreshold_; cv::Ptr _orb; cv::Mat descriptors_; }; /** @brief SuperPoint via LibTorch (RTAB-Map must be built with libtorch support). */ class RTABMAP_CORE_EXPORT SuperPointTorch : public Feature2D { public: SuperPointTorch(const ParametersMap & parameters = ParametersMap()); virtual ~SuperPointTorch(); virtual void parseParameters(const ParametersMap & parameters) override; virtual Feature2D::Type getType() const override { return kFeatureSuperPointTorch; } virtual bool isGpuAvailable() const override; private: virtual std::vector generateKeypointsImpl(const cv::Mat & image, const cv::Rect & roi, const cv::Mat & mask = cv::Mat()) override; virtual cv::Mat generateDescriptorsImpl(const cv::Mat & image, std::vector & keypoints) const override; cv::Ptr superPoint_; std::string path_; float threshold_; bool nms_; int minDistance_; bool cuda_; }; /** @brief SuperPoint (rpautrat) via Torch + Python (RTAB-Map must be built with libtorch and Python support). */ class RTABMAP_CORE_EXPORT SuperPointRpautrat : public Feature2D { public: SuperPointRpautrat(const ParametersMap & parameters = ParametersMap()); virtual ~SuperPointRpautrat(); virtual void parseParameters(const ParametersMap & parameters) override; virtual Feature2D::Type getType() const override { return kFeatureSuperPointRpautrat; } virtual bool isGpuAvailable() const override; private: virtual std::vector generateKeypointsImpl(const cv::Mat & image, const cv::Rect & roi, const cv::Mat & mask = cv::Mat()) override; virtual cv::Mat generateDescriptorsImpl(const cv::Mat & image, std::vector & keypoints) const override; cv::Ptr superPoint_; std::string superpointWeightsPath_; std::string superpointModelPath_; std::string outputDir_; float threshold_; bool nms_; int minDistance_; bool cuda_; }; /** @brief GFTT corners + DAISY descriptors (OpenCV 3+ xfeatures2d). */ class RTABMAP_CORE_EXPORT GFTT_DAISY : public GFTT { public: GFTT_DAISY(const ParametersMap & parameters = ParametersMap()); virtual ~GFTT_DAISY(); virtual void parseParameters(const ParametersMap & parameters) override; virtual Feature2D::Type getType() const override {return kFeatureGfttDaisy;} private: virtual cv::Mat generateDescriptorsImpl(const cv::Mat & image, std::vector & keypoints) const override; private: bool orientationNormalized_; bool scaleNormalized_; float patternScale_; int nOctaves_; #if CV_MAJOR_VERSION > 2 cv::Ptr _daisy; #endif }; /** @brief SURF detector + DAISY descriptors (OpenCV 3+ xfeatures2d). */ class RTABMAP_CORE_EXPORT SURF_DAISY : public SURF { public: SURF_DAISY(const ParametersMap & parameters = ParametersMap()); virtual ~SURF_DAISY(); virtual void parseParameters(const ParametersMap & parameters) override; virtual Feature2D::Type getType() const override {return kFeatureSurfDaisy;} private: virtual cv::Mat generateDescriptorsImpl(const cv::Mat & image, std::vector & keypoints) const override; private: bool orientationNormalized_; bool scaleNormalized_; float patternScale_; int nOctaves_; #if CV_MAJOR_VERSION > 2 cv::Ptr _daisy; #endif }; } #endif /* FEATURES2D_H_ */