Skip to content
Snippets Groups Projects
Commit e31fe1d1 authored by Joan Solà Ortega's avatar Joan Solà Ortega
Browse files

Fix bug with non-cleared variables at the start of active_search

parent 58f81944
No related branches found
No related tags found
No related merge requests found
......@@ -34,6 +34,9 @@ void AlgorithmACTIVESEARCH::initAlg(const int& _img_width, const int& _img_heigh
cell_size_(1) = img_size_(1) / params_ptr_->n_cells_v;
offset_ = -cell_size_ / 2;
// set all ready to start clean
this->clear();
if (params_ptr_->draw_results)
{
cv::startWindowThread();
......@@ -84,14 +87,16 @@ bool AlgorithmACTIVESEARCH::pickEmptyCell(Eigen::Vector2i & _cell) {
/*
* Get cell origin (exact pixel)
*/
Eigen::Vector2i AlgorithmACTIVESEARCH::cellOrigin(const Eigen::Vector2i & _cell) {
Eigen::Vector2i AlgorithmACTIVESEARCH::cellOrigin(const Eigen::Vector2i & _cell)
{
Eigen::Vector2i cell0;
cell0(0) = offset_(0) + cell_size_(0) * _cell(0);
cell0(1) = offset_(1) + cell_size_(1) * _cell(1);
return cell0;
}
void AlgorithmACTIVESEARCH::cell2roi(const Eigen::Vector2i & _cell, cv::Rect & _roi) {
void AlgorithmACTIVESEARCH::cell2roi(const Eigen::Vector2i & _cell, cv::Rect & _roi)
{
roi_coordinates_ = cellOrigin(_cell);
roi_coordinates_(0) += params_ptr_->separation;
roi_coordinates_(1) += params_ptr_->separation;
......@@ -104,8 +109,8 @@ void AlgorithmACTIVESEARCH::cell2roi(const Eigen::Vector2i & _cell, cv::Rect & _
_roi.height = roi_size(1);
}
bool AlgorithmACTIVESEARCH::pickEmptyRoi(cv::Rect & _roi) {
bool AlgorithmACTIVESEARCH::pickEmptyRoi(cv::Rect & _roi)
{
Eigen::Vector2i cell;
if (pickEmptyCell(cell)) {
cell2roi(cell, _roi);
......
......@@ -255,6 +255,7 @@ inline AlgorithmBasePtr AlgorithmACTIVESEARCH::create(const std::string& _unique
inline void AlgorithmACTIVESEARCH::clear()
{
projections_count_.setZero();
empty_cells_tile_tmp_.setZero();
}
inline void AlgorithmACTIVESEARCH::renew()
......
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