MTF
spiUtils.h
1 #ifndef MTF_SPI_UTILS_H
2 #define MTF_SPI_UTILS_H
3 
4 #include "mtf/Macros/common.h"
5 
6 #include <boost/any.hpp>
7 #include <vector>
8 
9 _MTF_BEGIN_NAMESPACE
10 namespace utils{
11  namespace spi{
12  enum class Types{ None, PixDiff, Gradient, GFTT };
13  typedef std::vector<boost::any> ParamsType;
14  struct Base{
15  Base(VectorXb &_mask) :mask(_mask){}
16  protected:
17  VectorXb &mask;
18  };
19  struct PixDiff : Base{
20  PixDiff(VectorXb &mask, const ParamsType &params);
21  void initialize(const PixValT &init_pix_vals);
22  void update(const PixValT &init_pix_vals, const PixValT &curr_pix_vals);
23  private:
24  double pix_diff_thresh;
25  VectorXd rel_pix_diff;
26  double max_pix_diff;
27  };
28  struct Gradient : Base{
29  Gradient(VectorXb &mask, const ParamsType &params);
30  void initialize(const PixGradT &init_pix_grad);
31  void update(const PixGradT &curr_pix_grad);
32  private:
33  double grad_thresh;
34  bool use_union;
35  unsigned int n_pix;
36  VectorXd pix_grad_norm;
37  VectorXb init_mask;
38  };
40  struct GFTT : Base{
41  GFTT(VectorXb &mask, const ParamsType &params);
42  void initialize(const PixValT &init_pix_vals,
43  unsigned int _resx, unsigned int _resy);
44  void update(const PixValT &curr_pix_vals);
45  private:
46  int max_corners;
47  double quality_level;
48  double min_distance;
49  int block_size;
50  bool use_harris_detector;
51  double k;
52  bool use_union;
53  int neigh_offset;
54  unsigned int resx, resy, n_pix;
55  cv::Mat curr_patch_32f, good_locations;
56  VectorXb init_mask;
57  void getMask(const PixValT &curr_pix_vals, VectorXb &init_spi_mask);
58  };
59  }
60  double getMean(const bool *spi_mask, const VectorXd &vec,
61  int vec_size);
63  void getMean(RowVectorXd &mean_vec, const bool *spi_mask,
64  const MatrixXd &mat, int n_rows);
66  void getMean(VectorXd &mean_vec, const bool *spi_mask,
67  const MatrixXd &mat, int n_cols);
68  void getProd(RowVectorXd &df_dp, const bool *spi_mask,
69  const RowVectorXd &df_dI, const MatrixXd &dI_dp,
70  int n_pix, int n_channels);
71  void getDiffOfProd(RowVectorXd &df_dp, const bool *spi_mask,
72  const RowVectorXd &df_dIt, const MatrixXd &dIt_dp,
73  const RowVectorXd &df_dI0, const MatrixXd &dI0_dp,
74  int n_pix, int n_channels);
75  void expandMask(bool *out_mask, const bool *in_mask, int res_ratio_x,
76  int res_ratio_y, int in_resx, int in_resy, int out_resx, int out_resy);
77 
78 }
79 _MTF_END_NAMESPACE
80 
81 #endif
Definition: spiUtils.h:19
Definition: spiUtils.h:28
Definition: spiUtils.h:14
basic functions for preprocessing the raw input image using filtering, resizing and histogram equaliz...
Definition: histUtils.h:20
Definition: FeatureTracker.h:100