SaDVIO
aOpenCVFeatureDetector.h
Go to the documentation of this file.
1 #ifndef AOPENCVFEATUREDETECTOR_H
2 #define AOPENCVFEATUREDETECTOR_H
3 
7 #include "isaeslam/typedefs.h"
8 
9 namespace isae {
10 
11 class Point2D;
12 
17  public:
18  AOpenCVFeatureDetector(int n, int n_per_cell) : AFeatureDetector(n, n_per_cell) {}
19 
20  void detectAndCompute(const cv::Mat &img,
21  const cv::Mat &mask,
22  std::vector<cv::KeyPoint> &keypoints,
23  cv::Mat &descriptors,
24  int n_points = 0);
25  void computeDescriptor(const cv::Mat &img, std::vector<std::shared_ptr<AFeature>> &features);
26 
30  void retainBest(std::vector<cv::KeyPoint> &_keypoints, int n);
31  std::vector<std::shared_ptr<AFeature>> detectAndComputeGrid(
32  const cv::Mat &img,
33  const cv::Mat &mask,
34  std::vector<std::shared_ptr<AFeature>> existing_features = std::vector<std::shared_ptr<AFeature>>());
35 
36  protected:
37  cv::Ptr<cv::FeatureDetector> _detector;
38  cv::Ptr<cv::DescriptorExtractor> _descriptor;
39 };
40 
41 } // namespace isae
42 
43 #endif // AOPENCVFEATUREDETECTOR_H
isae::AOpenCVFeatureDetector::_descriptor
cv::Ptr< cv::DescriptorExtractor > _descriptor
Stores the opencv descriptor extractor.
Definition: aOpenCVFeatureDetector.h:38
Point2D.h
isae::AOpenCVFeatureDetector::_detector
cv::Ptr< cv::FeatureDetector > _detector
Stores the opencv detector.
Definition: aOpenCVFeatureDetector.h:37
isae::AOpenCVFeatureDetector::AOpenCVFeatureDetector
AOpenCVFeatureDetector(int n, int n_per_cell)
Definition: aOpenCVFeatureDetector.h:18
isae::AOpenCVFeatureDetector::detectAndCompute
void detectAndCompute(const cv::Mat &img, const cv::Mat &mask, std::vector< cv::KeyPoint > &keypoints, cv::Mat &descriptors, int n_points=0)
Virtual function to detect and compute features in an image.
Definition: aOpenCVFeatureDetector.cpp:9
typedefs.h
aFeatureDetector.h
isae::AOpenCVFeatureDetector::retainBest
void retainBest(std::vector< cv::KeyPoint > &_keypoints, int n)
Retain the n best keypoints based on their response.
Definition: aOpenCVFeatureDetector.cpp:175
isae
Definition: AFeature2D.h:8
isae::AOpenCVFeatureDetector::computeDescriptor
void computeDescriptor(const cv::Mat &img, std::vector< std::shared_ptr< AFeature >> &features)
Virtual function to compute descriptors for a set of features.
Definition: aOpenCVFeatureDetector.cpp:153
isae::AFeatureDetector
Abstract class for feature detectors.
Definition: aFeatureDetector.h:22
isae::AOpenCVFeatureDetector::detectAndComputeGrid
std::vector< std::shared_ptr< AFeature > > detectAndComputeGrid(const cv::Mat &img, const cv::Mat &mask, std::vector< std::shared_ptr< AFeature >> existing_features=std::vector< std::shared_ptr< AFeature >>())
Virtual function to detect and compute features in a grid (bucketting).
Definition: aOpenCVFeatureDetector.cpp:41
isae::AOpenCVFeatureDetector
AOpenCVFeatureDetector class for detecting and computing features using OpenCV.
Definition: aOpenCVFeatureDetector.h:16
ASensor.h