31 #include "rtabmap/core/rtabmap_core_export.h"
33 #include <opencv2/highgui/highgui.hpp>
34 #include <opencv2/core/core.hpp>
35 #include <opencv2/features2d/features2d.hpp>
41 #if CV_MAJOR_VERSION < 3
49 class GoodFeaturesToTrackDetector_GPU;
65 namespace xfeatures2d {
68 class BriefDescriptorExtractor;
69 #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)))
75 class FastFeatureDetector;
78 class CornersDetector;
81 #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)))
82 typedef cv::xfeatures2d::SIFT
CV_SIFT;
86 typedef cv::xfeatures2d::SURF
CV_SURF;
87 typedef cv::FastFeatureDetector
CV_FAST;
88 typedef cv::xfeatures2d::FREAK
CV_FREAK;
89 typedef cv::xfeatures2d::DAISY CV_DAISY;
90 typedef cv::GFTTDetector
CV_GFTT;
91 typedef cv::xfeatures2d::BriefDescriptorExtractor
CV_BRIEF;
93 typedef cv::ORB CV_ORB;
109 #if CV_MAJOR_VERSION < 3
127 kFeatureOrbOctree=10,
128 kFeatureSuperPointTorch=11,
129 kFeatureSurfFreak=12,
130 kFeatureGfttDaisy=13,
131 kFeatureSurfDaisy=14,
132 kFeaturePyDetector=15};
143 case kFeatureFastFreak:
145 case kFeatureFastBrief:
147 case kFeatureGfttFreak:
149 case kFeatureGfttBrief:
153 case kFeatureGfttOrb:
157 case kFeatureOrbOctree:
159 case kFeatureSuperPointTorch:
161 case kFeatureSurfFreak:
163 case kFeatureGfttDaisy:
165 case kFeatureSurfDaisy:
175 static void filterKeypointsByDepth(
176 std::vector<cv::KeyPoint> & keypoints,
177 const cv::Mat & depth,
180 static void filterKeypointsByDepth(
181 std::vector<cv::KeyPoint> & keypoints,
182 cv::Mat & descriptors,
183 const cv::Mat & depth,
186 static void filterKeypointsByDepth(
187 std::vector<cv::KeyPoint> & keypoints,
188 cv::Mat & descriptors,
189 std::vector<cv::Point3f> & keypoints3D,
193 static void filterKeypointsByDisparity(
194 std::vector<cv::KeyPoint> & keypoints,
195 const cv::Mat & disparity,
197 static void filterKeypointsByDisparity(
198 std::vector<cv::KeyPoint> & keypoints,
199 cv::Mat & descriptors,
200 const cv::Mat & disparity,
203 static void limitKeypoints(std::vector<cv::KeyPoint> & keypoints,
int maxKeypoints,
const cv::Size & imageSize = cv::Size(),
bool ssc =
false);
204 static void limitKeypoints(std::vector<cv::KeyPoint> & keypoints, cv::Mat & descriptors,
int maxKeypoints,
const cv::Size & imageSize = cv::Size(),
bool ssc =
false);
205 static void limitKeypoints(std::vector<cv::KeyPoint> & keypoints, std::vector<cv::Point3f> & keypoints3D, cv::Mat & descriptors,
int maxKeypoints,
const cv::Size & imageSize = cv::Size(),
bool ssc =
false);
206 static void limitKeypoints(
const std::vector<cv::KeyPoint> & keypoints, std::vector<bool> & inliers,
int maxKeypoints,
const cv::Size & imageSize = cv::Size(),
bool ssc =
false);
207 static void limitKeypoints(
const std::vector<cv::KeyPoint> & keypoints, std::vector<bool> & inliers,
int maxKeypoints,
const cv::Size & imageSize,
int gridRows,
int gridCols,
bool ssc =
false);
209 static cv::Rect
computeRoi(
const cv::Mat & image,
const std::string & roiRatios);
210 static cv::Rect
computeRoi(
const cv::Mat & image,
const std::vector<float> & roiRatios);
222 std::vector<cv::KeyPoint> generateKeypoints(
223 const cv::Mat & image,
224 const cv::Mat &
mask = cv::Mat());
225 cv::Mat generateDescriptors(
226 const cv::Mat & image,
227 std::vector<cv::KeyPoint> & keypoints)
const;
228 std::vector<cv::Point3f> generateKeypoints3D(
230 const std::vector<cv::KeyPoint> & keypoints)
const;
232 virtual void parseParameters(
const ParametersMap & parameters);
240 virtual std::vector<cv::KeyPoint> generateKeypointsImpl(
const cv::Mat & image,
const cv::Rect & roi,
const cv::Mat &
mask = cv::Mat()) = 0;
241 virtual cv::Mat generateDescriptorsImpl(
const cv::Mat & image, std::vector<cv::KeyPoint> & keypoints)
const = 0;
266 virtual void parseParameters(
const ParametersMap & parameters);
270 virtual std::vector<cv::KeyPoint> generateKeypointsImpl(
const cv::Mat & image,
const cv::Rect & roi,
const cv::Mat &
mask = cv::Mat());
271 virtual cv::Mat generateDescriptorsImpl(
const cv::Mat & image, std::vector<cv::KeyPoint> & keypoints)
const;
293 virtual void parseParameters(
const ParametersMap & parameters);
297 virtual std::vector<cv::KeyPoint> generateKeypointsImpl(
const cv::Mat & image,
const cv::Rect & roi,
const cv::Mat &
mask = cv::Mat());
298 virtual cv::Mat generateDescriptorsImpl(
const cv::Mat & image, std::vector<cv::KeyPoint> & keypoints)
const;
326 virtual void parseParameters(
const ParametersMap & parameters);
330 virtual std::vector<cv::KeyPoint> generateKeypointsImpl(
const cv::Mat & image,
const cv::Rect & roi,
const cv::Mat &
mask = cv::Mat());
331 virtual cv::Mat generateDescriptorsImpl(
const cv::Mat & image, std::vector<cv::KeyPoint> & keypoints)
const;
357 virtual void parseParameters(
const ParametersMap & parameters);
361 virtual std::vector<cv::KeyPoint> generateKeypointsImpl(
const cv::Mat & image,
const cv::Rect & roi,
const cv::Mat &
mask = cv::Mat());
393 virtual void parseParameters(
const ParametersMap & parameters);
397 virtual cv::Mat generateDescriptorsImpl(
const cv::Mat & image, std::vector<cv::KeyPoint> & keypoints)
const;
412 virtual void parseParameters(
const ParametersMap & parameters);
416 virtual cv::Mat generateDescriptorsImpl(
const cv::Mat & image, std::vector<cv::KeyPoint> & keypoints)
const;
434 virtual void parseParameters(
const ParametersMap & parameters);
437 virtual std::vector<cv::KeyPoint> generateKeypointsImpl(
const cv::Mat & image,
const cv::Rect & roi,
const cv::Mat &
mask = cv::Mat());
458 virtual void parseParameters(
const ParametersMap & parameters);
462 virtual cv::Mat generateDescriptorsImpl(
const cv::Mat & image, std::vector<cv::KeyPoint> & keypoints)
const;
477 virtual void parseParameters(
const ParametersMap & parameters);
481 virtual cv::Mat generateDescriptorsImpl(
const cv::Mat & image, std::vector<cv::KeyPoint> & keypoints)
const;
499 virtual void parseParameters(
const ParametersMap & parameters);
503 virtual cv::Mat generateDescriptorsImpl(
const cv::Mat & image, std::vector<cv::KeyPoint> & keypoints)
const;
521 virtual void parseParameters(
const ParametersMap & parameters);
525 virtual cv::Mat generateDescriptorsImpl(
const cv::Mat & image, std::vector<cv::KeyPoint> & keypoints)
const;
538 virtual void parseParameters(
const ParametersMap & parameters);
542 virtual std::vector<cv::KeyPoint> generateKeypointsImpl(
const cv::Mat & image,
const cv::Rect & roi,
const cv::Mat &
mask = cv::Mat());
543 virtual cv::Mat generateDescriptorsImpl(
const cv::Mat & image, std::vector<cv::KeyPoint> & keypoints)
const;
560 virtual void parseParameters(
const ParametersMap & parameters);
564 virtual std::vector<cv::KeyPoint> generateKeypointsImpl(
const cv::Mat & image,
const cv::Rect & roi,
const cv::Mat &
mask = cv::Mat());
565 virtual cv::Mat generateDescriptorsImpl(
const cv::Mat & image, std::vector<cv::KeyPoint> & keypoints)
const;
575 #if CV_MAJOR_VERSION > 2
576 cv::Ptr<cv::KAZE> kaze_;
587 virtual void parseParameters(
const ParametersMap & parameters);
591 virtual std::vector<cv::KeyPoint> generateKeypointsImpl(
const cv::Mat & image,
const cv::Rect & roi,
const cv::Mat &
mask = cv::Mat());
592 virtual cv::Mat generateDescriptorsImpl(
const cv::Mat & image, std::vector<cv::KeyPoint> & keypoints)
const;
613 virtual void parseParameters(
const ParametersMap & parameters);
617 virtual std::vector<cv::KeyPoint> generateKeypointsImpl(
const cv::Mat & image,
const cv::Rect & roi,
const cv::Mat &
mask = cv::Mat());
618 virtual cv::Mat generateDescriptorsImpl(
const cv::Mat & image, std::vector<cv::KeyPoint> & keypoints)
const;
636 virtual void parseParameters(
const ParametersMap & parameters);
640 virtual cv::Mat generateDescriptorsImpl(
const cv::Mat & image, std::vector<cv::KeyPoint> & keypoints)
const;
648 #if CV_MAJOR_VERSION > 2
649 cv::Ptr<CV_DAISY> _daisy;
660 virtual void parseParameters(
const ParametersMap & parameters);
664 virtual cv::Mat generateDescriptorsImpl(
const cv::Mat & image, std::vector<cv::KeyPoint> & keypoints)
const;
672 #if CV_MAJOR_VERSION > 2
673 cv::Ptr<CV_DAISY> _daisy;