Skip to content
Snippets Groups Projects
Commit be9690a0 authored by Angel Santamaria-Navarro's avatar Angel Santamaria-Navarro
Browse files

FIX: cell size as float

parent e08a242d
No related branches found
No related tags found
No related merge requests found
......@@ -222,13 +222,15 @@ public:
FeatureIdxGrid(const size_t& _img_height, const size_t& _img_width, const size_t& _n_cell_rows, const size_t& _n_cell_cols) :
n_cell_rows_(_n_cell_rows),
n_cell_cols_(_n_cell_cols),
cell_width_(_img_width / _n_cell_cols),
cell_height_(_img_height / _n_cell_rows),
cell_width_((float) _img_width / _n_cell_cols),
cell_height_((float)_img_height / _n_cell_rows),
grid_(_n_cell_rows, std::vector<FeatureIdxMap>(_n_cell_cols,FeatureIdxMap())),
tracking_grid_(Eigen::MatrixXi::Zero(_n_cell_rows,_n_cell_cols)),
empty_cells_tile_tmp_(Eigen::MatrixXi::Zero(2,n_cell_rows_ * n_cell_cols_))
{
//
//VU_DEBUG("CELL SIZE: " << cell_width_ << " x " << cell_height_ );
//VU_DEBUG("GRID SIZE: " << rows() << " x " << cols() );
//VU_DEBUG("IMAGE SIZE: " << _img_width << " x " << _img_height);
}
size_t numFeatures(const size_t& _row, const size_t& _col)
......@@ -260,6 +262,16 @@ public:
empty_cells_tile_tmp_.setZero();
}
inline int rows()
{
return n_cell_rows_;
}
inline int cols()
{
return n_cell_cols_;
}
inline Eigen::Vector2i getCell(const cv::KeyPoint& _kp)
{
Eigen::Vector2i cell; // [Row Col]
......@@ -270,8 +282,10 @@ public:
void insert(const cv::KeyPoint& _kp, const size_t& _idx)
{
Eigen::Vector2i cell = getCell(_kp);
grid_.at(cell(0)).at(cell(1)).emplace(_kp.response, _idx);
Eigen::Vector2i cell = getCell(_kp);
grid_.at(cell(0)).at(cell(1)).emplace(_kp.response, _idx);
//VU_DEBUG("KP at " << _kp.pt.x << "," << _kp.pt.y);
//VU_DEBUG("Inserted in CELL: " << cell(0) << "," << cell(1));
}
void insert(const KeyPointVector& _kps)
......@@ -391,7 +405,7 @@ public:
private:
size_t n_cell_rows_, n_cell_cols_;
size_t cell_width_, cell_height_;
float cell_width_, cell_height_;
Grid grid_;
Eigen::MatrixXi tracking_grid_;
Eigen::MatrixXi empty_cells_tile_tmp_;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment