Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
V
vision
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Model registry
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
mobile_robotics
wolf_projects
wolf_lib
plugins
vision
Commits
86d018ef
Commit
86d018ef
authored
3 years ago
by
Joan Solà Ortega
Browse files
Options
Downloads
Patches
Plain Diff
Add isCellBlocked()
parent
a1320e2e
No related branches found
Branches containing commit
No related tags found
Tags containing commit
2 merge requests
!36
After cmake and const refactor
,
!28
Resolve "Building a new visual odometry system"
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
include/vision/processor/active_search.h
+16
-8
16 additions, 8 deletions
include/vision/processor/active_search.h
src/processor/active_search.cpp
+9
-3
9 additions, 3 deletions
src/processor/active_search.cpp
with
25 additions
and
11 deletions
include/vision/processor/active_search.h
+
16
−
8
View file @
86d018ef
...
...
@@ -203,6 +203,7 @@ class ActiveSearchGrid {
/**
* \brief Add a projected pixel to the grid.
* If the cell is blocked, unblock and add.
* \param _x the x-coordinate of the pixel to add.
* \param _y the y-coordinate of the pixel to add.
*/
...
...
@@ -211,6 +212,7 @@ class ActiveSearchGrid {
/**
* \brief Add a projected pixel to the grid.
* If the cell is blocked, unblock and add.
* \param _pix the pixel to add as an Eigen 2-vector with any Scalar type (can be a non-integer).
*/
template
<
typename
Scalar
>
...
...
@@ -218,6 +220,7 @@ class ActiveSearchGrid {
/**
* \brief Add a projected pixel to the grid.
* If the cell is blocked, unblock and add.
* \param _pix the pixel to add as a cv::KeyPoint.
*/
void
hitCell
(
const
cv
::
KeyPoint
&
_pix
);
...
...
@@ -230,18 +233,17 @@ class ActiveSearchGrid {
bool
pickRoi
(
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 _roi the ROI where nothing was found
* \brief Block a cell known to be empty in order to avoid searching again in it.
* \param _cell the cell where nothing was found
*/
void
blockCell
(
const
cv
::
R
ect
&
_roi
);
void
blockCell
(
const
Eigen
::
V
ect
or2i
&
_cell
);
/**
* \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
* \param _
roi
the
ROI
where nothing was found
*/
void
blockCell
(
const
Vector2i
&
_cell
);
void
blockCell
(
const
cv
::
Rect
&
_roi
);
private:
...
...
@@ -271,6 +273,12 @@ class ActiveSearchGrid {
*/
void
cell2roi
(
const
Eigen
::
Vector2i
&
_cell
,
cv
::
Rect
&
_roi
);
/**
* \brief True if the cell is blocked
* \param _cell the queried cell
*/
bool
isCellBlocked
(
const
Eigen
::
Vector2i
&
_cell
);
};
inline
void
ActiveSearchGrid
::
clear
()
...
...
@@ -303,8 +311,8 @@ inline void ActiveSearchGrid::hitCell(const Scalar _x, const Scalar _y)
if
(
cell
(
0
)
<
0
||
cell
(
1
)
<
0
||
cell
(
0
)
>=
grid_size_
(
0
)
||
cell
(
1
)
>=
grid_size_
(
1
))
return
;
if
(
projections_count_
(
cell
(
0
),
cell
(
1
))
==
-
1
)
projections_count_
(
cell
(
0
),
cell
(
1
))
=
0
;
if
(
isCellBlocked
(
cell
)
)
projections_count_
(
cell
(
0
),
cell
(
1
))
=
0
;
// unblock cell: it becomes empty
projections_count_
(
cell
(
0
),
cell
(
1
))
++
;
}
...
...
This diff is collapsed.
Click to expand it.
src/processor/active_search.cpp
+
9
−
3
View file @
86d018ef
...
...
@@ -76,7 +76,8 @@ bool ActiveSearchGrid::pickEmptyCell(Eigen::Vector2i & _cell) {
for
(
int
j
=
1
;
j
<
grid_size_
(
1
)
-
1
;
j
++
)
{
cell0
(
0
)
=
i
;
cell0
(
1
)
=
j
;
if
(
projections_count_
(
i
,
j
)
==
0
)
{
if
(
projections_count_
(
i
,
j
)
==
0
)
// cell in empty AND not blocked
{
empty_cells_tile_tmp_
(
0
,
k
)
=
i
;
//may be done in a better way
empty_cells_tile_tmp_
(
1
,
k
)
=
j
;
k
++
;
...
...
@@ -125,6 +126,11 @@ bool ActiveSearchGrid::pickRoi(cv::Rect & _roi) {
return
false
;
}
void
ActiveSearchGrid
::
blockCell
(
const
cv
::
Rect
&
_cell
)
{
projections_count_
(
_cell
(
0
),
_cell
(
1
))
=
-
1
;
}
void
ActiveSearchGrid
::
blockCell
(
const
cv
::
Rect
&
_roi
)
{
Eigen
::
Vector2i
pix
;
...
...
@@ -134,9 +140,9 @@ void ActiveSearchGrid::blockCell(const cv::Rect & _roi)
blockCell
(
cell
);
}
void
ActiveSearchGrid
::
blockCell
(
const
cv
::
R
ect
&
_cell
)
bool
ActiveSearchGrid
::
isCellBlocked
(
const
Eigen
::
V
ect
or2i
&
_cell
)
{
projections_count_
(
_cell
(
0
),
_cell
(
1
))
=
-
1
;
return
projections_count_
(
_cell
(
0
),
_cell
(
1
))
<
0
;
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment