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
ff2b6155
Commit
ff2b6155
authored
3 years ago
by
Joan Solà Ortega
Browse files
Options
Downloads
Patches
Plain Diff
debug info
parent
c88111a4
No related branches found
No related tags found
2 merge requests
!36
After cmake and const refactor
,
!28
Resolve "Building a new visual odometry system"
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/processor/processor_visual_odometry.cpp
+9
-9
9 additions, 9 deletions
src/processor/processor_visual_odometry.cpp
with
9 additions
and
9 deletions
src/processor/processor_visual_odometry.cpp
+
9
−
9
View file @
ff2b6155
...
@@ -98,7 +98,7 @@ void ProcessorVisualOdometry::preProcess()
...
@@ -98,7 +98,7 @@ void ProcessorVisualOdometry::preProcess()
capture_image_incoming_
->
setTracksPrev
(
tracks_init
);
capture_image_incoming_
->
setTracksPrev
(
tracks_init
);
auto
dt_preprocess
=
std
::
chrono
::
duration_cast
<
std
::
chrono
::
milliseconds
>
(
std
::
chrono
::
system_clock
::
now
()
-
t1
).
count
();
auto
dt_preprocess
=
std
::
chrono
::
duration_cast
<
std
::
chrono
::
milliseconds
>
(
std
::
chrono
::
system_clock
::
now
()
-
t1
).
count
();
std
::
cout
<<
"dt_preprocess (ms): "
<<
dt_preprocess
<<
std
::
endl
;
WOLF_TRACE
(
"dt_preprocess (ms): "
,
dt_preprocess
)
;
return
;
return
;
}
}
...
@@ -165,13 +165,13 @@ void ProcessorVisualOdometry::preProcess()
...
@@ -165,13 +165,13 @@ void ProcessorVisualOdometry::preProcess()
WOLF_TRACE
(
"# of tracks: "
,
n_tracks_origin
,
"; min # of tracks: "
,
params_visual_odometry_
->
min_features_for_keyframe
);
WOLF_TRACE
(
"# of tracks: "
,
n_tracks_origin
,
"; min # of tracks: "
,
params_visual_odometry_
->
min_features_for_keyframe
);
if
(
n_tracks_origin
<
params_visual_odometry_
->
min_features_for_keyframe
){
if
(
n_tracks_origin
<
params_visual_odometry_
->
min_features_for_keyframe
){
WOLF_TRACE
(
"Too Few Tracks"
);
WOLF_TRACE
(
"Too Few Tracks
. Detecting more keypoints...
"
);
// Detect new KeyPoints
// Detect new KeyPoints
std
::
vector
<
cv
::
KeyPoint
>
kps_last_new
;
std
::
vector
<
cv
::
KeyPoint
>
kps_last_new
;
detector_
->
detect
(
img_last
,
kps_last_new
);
detector_
->
detect
(
img_last
,
kps_last_new
);
cv
::
KeyPointsFilter
::
retainBest
(
kps_last_new
,
params_visual_odometry_
->
max_new_features
);
cv
::
KeyPointsFilter
::
retainBest
(
kps_last_new
,
params_visual_odometry_
->
max_new_features
);
WOLF_TRACE
(
"Detected "
,
kps_last_new
.
size
(),
"
new
raw keypoints"
);
WOLF_TRACE
(
"Detected "
,
kps_last_new
.
size
(),
" raw keypoints"
);
// Create a map of wolf KeyPoints to track only the new ones
// Create a map of wolf KeyPoints to track only the new ones
KeyPointsMap
mwkps_last_new
,
mwkps_incoming_new
;
KeyPointsMap
mwkps_last_new
,
mwkps_incoming_new
;
...
@@ -179,7 +179,7 @@ void ProcessorVisualOdometry::preProcess()
...
@@ -179,7 +179,7 @@ void ProcessorVisualOdometry::preProcess()
WKeyPoint
wkp
(
cvkp
);
WKeyPoint
wkp
(
cvkp
);
mwkps_last_new
[
wkp
.
getId
()]
=
wkp
;
mwkps_last_new
[
wkp
.
getId
()]
=
wkp
;
}
}
WOLF_TRACE
(
"Found "
,
mwkps_last_new
.
size
(),
" new keypoints"
);
WOLF_TRACE
(
"Found "
,
mwkps_last_new
.
size
(),
" new keypoints
in last
"
);
TracksMap
tracks_last_incoming_new
=
kltTrack
(
img_last
,
img_incoming
,
mwkps_last_new
,
mwkps_incoming_new
);
TracksMap
tracks_last_incoming_new
=
kltTrack
(
img_last
,
img_incoming
,
mwkps_last_new
,
mwkps_incoming_new
);
...
@@ -187,7 +187,7 @@ void ProcessorVisualOdometry::preProcess()
...
@@ -187,7 +187,7 @@ void ProcessorVisualOdometry::preProcess()
// tracks that are not geometrically consistent are removed from tracks_last_incoming_new
// tracks that are not geometrically consistent are removed from tracks_last_incoming_new
cv
::
Mat
E
;
cv
::
Mat
E
;
filterWithEssential
(
mwkps_last_new
,
mwkps_incoming_new
,
tracks_last_incoming_new
,
E
);
filterWithEssential
(
mwkps_last_new
,
mwkps_incoming_new
,
tracks_last_incoming_new
,
E
);
WOLF_TRACE
(
"Tracked "
,
mwkps_incoming_new
.
size
(),
" new keypoints"
);
WOLF_TRACE
(
"Tracked "
,
mwkps_incoming_new
.
size
(),
" new keypoints
to incoming
"
);
// Concatenation of old tracks and new tracks
// Concatenation of old tracks and new tracks
// Only keep tracks until it reaches a max nb of tracks
// Only keep tracks until it reaches a max nb of tracks
...
@@ -201,7 +201,7 @@ void ProcessorVisualOdometry::preProcess()
...
@@ -201,7 +201,7 @@ void ProcessorVisualOdometry::preProcess()
tracks_last_incoming_filtered
[
track
.
first
]
=
track
.
second
;
tracks_last_incoming_filtered
[
track
.
first
]
=
track
.
second
;
count_new_tracks
++
;
count_new_tracks
++
;
}
}
WOLF_TRACE
(
"New total : "
,
tracks_last_incoming_filtered
.
size
(),
" tracks"
);
WOLF_TRACE
(
"New total : "
,
n_tracks_origin
,
" + "
,
mwkps_incoming_new
.
size
(),
" = "
,
tracks_last_incoming_filtered
.
size
(),
" tracks"
);
// Update captures
// Update captures
capture_image_last_
->
addKeyPoints
(
mwkps_last_new
);
capture_image_last_
->
addKeyPoints
(
mwkps_last_new
);
...
@@ -214,7 +214,7 @@ void ProcessorVisualOdometry::preProcess()
...
@@ -214,7 +214,7 @@ void ProcessorVisualOdometry::preProcess()
}
}
auto
dt_preprocess
=
std
::
chrono
::
duration_cast
<
std
::
chrono
::
milliseconds
>
(
std
::
chrono
::
system_clock
::
now
()
-
t1
).
count
();
auto
dt_preprocess
=
std
::
chrono
::
duration_cast
<
std
::
chrono
::
milliseconds
>
(
std
::
chrono
::
system_clock
::
now
()
-
t1
).
count
();
WOLF_
INFO
(
"dt_preprocess (ms): "
,
dt_preprocess
);
WOLF_
TRACE
(
"dt_preprocess (ms): "
,
dt_preprocess
);
}
}
...
@@ -253,7 +253,7 @@ unsigned int ProcessorVisualOdometry::processKnown()
...
@@ -253,7 +253,7 @@ unsigned int ProcessorVisualOdometry::processKnown()
}
}
}
}
auto
dt_processKnown
=
std
::
chrono
::
duration_cast
<
std
::
chrono
::
milliseconds
>
(
std
::
chrono
::
system_clock
::
now
()
-
t1
).
count
();
auto
dt_processKnown
=
std
::
chrono
::
duration_cast
<
std
::
chrono
::
milliseconds
>
(
std
::
chrono
::
system_clock
::
now
()
-
t1
).
count
();
std
::
cout
<<
"dt_processKnown (ms): "
<<
dt_processKnown
<<
std
::
endl
;
WOLF_TRACE
(
"dt_processKnown (ms): "
,
dt_processKnown
)
;
// return number of successful tracks until incoming
// return number of successful tracks until incoming
return
tracks_map_li_matched_
.
size
();
return
tracks_map_li_matched_
.
size
();
...
@@ -293,7 +293,7 @@ unsigned int ProcessorVisualOdometry::processNew(const int& _max_features)
...
@@ -293,7 +293,7 @@ unsigned int ProcessorVisualOdometry::processNew(const int& _max_features)
}
}
auto
dt_processNew
=
std
::
chrono
::
duration_cast
<
std
::
chrono
::
milliseconds
>
(
std
::
chrono
::
system_clock
::
now
()
-
t1
).
count
();
auto
dt_processNew
=
std
::
chrono
::
duration_cast
<
std
::
chrono
::
milliseconds
>
(
std
::
chrono
::
system_clock
::
now
()
-
t1
).
count
();
std
::
cout
<<
"dt_processNew (ms): "
<<
dt_processNew
<<
std
::
endl
;
WOLF_TRACE
(
"dt_processNew (ms): "
,
dt_processNew
)
;
return
counter_new_tracks
;
return
counter_new_tracks
;
}
}
...
...
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