1 #ifndef MTF_FEATURE_TRACKER_H 2 #define MTF_FEATURE_TRACKER_H 4 #include "FeatureBase.h" 7 #include "FLANNParams.h" 9 #include "FLANNCVParams.h" 11 #if CV_MAJOR_VERSION < 3 12 #include "opencv2/features2d/features2d.hpp" 14 #include "opencv2/features2d.hpp" 19 #include <boost/any.hpp> 23 #ifndef FEAT_DISABLE_NONFREE 27 double contrast_thresh;
30 SIFT(
const vector<boost::any> ¶ms,
31 std::string _type =
"detector");
32 void create(cv::Ptr<cv::FeatureDetector> &ptr);
33 #if CV_MAJOR_VERSION < 3 34 void create(cv::Ptr<cv::DescriptorExtractor> &ptr);
38 double hessian_threshold;
43 SURF(
const vector<boost::any> ¶ms,
44 std::string _type =
"detector");
45 void create(cv::Ptr<cv::FeatureDetector> &ptr);
46 #if CV_MAJOR_VERSION < 3 47 void create(cv::Ptr<cv::DescriptorExtractor> &ptr);
56 BRISK(
const vector<boost::any> ¶ms,
57 std::string _type =
"detector");
58 void create(cv::Ptr<cv::FeatureDetector> &ptr);
59 #if CV_MAJOR_VERSION < 3 60 void create(cv::Ptr<cv::DescriptorExtractor> &ptr);
73 ORB(
const vector<boost::any> ¶ms,
74 std::string _type =
"detector");
75 void create(cv::Ptr<cv::FeatureDetector> &ptr);
76 #if CV_MAJOR_VERSION < 3 77 void create(cv::Ptr<cv::DescriptorExtractor> &ptr);
82 bool non_max_suppression;
84 FAST(
const vector<boost::any> ¶ms);
85 void create(cv::Ptr<cv::FeatureDetector> &ptr);
94 double area_threshold;
97 MSER(
const vector<boost::any> ¶ms);
98 void create(cv::Ptr<cv::FeatureDetector> &ptr);
102 double quality_level;
105 bool use_harris_detector;
107 GFTT(
const vector<boost::any> ¶ms);
108 void create(cv::Ptr<cv::FeatureDetector> &ptr);
110 #if CV_MAJOR_VERSION >= 3 113 bool non_max_suppression;
115 AGAST(
const vector<boost::any> ¶ms);
116 void create(cv::Ptr<cv::DescriptorExtractor> &ptr);
118 #ifndef FEAT_DISABLE_NONFREE 122 bool use_orientation =
false;
123 BRIEF(
const vector<boost::any> ¶ms);
124 void create(cv::Ptr<cv::DescriptorExtractor> &ptr);
127 bool orientation_normalized;
128 bool scale_normalized;
131 FREAK(
const vector<boost::any> ¶ms);
132 void create(cv::Ptr<cv::DescriptorExtractor> &ptr);
137 LUCID(
const vector<boost::any> ¶ms);
138 void create(cv::Ptr<cv::DescriptorExtractor> &ptr);
142 bool rotation_invariance;
144 LATCH(
const vector<boost::any> ¶ms);
145 void create(cv::Ptr<cv::DescriptorExtractor> &ptr);
148 typedef vector<float> vectorf;
156 bool use_orientation;
157 DAISY(
const vector<boost::any> ¶ms);
158 void create(cv::Ptr<cv::DescriptorExtractor> &ptr);
164 bool use_scale_orientation;
167 VGG(
const vector<boost::any> ¶ms);
168 void create(cv::Ptr<cv::DescriptorExtractor> &ptr);
172 bool use_scale_orientation;
174 BoostDesc(
const vector<boost::any> ¶ms);
175 void create(cv::Ptr<cv::DescriptorExtractor> &ptr);
180 int response_threshold;
181 int line_threshold_projected;
182 int line_threshold_binarized;
183 int suppress_nonmax_size;
184 Star(
const vector<boost::any> ¶ms);
185 void create(cv::Ptr<cv::FeatureDetector> &ptr);
188 int patch_radius = 3;
189 int search_area_radius = 5;
191 int nms_scale_radius = 0;
192 float th_saliency = 250.0f;
194 float scale_factor = 1.25f;
196 bool compute_orientation =
false;
197 MSD(
const vector<boost::any> ¶ms);
198 void create(cv::Ptr<cv::FeatureDetector> &ptr);
222 BRIEF, FREAK, LUCID, LATCH, DAISY,
226 typedef std::vector<boost::any> DetectorParamsType;
227 typedef std::vector<boost::any> DescriptorParamsType;
232 DetectorParamsType detector;
233 DescriptorParamsType descriptor;
235 int grid_size_x, grid_size_y;
236 int search_window_x, search_window_y;
237 bool init_at_each_frame;
240 double max_dist_ratio;
263 const DetectorParamsType &_detector,
264 const DescriptorParamsType &_descriptor,
265 int _grid_size_x,
int _grid_size_y,
266 int _search_win_x,
int _search_win_y,
267 bool _init_at_each_frame,
bool _rebuild_index,
268 int _max_iters,
double _epsilon,
bool _enable_pyr,
270 double _max_dist_ratio,
int _min_matches,
bool _uchar_input,
271 bool _show_keypoints,
bool _show_matches,
bool _debug_mode);
274 int getResX()
const{
return grid_size_x; }
275 int getResY()
const{
return grid_size_y; }
287 typedef typename SSM::ParamType
SSMParams;
288 typedef typename SSM::EstimatorParams EstimatorParams;
289 #ifndef DISABLE_FLANN 290 typedef FLANNParams::IdxType IdxType;
291 typedef FLANNParams::SearchType SearchType;
292 typedef flann::Index<flann::L2<float> > flannIdxT;
293 typedef flann::Matrix<float> flannMatT;
294 typedef flann::Matrix<int> flannResultT;
295 typedef std::shared_ptr<flannMatT> FlannMatPtr;
296 typedef std::shared_ptr<flannIdxT> FlannIdxPtr;
299 typedef cv::Ptr<cv::FeatureDetector> DetectorPtr;
300 typedef cv::Ptr<cv::DescriptorExtractor> DescriptorPtr;
303 const ParamType *grid_params =
nullptr,
304 #ifndef DISABLE_FLANN
308 const EstimatorParams *_est_params =
nullptr,
309 const SSMParams *ssm_params =
nullptr 313 void initialize(
const cv::Mat &corners)
override;
314 void update()
override;
315 void setImage(
const cv::Mat &img)
override;
316 void setRegion(
const cv::Mat& corners)
override;
317 const uchar* getPixMask()
override{
return pix_mask.data(); }
318 int getResX()
override{
return params.grid_size_x; }
319 int getResY()
override{
return params.grid_size_y; }
320 const cv::Mat& getRegion()
override{
return cv_corners_mat; }
321 int inputType()
const override{
326 bool detect(
const cv::Mat &mask, cv::Mat &obj_location)
override;
328 using FeatureBase::initialize;
329 using FeatureBase::update;
330 using FeatureBase::setRegion;
332 SSM& getSSM() {
return ssm; }
334 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
339 #ifndef DISABLE_FLANN 343 EstimatorParams est_params;
344 cv::Ptr<cv::FlannBasedMatcher> matcher;
345 DetectorPtr detector;
346 DescriptorPtr descriptor;
348 #ifndef DISABLE_FLANN 349 FlannIdxPtr flann_idx;
350 FlannMatPtr flann_dataset, flann_query;
352 cv::Mat curr_img_in, curr_img, prev_img;
353 std::vector<cv::KeyPoint> curr_key_pts, prev_key_pts;
354 std::vector<cv::Point2f> curr_pts, prev_pts;
355 cv::Mat best_idices, best_distances;
357 int n_pts, n_key_pts, n_good_key_pts;
358 cv::Size search_window;
359 cv::Mat curr_descriptors, prev_descriptors;
360 std::vector<uchar> pix_mask;
361 std::vector<int> good_indices;
363 CornersT opt_warped_corners;
366 cv::Mat curr_img_disp;
368 char* patch_win_name;
370 MatrixXi _linear_idx;
372 bool use_feature_detector;
374 void matchKeyPoints();
375 void cmptWarpedCorners();
376 void showKeyPoints();
bool show_keypoints
show the locations of individual key points
Definition: FeatureTracker.h:254
Definition: StateSpaceModel.h:35
Definition: FeatureBase.h:9
Definition: FeatureTracker.h:52
Definition: FeatureTracker.h:24
Definition: FeatureTracker.h:80
Definition: FeatureTracker.h:63
index specific params
Definition: FLANNParams.h:10
index specific params
Definition: FLANNCVParams.h:10
DescriptorType
Definition: FeatureTracker.h:216
Definition: FeatureTracker.h:87
Definition: FeatureTracker.h:281
Definition: FeatureTracker.h:202
Definition: FeatureTracker.h:37
DetectorType
Definition: FeatureTracker.h:203
Definition: FeatureTracker.h:100
bool show_matches
show the matches between keypoints
Definition: FeatureTracker.h:256
int max_iters
maximum iterations of the GridTracker algorithm to run for each frame
Definition: FeatureTracker.h:245