Go to the documentation of this file. 1 #ifndef AFEATUREDETECTOR_H
2 #define AFEATUREDETECTOR_H
4 #include <opencv2/core.hpp>
5 #include <opencv2/features2d.hpp>
24 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
34 virtual void init() = 0;
47 std::vector<cv::KeyPoint> &keypoints,
49 int n_points = 0) = 0;
57 virtual void computeDescriptor(
const cv::Mat &img, std::vector<std::shared_ptr<AFeature>> &features) = 0;
69 std::vector<std::shared_ptr<AFeature>> existing_features = std::vector<std::shared_ptr<AFeature>>()) = 0;
77 virtual double computeDist(
const cv::Mat &desc1,
const cv::Mat &desc2)
const = 0;
96 const std::vector<std::shared_ptr<AFeature>> &features,
97 std::vector<std::shared_ptr<AFeature>> &features_in_box)
const;
111 std::vector<std::shared_ptr<AFeature>> &features,
112 const std::string &featurelabel =
"pointxd");
122 std::vector<cv::KeyPoint> &keypoints,
123 cv::Mat &descriptors);
131 static void FeatureToP2f(std::vector<std::shared_ptr<AFeature>> features, std::vector<cv::Point2f> &p2fs);
141 #endif // AFEATUREDETECTOR_H
void deleteUndescribedFeatures(std::vector< std::shared_ptr< AFeature >> &features)
Definition: aFeatureDetector.cpp:37
static void FeatureToP2f(std::vector< std::shared_ptr< AFeature >> features, std::vector< cv::Point2f > &p2fs)
Convert a vector of AFeature pointers to a vector of cv::Point2f.
Definition: aFeatureDetector.cpp:84
virtual 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 >>())=0
Virtual function to detect and compute features in a grid (bucketting).
int _n_total
the maximum amount of features the detector should find for any given image
Definition: aFeatureDetector.h:134
EIGEN_MAKE_ALIGNED_OPERATOR_NEW AFeatureDetector()
Definition: aFeatureDetector.h:25
virtual void computeDescriptor(const cv::Mat &img, std::vector< std::shared_ptr< AFeature >> &features)=0
Virtual function to compute descriptors for a set of features.
AFeatureDetector(int n, int n_per_cell)
Definition: aFeatureDetector.h:26
size_t getNbDesiredFeatures()
Definition: aFeatureDetector.h:79
virtual void detectAndCompute(const cv::Mat &img, const cv::Mat &mask, std::vector< cv::KeyPoint > &keypoints, cv::Mat &descriptors, int n_points=0)=0
Virtual function to detect and compute features in an image.
Definition: AFeature2D.h:8
double _max_matching_dist
distance threshold for matching
Definition: aFeatureDetector.h:136
bool getFeaturesInBox(int x, int y, int w, int h, const std::vector< std::shared_ptr< AFeature >> &features, std::vector< std::shared_ptr< AFeature >> &features_in_box) const
Get features from a feature set in a bounding box defined by (x, y, w, h).
Definition: aFeatureDetector.cpp:10
virtual double computeDist(const cv::Mat &desc1, const cv::Mat &desc2) const =0
Virtual function to compute the distance between two feature descriptors.
int _n_per_cell
the number of features per cell
Definition: aFeatureDetector.h:135
Abstract class for feature detectors.
Definition: aFeatureDetector.h:22
static void KeypointToFeature(std::vector< cv::KeyPoint > keypoints, cv::Mat descriptors, std::vector< std::shared_ptr< AFeature >> &features, const std::string &featurelabel="pointxd")
Convert OpenCV keypoints and descriptors to a vector of AFeature pointers.
Definition: aFeatureDetector.cpp:45
static void FeatureToKeypoint(std::vector< std::shared_ptr< AFeature >> features, std::vector< cv::KeyPoint > &keypoints, cv::Mat &descriptors)
Convert a vector of AFeature pointers to OpenCV keypoints and descriptors.
Definition: aFeatureDetector.cpp:68
double getMaxMatchingDist() const
Definition: aFeatureDetector.h:80
virtual void init()=0
Virtual function to initialize the feature detector.
~AFeatureDetector()
Definition: aFeatureDetector.h:27