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
8ace3706
Commit
8ace3706
authored
3 months ago
by
Joan Vallvé Navarro
Browse files
Options
Downloads
Patches
Plain Diff
new TrackMatrix method cleanSnapshots
parent
5eeb3ce1
No related branches found
Branches containing commit
No related tags found
1 merge request
!448
Draft: Resolve "Implementation of new nodes creation"
Pipeline
#20876
failed
3 months ago
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
include/core/processor/track_matrix.h
+5
-0
5 additions, 0 deletions
include/core/processor/track_matrix.h
src/processor/track_matrix.cpp
+21
-0
21 additions, 0 deletions
src/processor/track_matrix.cpp
test/gtest_track_matrix.cpp
+45
-0
45 additions, 0 deletions
test/gtest_track_matrix.cpp
with
71 additions
and
0 deletions
include/core/processor/track_matrix.h
+
5
−
0
View file @
8ace3706
...
...
@@ -121,6 +121,8 @@ class TrackMatrix
FeatureBasePtr
feature
(
const
SizeStd
&
_track_id
,
CaptureBasePtr
_cap
);
CaptureBaseConstPtr
firstCapture
(
const
SizeStd
&
_track_id
)
const
;
CaptureBasePtr
firstCapture
(
const
SizeStd
&
_track_id
);
CaptureBaseConstPtr
lastCapture
(
const
SizeStd
&
_track_id
)
const
;
CaptureBasePtr
lastCapture
(
const
SizeStd
&
_track_id
);
list
<
SizeStd
>
trackIds
(
CaptureBaseConstPtr
_capture
=
nullptr
)
const
;
...
...
@@ -128,6 +130,9 @@ class TrackMatrix
TrackConst
trackAtKeyframes
(
const
SizeStd
&
_track_id
)
const
;
Track
trackAtKeyframes
(
const
SizeStd
&
_track_id
);
// Remove snapshots of captures that are being removed from the problem (e.g. when a keyframe is removed)
void
cleanSnapshots
();
private:
static
SizeStd
track_id_count_
;
...
...
This diff is collapsed.
Click to expand it.
src/processor/track_matrix.cpp
+
21
−
0
View file @
8ace3706
...
...
@@ -150,6 +150,17 @@ void TrackMatrix::remove(FeatureBasePtr _ftr)
}
}
void
TrackMatrix
::
cleanSnapshots
()
{
// In two steps to avoid erasing while iterating
CaptureBasePtrList
removing_captures
;
for
(
auto
snapshot_pair
:
snapshots_
)
if
(
snapshot_pair
.
first
->
isRemoving
())
removing_captures
.
push_back
(
snapshot_pair
.
first
);
for
(
auto
cap
:
removing_captures
)
remove
(
cap
);
}
SizeStd
TrackMatrix
::
numTracks
()
const
{
return
tracks_
.
size
();
...
...
@@ -306,6 +317,16 @@ CaptureBasePtr TrackMatrix::firstCapture(const SizeStd& _track_id)
return
firstFeature
(
_track_id
)
->
getCapture
();
}
CaptureBaseConstPtr
TrackMatrix
::
lastCapture
(
const
SizeStd
&
_track_id
)
const
{
return
lastFeature
(
_track_id
)
->
getCapture
();
}
CaptureBasePtr
TrackMatrix
::
lastCapture
(
const
SizeStd
&
_track_id
)
{
return
lastFeature
(
_track_id
)
->
getCapture
();
}
TrackConst
TrackMatrix
::
trackAtKeyframes
(
const
SizeStd
&
_track_id
)
const
{
// We assemble a track_kf on the fly by checking each capture's frame.
...
...
This diff is collapsed.
Click to expand it.
test/gtest_track_matrix.cpp
+
45
−
0
View file @
8ace3706
...
...
@@ -334,6 +334,51 @@ TEST_F(TrackMatrixTest, remove_snapshot)
ASSERT_EQ
(
track_matrix
.
numTracks
(),
(
unsigned
int
)
0
);
}
TEST_F
(
TrackMatrixTest
,
clean_snapshots
)
{
f0
->
link
(
C0
);
f1
->
link
(
C1
);
f2
->
link
(
C2
);
f3
->
link
(
C1
);
f4
->
link
(
C3
);
f5
->
link
(
C4
);
track_matrix
.
newTrack
(
f0
);
track_matrix
.
add
(
f0
->
trackId
(),
f1
);
track_matrix
.
add
(
f0
->
trackId
(),
f2
);
track_matrix
.
add
(
f0
->
trackId
(),
f4
);
track_matrix
.
add
(
f0
->
trackId
(),
f5
);
track_matrix
.
newTrack
(
f3
);
/* KC0 C1 C2 C3 KC4 snapshots
*
* f0---f1---f2---f4---f5 trk 0
* |
* f3 trk 1
*/
// remove F1 --> remove C1
F1
->
remove
();
track_matrix
.
cleanSnapshots
();
// Resulting track matrix should be:
/* KC0 C2 C3 KC4 snapshots
*
* f0---f2---f4---f5 trk 0
*
*/
ASSERT_EQ
(
track_matrix
.
numTracks
(),
1
);
ASSERT_EQ
(
track_matrix
.
trackSize
(
f0
->
trackId
()),
4
);
ASSERT_EQ
(
track_matrix
.
firstFeature
(
f0
->
trackId
()),
f0
);
ASSERT_EQ
(
track_matrix
.
lastFeature
(
f0
->
trackId
()),
f5
);
ASSERT_EQ
(
track_matrix
.
firstCapture
(
f0
->
trackId
()),
C0
);
ASSERT_EQ
(
track_matrix
.
lastCapture
(
f0
->
trackId
()),
C4
);
ASSERT_EQ
(
track_matrix
.
feature
(
f0
->
trackId
(),
C0
),
f0
);
ASSERT_EQ
(
track_matrix
.
feature
(
f0
->
trackId
(),
C2
),
f2
);
ASSERT_EQ
(
track_matrix
.
feature
(
f0
->
trackId
(),
C3
),
f4
);
ASSERT_EQ
(
track_matrix
.
feature
(
f0
->
trackId
(),
C4
),
f5
);
}
TEST_F
(
TrackMatrixTest
,
track
)
{
f0
->
link
(
C0
);
...
...
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