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>
40 #if CV_MAJOR_VERSION < 3
62 namespace xfeatures2d {
65 class BriefDescriptorExtractor;
66 #if CV_MAJOR_VERSION < 3 || (CV_MAJOR_VERSION == 4 && CV_MINOR_VERSION <= 3) || (CV_MAJOR_VERSION == 3 && (CV_MINOR_VERSION < 4 || (CV_MINOR_VERSION==4 && CV_SUBMINOR_VERSION<11)))
72 class FastFeatureDetector;
77 #if CV_MAJOR_VERSION < 3 || (CV_MAJOR_VERSION == 4 && CV_MINOR_VERSION <= 3) || (CV_MAJOR_VERSION == 3 && (CV_MINOR_VERSION < 4 || (CV_MINOR_VERSION==4 && CV_SUBMINOR_VERSION<11)))
78 typedef cv::xfeatures2d::SIFT
CV_SIFT;
82 typedef cv::xfeatures2d::SURF
CV_SURF;
83 typedef cv::FastFeatureDetector
CV_FAST;
84 typedef cv::xfeatures2d::FREAK
CV_FREAK;
85 typedef cv::xfeatures2d::DAISY CV_DAISY;
86 typedef cv::GFTTDetector
CV_GFTT;
87 typedef cv::xfeatures2d::BriefDescriptorExtractor
CV_BRIEF;
89 typedef cv::ORB CV_ORB;
101 #if CV_MAJOR_VERSION < 3
119 kFeatureOrbOctree=10,
120 kFeatureSuperPointTorch=11,
121 kFeatureSurfFreak=12,
122 kFeatureGfttDaisy=13,
123 kFeatureSurfDaisy=14,
124 kFeaturePyDetector=15};
135 case kFeatureFastFreak:
137 case kFeatureFastBrief:
139 case kFeatureGfttFreak:
141 case kFeatureGfttBrief:
145 case kFeatureGfttOrb:
149 case kFeatureOrbOctree:
151 case kFeatureSuperPointTorch:
153 case kFeatureSurfFreak:
155 case kFeatureGfttDaisy:
157 case kFeatureSurfDaisy:
167 static void filterKeypointsByDepth(
168 std::vector<cv::KeyPoint> & keypoints,
169 const cv::Mat & depth,
172 static void filterKeypointsByDepth(
173 std::vector<cv::KeyPoint> & keypoints,
174 cv::Mat & descriptors,
175 const cv::Mat & depth,
178 static void filterKeypointsByDepth(
179 std::vector<cv::KeyPoint> & keypoints,
180 cv::Mat & descriptors,
181 std::vector<cv::Point3f> & keypoints3D,
185 static void filterKeypointsByDisparity(
186 std::vector<cv::KeyPoint> & keypoints,
187 const cv::Mat & disparity,
189 static void filterKeypointsByDisparity(
190 std::vector<cv::KeyPoint> & keypoints,
191 cv::Mat & descriptors,
192 const cv::Mat & disparity,
195 static void limitKeypoints(std::vector<cv::KeyPoint> & keypoints,
int maxKeypoints,
const cv::Size & imageSize = cv::Size(),
bool ssc =
false);
196 static void limitKeypoints(std::vector<cv::KeyPoint> & keypoints, cv::Mat & descriptors,
int maxKeypoints,
const cv::Size & imageSize = cv::Size(),
bool ssc =
false);
197 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);
198 static void limitKeypoints(
const std::vector<cv::KeyPoint> & keypoints, std::vector<bool> & inliers,
int maxKeypoints,
const cv::Size & imageSize = cv::Size(),
bool ssc =
false);
199 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);
201 static cv::Rect
computeRoi(
const cv::Mat & image,
const std::string & roiRatios);
202 static cv::Rect
computeRoi(
const cv::Mat & image,
const std::vector<float> & roiRatios);
214 std::vector<cv::KeyPoint> generateKeypoints(
215 const cv::Mat & image,
216 const cv::Mat &
mask = cv::Mat());
217 cv::Mat generateDescriptors(
218 const cv::Mat & image,
219 std::vector<cv::KeyPoint> & keypoints)
const;
220 std::vector<cv::Point3f> generateKeypoints3D(
222 const std::vector<cv::KeyPoint> & keypoints)
const;
224 virtual void parseParameters(
const ParametersMap & parameters);
232 virtual std::vector<cv::KeyPoint> generateKeypointsImpl(
const cv::Mat & image,
const cv::Rect & roi,
const cv::Mat &
mask = cv::Mat()) = 0;
233 virtual cv::Mat generateDescriptorsImpl(
const cv::Mat & image, std::vector<cv::KeyPoint> & keypoints)
const = 0;
258 virtual void parseParameters(
const ParametersMap & parameters);
262 virtual std::vector<cv::KeyPoint> generateKeypointsImpl(
const cv::Mat & image,
const cv::Rect & roi,
const cv::Mat &
mask = cv::Mat());
263 virtual cv::Mat generateDescriptorsImpl(
const cv::Mat & image, std::vector<cv::KeyPoint> & keypoints)
const;
285 virtual void parseParameters(
const ParametersMap & parameters);
289 virtual std::vector<cv::KeyPoint> generateKeypointsImpl(
const cv::Mat & image,
const cv::Rect & roi,
const cv::Mat &
mask = cv::Mat());
290 virtual cv::Mat generateDescriptorsImpl(
const cv::Mat & image, std::vector<cv::KeyPoint> & keypoints)
const;
309 virtual void parseParameters(
const ParametersMap & parameters);
313 virtual std::vector<cv::KeyPoint> generateKeypointsImpl(
const cv::Mat & image,
const cv::Rect & roi,
const cv::Mat &
mask = cv::Mat());
314 virtual cv::Mat generateDescriptorsImpl(
const cv::Mat & image, std::vector<cv::KeyPoint> & keypoints)
const;
340 virtual void parseParameters(
const ParametersMap & parameters);
344 virtual std::vector<cv::KeyPoint> generateKeypointsImpl(
const cv::Mat & image,
const cv::Rect & roi,
const cv::Mat &
mask = cv::Mat());
376 virtual void parseParameters(
const ParametersMap & parameters);
380 virtual cv::Mat generateDescriptorsImpl(
const cv::Mat & image, std::vector<cv::KeyPoint> & keypoints)
const;
395 virtual void parseParameters(
const ParametersMap & parameters);
399 virtual cv::Mat generateDescriptorsImpl(
const cv::Mat & image, std::vector<cv::KeyPoint> & keypoints)
const;
417 virtual void parseParameters(
const ParametersMap & parameters);
420 virtual std::vector<cv::KeyPoint> generateKeypointsImpl(
const cv::Mat & image,
const cv::Rect & roi,
const cv::Mat &
mask = cv::Mat());
439 virtual void parseParameters(
const ParametersMap & parameters);
443 virtual cv::Mat generateDescriptorsImpl(
const cv::Mat & image, std::vector<cv::KeyPoint> & keypoints)
const;
458 virtual void parseParameters(
const ParametersMap & parameters);
462 virtual cv::Mat generateDescriptorsImpl(
const cv::Mat & image, std::vector<cv::KeyPoint> & keypoints)
const;
480 virtual void parseParameters(
const ParametersMap & parameters);
484 virtual cv::Mat generateDescriptorsImpl(
const cv::Mat & image, std::vector<cv::KeyPoint> & keypoints)
const;
502 virtual void parseParameters(
const ParametersMap & parameters);
506 virtual cv::Mat generateDescriptorsImpl(
const cv::Mat & image, std::vector<cv::KeyPoint> & keypoints)
const;
519 virtual void parseParameters(
const ParametersMap & parameters);
523 virtual std::vector<cv::KeyPoint> generateKeypointsImpl(
const cv::Mat & image,
const cv::Rect & roi,
const cv::Mat &
mask = cv::Mat());
524 virtual cv::Mat generateDescriptorsImpl(
const cv::Mat & image, std::vector<cv::KeyPoint> & keypoints)
const;
541 virtual void parseParameters(
const ParametersMap & parameters);
545 virtual std::vector<cv::KeyPoint> generateKeypointsImpl(
const cv::Mat & image,
const cv::Rect & roi,
const cv::Mat &
mask = cv::Mat());
546 virtual cv::Mat generateDescriptorsImpl(
const cv::Mat & image, std::vector<cv::KeyPoint> & keypoints)
const;
556 #if CV_MAJOR_VERSION > 2
557 cv::Ptr<cv::KAZE> kaze_;
568 virtual void parseParameters(
const ParametersMap & parameters);
572 virtual std::vector<cv::KeyPoint> generateKeypointsImpl(
const cv::Mat & image,
const cv::Rect & roi,
const cv::Mat &
mask = cv::Mat());
573 virtual cv::Mat generateDescriptorsImpl(
const cv::Mat & image, std::vector<cv::KeyPoint> & keypoints)
const;
594 virtual void parseParameters(
const ParametersMap & parameters);
598 virtual std::vector<cv::KeyPoint> generateKeypointsImpl(
const cv::Mat & image,
const cv::Rect & roi,
const cv::Mat &
mask = cv::Mat());
599 virtual cv::Mat generateDescriptorsImpl(
const cv::Mat & image, std::vector<cv::KeyPoint> & keypoints)
const;
617 virtual void parseParameters(
const ParametersMap & parameters);
621 virtual cv::Mat generateDescriptorsImpl(
const cv::Mat & image, std::vector<cv::KeyPoint> & keypoints)
const;
629 #if CV_MAJOR_VERSION > 2
630 cv::Ptr<CV_DAISY> _daisy;
641 virtual void parseParameters(
const ParametersMap & parameters);
645 virtual cv::Mat generateDescriptorsImpl(
const cv::Mat & image, std::vector<cv::KeyPoint> & keypoints)
const;
653 #if CV_MAJOR_VERSION > 2
654 cv::Ptr<CV_DAISY> _daisy;