libfovis
grid_filter.hpp
1 #ifndef __fovis_grid_filter_hpp__
2 #define __fovis_grid_filter_hpp__
3 
4 #include <math.h>
5 #include <vector>
6 #include "keypoint.hpp"
7 
8 namespace fovis
9 {
10 
15 public:
32  GridKeyPointFilter (int img_width, int img_height, int bucket_width,
33  int bucket_height, int max_keypoints_per_bucket) :
34  _img_width(img_width), _img_height(img_height),
35  _bucket_width(bucket_width), _bucket_height(bucket_height),
36  _max_keypoints_per_bucket(max_keypoints_per_bucket),
37  _grid_rows(ceil((float)img_height/bucket_height)),
38  _grid_cols(ceil((float)img_width/bucket_width)),
39  _buckets(_grid_rows * _grid_cols)
40  {
41  }
42 
49  void filter(std::vector<KeyPoint>* keypoints);
50 
51 private:
52  int _img_width;
53  int _img_height;
54  int _bucket_width;
55  int _bucket_height;
56  int _max_keypoints_per_bucket;
57  int _grid_rows;
58  int _grid_cols;
59  std::vector<std::vector<KeyPoint> > _buckets;
60 
61 };
62 
63 }
64 
65 #endif
Places features into grid cells and discards the weakest features in each cell.
Definition: grid_filter.hpp:14
void filter(std::vector< KeyPoint > *keypoints)
quick and dirty profiling tool.inspired by the matlab tic/toc command
Definition: camera_intrinsics.hpp:6
GridKeyPointFilter(int img_width, int img_height, int bucket_width, int bucket_height, int max_keypoints_per_bucket)
Definition: grid_filter.hpp:32