Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
J
jfx_kalman_filter_src
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
oscar
jfx_kalman_filter_src
Commits
15c26ddb
Commit
15c26ddb
authored
Jun 21, 2022
by
oscar
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
提交更新
parent
a35433a0
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
80 additions
and
0 deletions
+80
-0
BaseTracker.h
BaseTracker/BaseTracker.h
+80
-0
TrackingRos2.cpp
ros2/TrackingRos2.cpp
+0
-0
No files found.
BaseTracker/BaseTracker.h
View file @
15c26ddb
...
...
@@ -34,6 +34,7 @@ public:
void
SetValues
(
std
::
vector
<
float
>&
values
)
{
m_values
=
values
;
}
int
Run
(
const
std
::
vector
<
std
::
vector
<
float
>
>&
detections
,
int
_no
/*观测数量*/
,
int
_ns
/*状态数量*/
,
std
::
vector
<
uint64_t
>&
detectionsId
,
std
::
map
<
uint64_t
,
int
>&
updateId
,
std
::
vector
<
uint64_t
>&
lostId
);
int
Run
(
const
std
::
vector
<
std
::
vector
<
float
>
>&
detections
,
int
_no
/*观测数量*/
,
int
_ns
/*状态数量*/
,
std
::
vector
<
uint64_t
>&
detectionsId
,
std
::
map
<
uint64_t
,
int
>&
updateId
,
std
::
map
<
uint64_t
,
int
>&
addId
,
std
::
vector
<
uint64_t
>&
lostId
);
int
Run
(
const
std
::
vector
<
std
::
vector
<
float
>
>&
dets_high
,
const
std
::
vector
<
std
::
vector
<
float
>
>&
dets_low
,
int
_no
/*观测数量*/
,
int
_ns
/*状态数量*/
,
std
::
map
<
uint64_t
,
int
>&
update_high_ids
,
std
::
map
<
uint64_t
,
int
>&
update_low_ids
,
std
::
vector
<
uint64_t
>&
lostId
);
...
...
@@ -601,6 +602,85 @@ void BaseTracker<T>::AssociateDetectionsToTrackersEx(const std::vector<std::vect
}
}
}
}
template
<
class
T
>
int
BaseTracker
<
T
>::
Run
(
const
std
::
vector
<
std
::
vector
<
float
>
>&
detections
,
int
_no
/*观测数量*/
,
int
_ns
/*状态数量*/
,
std
::
vector
<
uint64_t
>&
detectionsId
,
std
::
map
<
uint64_t
,
int
>&
updateId
,
std
::
map
<
uint64_t
,
int
>&
addId
,
std
::
vector
<
uint64_t
>&
lostId
)
{
/*** Predict internal tracks from previous frame ***/
for
(
auto
&
track
:
m_tracker
)
{
track
.
second
->
Predict
();
}
if
(
detections
.
empty
())
{
/*** Delete lose tracked tracks ***/
for
(
auto
it
=
m_tracker
.
begin
();
it
!=
m_tracker
.
end
();)
{
if
(
it
->
second
->
IsLost
())
{
lostId
.
push_back
(
it
->
first
);
it
=
m_tracker
.
erase
(
it
);
}
else
{
it
++
;
}
}
return
0
;
}
detectionsId
.
resize
(
detections
.
size
());
// Hash-map between track ID and associated detection bounding box
std
::
map
<
uint64_t
,
int
>
matched
;
// vector of unassociated detections
std
::
vector
<
int
>
unmatched_det
;
// return values - matched, unmatched_det
AssociateDetectionsToTrackers
(
detections
,
_no
,
_ns
,
m_tracker
,
matched
,
unmatched_det
);
/*** Update tracks with associated bbox ***/
if
(
m_isGPU
==
0
)
{
for
(
const
auto
&
match
:
matched
)
{
const
auto
&
id
=
match
.
first
;
m_tracker
[
id
]
->
Update
(
detections
[
match
.
second
]);
detectionsId
[
match
.
second
]
=
id
;
updateId
[
id
]
=
match
.
second
;
}
}
else
{
}
/*** Create new tracks for unmatched detections ***/
for
(
const
auto
&
det
:
unmatched_det
)
{
std
::
shared_ptr
<
T
>
trackPtr
=
std
::
make_shared
<
T
>
();
trackPtr
->
Init
(
detections
[
det
]);
trackPtr
->
SetIouThreshold
(
m_iou_threshold
);
trackPtr
->
SetMaxCoastCycles
(
m_kMaxCoastCycles
);
trackPtr
->
SetValidUpdateCount
(
m_updateValidCount
);
trackPtr
->
SetValues
(
m_values
);
// Create new track and generate new ID
uint64_t
newId
=
++
m_countId
;
m_tracker
[
newId
]
=
trackPtr
;
detectionsId
[
det
]
=
newId
;
updateId
[
newId
]
=
det
;
addId
[
newId
]
=
det
;
}
/*** Delete lose tracked tracks ***/
for
(
auto
it
=
m_tracker
.
begin
();
it
!=
m_tracker
.
end
();)
{
if
(
it
->
second
->
IsLost
())
{
lostId
.
push_back
(
it
->
first
);
it
=
m_tracker
.
erase
(
it
);
}
else
{
it
++
;
}
}
return
0
;
}
ros2/TrackingRos2.cpp
View file @
15c26ddb
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment