Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
wolf
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD 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
wolf
Commits
fe15a61f
Commit
fe15a61f
authored
3 years ago
by
Joan Vallvé Navarro
Browse files
Options
Downloads
Patches
Plain Diff
removed methods, new api for trackIds and gtest
parent
768795c7
No related branches found
No related tags found
2 merge requests
!451
After cmake and const refactor
,
!449
Resolve "TrackMatrix API"
Pipeline
#10749
failed
3 years ago
Stage: deploy_plugins
Stage: deploy_ros
Changes
3
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
include/core/processor/track_matrix.h
+33
-34
33 additions, 34 deletions
include/core/processor/track_matrix.h
src/processor/track_matrix.cpp
+17
-3
17 additions, 3 deletions
src/processor/track_matrix.cpp
test/gtest_track_matrix.cpp
+33
-1
33 additions, 1 deletion
test/gtest_track_matrix.cpp
with
83 additions
and
38 deletions
include/core/processor/track_matrix.h
+
33
−
34
View file @
fe15a61f
...
...
@@ -45,8 +45,8 @@ using std::list;
using
std
::
pair
;
using
std
::
shared_ptr
;
typedef
map
<
TimeStamp
,
FeatureBasePtr
>
Track
;
typedef
map
<
TimeStamp
,
FeatureBaseConstPtr
>
TrackConst
;
typedef
map
<
TimeStamp
,
FeatureBasePtr
>
Track
;
typedef
map
<
TimeStamp
,
FeatureBaseConstPtr
>
TrackConst
;
typedef
map
<
SizeStd
,
FeatureBasePtr
>
Snapshot
;
typedef
map
<
SizeStd
,
FeatureBaseConstPtr
>
SnapshotConst
;
typedef
map
<
SizeStd
,
pair
<
FeatureBasePtr
,
FeatureBasePtr
>
>
TrackMatches
;
// matched feature pairs indexed by track_id
...
...
@@ -102,41 +102,40 @@ class TrackMatrix
TrackMatrix
();
virtual
~
TrackMatrix
();
void
newTrack
(
FeatureBasePtr
_ftr
);
void
add
(
const
SizeStd
&
_track_id
,
const
FeatureBasePtr
&
_ftr
);
void
add
(
const
FeatureBasePtr
&
_ftr_existing
,
const
FeatureBasePtr
&
_ftr_new
);
void
remove
(
FeatureBasePtr
_ftr
);
void
remove
(
const
SizeStd
&
_track_id
);
void
remove
(
CaptureBasePtr
_cap
);
SizeStd
numTracks
()
const
;
SizeStd
trackSize
(
const
SizeStd
&
_track_id
)
const
;
TrackConst
track
(
const
SizeStd
&
_track_id
)
const
;
Track
track
(
const
SizeStd
&
_track_id
);
SnapshotConst
snapshot
(
CaptureBaseConstPtr
_capture
)
const
;
Snapshot
snapshot
(
CaptureBasePtr
_capture
);
void
newTrack
(
FeatureBasePtr
_ftr
);
void
add
(
const
SizeStd
&
_track_id
,
const
FeatureBasePtr
&
_ftr
);
void
add
(
const
FeatureBasePtr
&
_ftr_existing
,
const
FeatureBasePtr
&
_ftr_new
);
void
remove
(
FeatureBasePtr
_ftr
);
void
remove
(
const
SizeStd
&
_track_id
);
void
remove
(
CaptureBasePtr
_cap
);
SizeStd
numTracks
()
const
;
SizeStd
trackSize
(
const
SizeStd
&
_track_id
)
const
;
TrackConst
track
(
const
SizeStd
&
_track_id
)
const
;
Track
track
(
const
SizeStd
&
_track_id
);
SnapshotConst
snapshot
(
CaptureBaseConstPtr
_capture
)
const
;
Snapshot
snapshot
(
CaptureBasePtr
_capture
);
vector
<
FeatureBaseConstPtr
>
trackAsVector
(
const
SizeStd
&
_track_id
)
const
;
vector
<
FeatureBasePtr
>
trackAsVector
(
const
SizeStd
&
_track_id
);
FeatureBaseConstPtrList
snapshotAsList
(
CaptureBaseConstPtr
_cap
)
const
;
FeatureBasePtrList
snapshotAsList
(
CaptureBasePtr
_cap
);
TrackMatchesConst
matches
(
CaptureBaseConstPtr
_cap_1
,
CaptureBaseConstPtr
_cap_2
)
const
;
TrackMatches
matches
(
CaptureBasePtr
_cap_1
,
CaptureBasePtr
_cap_2
);
FeatureBaseConstPtr
firstFeature
(
const
SizeStd
&
_track_id
)
const
;
FeatureBasePtr
firstFeature
(
const
SizeStd
&
_track_id
);
FeatureBaseConstPtr
lastFeature
(
const
SizeStd
&
_track_id
)
const
;
FeatureBasePtr
lastFeature
(
const
SizeStd
&
_track_id
);
FeatureBaseConstPtr
feature
(
const
SizeStd
&
_track_id
,
CaptureBaseConstPtr
_cap
)
const
;
FeatureBasePtr
feature
(
const
SizeStd
&
_track_id
,
CaptureBasePtr
_cap
);
CaptureBaseConstPtr
firstCapture
(
const
SizeStd
&
_track_id
)
const
;
CaptureBasePtr
firstCapture
(
const
SizeStd
&
_track_id
);
list
<
SizeStd
>
trackIds
()
const
;
vector
<
FeatureBasePtr
>
trackAsVector
(
const
SizeStd
&
_track_id
);
FeatureBaseConstPtrList
snapshotAsList
(
CaptureBaseConstPtr
_cap
)
const
;
FeatureBasePtrList
snapshotAsList
(
CaptureBasePtr
_cap
);
TrackMatchesConst
matches
(
CaptureBaseConstPtr
_cap_1
,
CaptureBaseConstPtr
_cap_2
)
const
;
TrackMatches
matches
(
CaptureBasePtr
_cap_1
,
CaptureBasePtr
_cap_2
);
FeatureBaseConstPtr
firstFeature
(
const
SizeStd
&
_track_id
)
const
;
FeatureBasePtr
firstFeature
(
const
SizeStd
&
_track_id
);
FeatureBaseConstPtr
lastFeature
(
const
SizeStd
&
_track_id
)
const
;
FeatureBasePtr
lastFeature
(
const
SizeStd
&
_track_id
);
FeatureBaseConstPtr
feature
(
const
SizeStd
&
_track_id
,
CaptureBaseConstPtr
_cap
)
const
;
FeatureBasePtr
feature
(
const
SizeStd
&
_track_id
,
CaptureBasePtr
_cap
);
CaptureBaseConstPtr
firstCapture
(
const
SizeStd
&
_track_id
)
const
;
CaptureBasePtr
firstCapture
(
const
SizeStd
&
_track_id
);
list
<
SizeStd
>
trackIds
(
CaptureBaseConstPtr
_capture
=
nullptr
)
const
;
// tracks across captures that belong to keyframe
TrackConst
trackAtKeyframes
(
const
SizeStd
&
_track_id
)
const
;
Track
trackAtKeyframes
(
const
SizeStd
&
_track_id
);
const
map
<
SizeStd
,
Track
>&
getTracks
()
{
return
tracks_
;}
const
map
<
CaptureBasePtr
,
Snapshot
>&
getSnapshots
()
{
return
snapshots_
;}
TrackConst
trackAtKeyframes
(
const
SizeStd
&
_track_id
)
const
;
Track
trackAtKeyframes
(
const
SizeStd
&
_track_id
);
private:
...
...
This diff is collapsed.
Click to expand it.
src/processor/track_matrix.cpp
+
17
−
3
View file @
fe15a61f
...
...
@@ -369,12 +369,26 @@ Track TrackMatrix::trackAtKeyframes(const SizeStd& _track_id)
return
Track
();
}
list
<
SizeStd
>
TrackMatrix
::
trackIds
()
const
list
<
SizeStd
>
TrackMatrix
::
trackIds
(
CaptureBaseConstPtr
_capture
)
const
{
list
<
SizeStd
>
track_ids
;
for
(
auto
track
:
tracks_
)
if
(
not
_capture
)
for
(
auto
track_pair
:
tracks_
)
track_ids
.
push_back
(
track_pair
.
first
);
else
{
track_ids
.
push_back
(
track
.
first
);
auto
it
=
std
::
find_if
(
snapshots_
.
begin
(),
snapshots_
.
end
(),
[
_capture
](
const
std
::
pair
<
CaptureBasePtr
,
Snapshot
>&
pair
)
{
return
pair
.
first
==
_capture
;
}
);
if
(
it
!=
snapshots_
.
end
())
for
(
auto
track_pair
:
it
->
second
)
track_ids
.
push_back
(
track_pair
.
first
);
}
return
track_ids
;
}
...
...
This diff is collapsed.
Click to expand it.
test/gtest_track_matrix.cpp
+
33
−
1
View file @
fe15a61f
...
...
@@ -42,7 +42,7 @@ class TrackMatrixTest : public testing::Test
FrameBasePtr
F0
,
F1
,
F2
,
F3
,
F4
;
CaptureBasePtr
C0
,
C1
,
C2
,
C3
,
C4
;
FeatureBasePtr
f0
,
f1
,
f2
,
f3
,
f4
;
FeatureBasePtr
f0
,
f1
,
f2
,
f3
,
f4
,
f5
;
ProblemPtr
problem
;
void
SetUp
()
override
...
...
@@ -71,6 +71,7 @@ class TrackMatrixTest : public testing::Test
f2
=
FeatureBase
::
emplace
<
FeatureBase
>
(
nullptr
,
"FeatureBase"
,
m
,
m_cov
);
f3
=
FeatureBase
::
emplace
<
FeatureBase
>
(
nullptr
,
"FeatureBase"
,
m
,
m_cov
);
f4
=
FeatureBase
::
emplace
<
FeatureBase
>
(
nullptr
,
"FeatureBase"
,
m
,
m_cov
);
f5
=
FeatureBase
::
emplace
<
FeatureBase
>
(
nullptr
,
"FeatureBase"
,
m
,
m_cov
);
// F0 and F4 are keyframes
F0
->
link
(
problem
);
...
...
@@ -507,6 +508,37 @@ TEST_F(TrackMatrixTest, trackAtKeyframes)
ASSERT_EQ
(
trk_kf_1
.
size
(),
0
);
}
TEST_F
(
TrackMatrixTest
,
trackIds
)
{
f0
->
link
(
C0
);
f1
->
link
(
C1
);
f2
->
link
(
C1
);
f3
->
link
(
C1
);
f4
->
link
(
C2
);
f5
->
link
(
C2
);
track_matrix
.
newTrack
(
f0
);
track_matrix
.
add
(
f0
->
trackId
(),
f1
);
track_matrix
.
newTrack
(
f2
);
track_matrix
.
newTrack
(
f3
);
track_matrix
.
add
(
f0
->
trackId
(),
f4
);
track_matrix
.
add
(
f2
->
trackId
(),
f5
);
/* KC0 C1 C2
*
* f0---f1---f4 trk 0
* | |
* f2---f5 trk 1
* |
* f3 trk 2
*/
ASSERT_EQ
(
track_matrix
.
trackIds
().
size
(),
3
);
ASSERT_EQ
(
track_matrix
.
trackIds
(
C0
).
size
(),
1
);
ASSERT_EQ
(
track_matrix
.
trackIds
(
C1
).
size
(),
3
);
ASSERT_EQ
(
track_matrix
.
trackIds
(
C2
).
size
(),
2
);
}
int
main
(
int
argc
,
char
**
argv
)
{
...
...
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