From 7524253aa651e82866fc248aabebe3439b3ce5d0 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Joan=20Sol=C3=A0?= <jsola@iri.upc.edu>
Date: Thu, 14 Apr 2022 21:33:16 +0200
Subject: [PATCH] Overload blockCell()

---
 include/vision/processor/active_search.h | 7 +++++++
 src/processor/active_search.cpp          | 7 ++++++-
 2 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/include/vision/processor/active_search.h b/include/vision/processor/active_search.h
index bdfca97a0..bda60ffc3 100644
--- a/include/vision/processor/active_search.h
+++ b/include/vision/processor/active_search.h
@@ -236,6 +236,13 @@ class ActiveSearchGrid {
          */
         void blockCell(const cv::Rect & _roi);
 
+        /**
+         * \brief Call this after pickRoi if no point was found in the roi
+         * in order to avoid searching again in it.
+         * \param _cell the cell where nothing was found
+         */
+        void blockCell(const Vector2i & _cell);
+
 
     private:
         /**
diff --git a/src/processor/active_search.cpp b/src/processor/active_search.cpp
index 76abe9f86..a316781a6 100644
--- a/src/processor/active_search.cpp
+++ b/src/processor/active_search.cpp
@@ -131,7 +131,12 @@ void ActiveSearchGrid::blockCell(const cv::Rect & _roi)
     pix(0) = _roi.x+_roi.width/2;
     pix(1) = _roi.y+_roi.height/2;
     Eigen::Vector2i cell = coords2cell(pix(0), pix(1));
-    projections_count_(cell(0), cell(1)) = -1;
+    blockCell(cell);
+}
+
+void ActiveSearchGrid::blockCell(const cv::Rect & _cell)
+{
+    projections_count_(_cell(0), _cell(1)) = -1;
 }
 
 
-- 
GitLab