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

Rename FeatureIdxGrid -> OccupancyGrid to TrackingGrid

parent 82c22137
No related branches found
No related tags found
No related merge requests found
...@@ -225,7 +225,7 @@ public: ...@@ -225,7 +225,7 @@ public:
cell_width_(_img_width / _n_cell_cols), cell_width_(_img_width / _n_cell_cols),
cell_height_(_img_height / _n_cell_rows), cell_height_(_img_height / _n_cell_rows),
grid_(_n_cell_rows, std::vector<FeatureIdxMap>(_n_cell_cols,FeatureIdxMap())), grid_(_n_cell_rows, std::vector<FeatureIdxMap>(_n_cell_cols,FeatureIdxMap())),
occupancy_grid_(Eigen::MatrixXi::Zero(_n_cell_rows,_n_cell_cols)), 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_)) empty_cells_tile_tmp_(Eigen::MatrixXi::Zero(2,n_cell_rows_ * n_cell_cols_))
{ {
// //
...@@ -256,7 +256,7 @@ public: ...@@ -256,7 +256,7 @@ public:
for (auto ii=0; ii < grid_.size(); ++ii) for (auto ii=0; ii < grid_.size(); ++ii)
for (auto jj=0; jj < grid_.size(); ++jj) for (auto jj=0; jj < grid_.size(); ++jj)
grid_.at(ii).at(jj).clear(); grid_.at(ii).at(jj).clear();
occupancy_grid_.setZero(); tracking_grid_.setZero();
empty_cells_tile_tmp_.setZero(); empty_cells_tile_tmp_.setZero();
} }
...@@ -320,31 +320,31 @@ public: ...@@ -320,31 +320,31 @@ public:
/** /**
* \brief Hit occupancy grid by cell. * \brief Hit occupancy grid by cell.
*/ */
inline void hitOccupancyGrid(const Eigen::Vector2i& _cell) inline void hitTrackingCell(const Eigen::Vector2i& _cell)
{ {
if (_cell(0) < 0 || _cell(1) < 0 || _cell(0) > n_cell_rows_ || _cell(1) > n_cell_cols_) if (_cell(0) < 0 || _cell(1) < 0 || _cell(0) > n_cell_rows_ || _cell(1) > n_cell_cols_)
return; return;
occupancy_grid_(_cell(0), _cell(1))++; tracking_grid_(_cell(0), _cell(1))++;
} }
/**
* \brief Hit occupancy grid by cell coordinates (row, col).
*/
template<typename Scalar>
inline void hitTrackingCell(const Scalar _row, const Scalar _col)
{
Eigen::Vector2i cell;
cell << _row, _col;
hitTrackingCell(cell);
}
/** /**
* \brief Hit occupancy grid by keypoint. * \brief Hit occupancy grid by keypoint.
*/ */
inline void hitOccupancyGrid(const cv::KeyPoint& _pix) inline void hitTrackingCell(const cv::KeyPoint& _pix)
{ {
Eigen::Vector2i cell = getCell(_pix); Eigen::Vector2i cell = getCell(_pix);
hitOccupancyGrid(cell); hitTrackingCell(cell);
}
/**
* \brief Hit occupancy grid by cell coordinates (row, col).
*/
template<typename Scalar>
inline void hitOccupancyGrid(const Scalar _row, const Scalar _col)
{
Eigen::Vector2i cell;
cell << _row, _col;
hitOccupancyGrid(cell);
} }
/** /**
...@@ -352,7 +352,7 @@ public: ...@@ -352,7 +352,7 @@ public:
* \param _roi the resulting ROI * \param _roi the resulting ROI
* \return true if ROI exists. * \return true if ROI exists.
*/ */
bool pickEmptyCell(Eigen::Vector2i & _cell) bool pickEmptyTrackingCell(Eigen::Vector2i & _cell)
{ {
int kk = 0; int kk = 0;
Eigen::Vector2i cell0; Eigen::Vector2i cell0;
...@@ -360,7 +360,7 @@ public: ...@@ -360,7 +360,7 @@ public:
for (int jj = 1; jj < n_cell_cols_; jj++) { for (int jj = 1; jj < n_cell_cols_; jj++) {
cell0(0) = ii; cell0(0) = ii;
cell0(1) = jj; cell0(1) = jj;
if (occupancy_grid_(ii, jj) == 0) if (tracking_grid_(ii, jj) == 0)
{ {
empty_cells_tile_tmp_(0,kk) = ii; //may be done in a better way empty_cells_tile_tmp_(0,kk) = ii; //may be done in a better way
empty_cells_tile_tmp_(1,kk) = jj; empty_cells_tile_tmp_(1,kk) = jj;
...@@ -384,16 +384,16 @@ public: ...@@ -384,16 +384,16 @@ public:
* in order to avoid searching again in it. * in order to avoid searching again in it.
* \param _roi the ROI where nothing was found * \param _roi the ROI where nothing was found
*/ */
void blockCell(Eigen::Vector2i& cell) void blockTrackingCell(Eigen::Vector2i& cell)
{ {
occupancy_grid_(cell(0), cell(1)) = 0; tracking_grid_(cell(0), cell(1)) = 0;
} }
private: private:
size_t n_cell_rows_, n_cell_cols_; size_t n_cell_rows_, n_cell_cols_;
size_t cell_width_, cell_height_; size_t cell_width_, cell_height_;
Grid grid_; Grid grid_;
Eigen::MatrixXi occupancy_grid_; Eigen::MatrixXi tracking_grid_;
Eigen::MatrixXi empty_cells_tile_tmp_; 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