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
8374ccf2
Commit
8374ccf2
authored
Jun 01, 2023
by
oscar
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
加入速度小的时候轨迹计算距离加大
parent
d126a7ca
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
69 additions
and
16 deletions
+69
-16
Track3D.cpp
BaseTracker/Track3D.cpp
+65
-16
Track3D.h
BaseTracker/Track3D.h
+4
-0
No files found.
BaseTracker/Track3D.cpp
View file @
8374ccf2
...
...
@@ -75,27 +75,43 @@ double correct_angle(std::vector<point2d>& points)
return
center_rot_y
;
}
int
IsClosePoint
(
std
::
vector
<
point2d
>&
points
)
int
IsClosePoint
(
std
::
vector
<
point2d
>&
points
,
float
dist_thred
)
{
if
(
points
.
size
()
!=
5
)
return
1
;
float
len01
=
sqrt
(
pow
(
points
[
0
].
x
-
points
[
1
].
x
,
2
)
+
pow
(
points
[
0
].
y
-
points
[
1
].
y
,
2
));
float
len02
=
sqrt
(
pow
(
points
[
0
].
x
-
points
[
2
].
x
,
2
)
+
pow
(
points
[
0
].
y
-
points
[
2
].
y
,
2
));
float
len03
=
sqrt
(
pow
(
points
[
0
].
x
-
points
[
3
].
x
,
2
)
+
pow
(
points
[
0
].
y
-
points
[
3
].
y
,
2
));
float
len04
=
sqrt
(
pow
(
points
[
0
].
x
-
points
[
4
].
x
,
2
)
+
pow
(
points
[
0
].
y
-
points
[
4
].
y
,
2
));
float
lenAll
=
len01
+
len02
+
len03
+
len04
;
int
isFar
=
0
;
if
(
len04
>
DIST_THRED
)
{
float
rateX
=
lenAll
/
len04
;
if
(
rateX
>
1.5
&&
rateX
<
2.5
)
isFar
=
1
;
}
int
sortX
=
0
;
if
(
points
[
0
].
x
>
points
[
4
].
x
&&
points
[
0
].
x
>=
points
[
1
].
x
&&
points
[
1
].
x
>=
points
[
2
].
x
&&
points
[
3
].
x
>=
points
[
4
].
x
)
sortX
=
1
;
else
if
(
points
[
0
].
x
<
points
[
4
].
x
&&
points
[
0
].
x
<=
points
[
1
].
x
&&
points
[
1
].
x
<=
points
[
2
].
x
&&
points
[
3
].
x
<=
points
[
4
].
x
)
sortX
=
1
;
int
sortY
=
0
;
if
(
points
[
0
].
y
>
points
[
4
].
y
&&
points
[
0
].
y
>=
points
[
1
].
y
&&
points
[
1
].
y
>=
points
[
2
].
y
&&
points
[
3
].
y
>=
points
[
4
].
y
)
sortY
=
1
;
else
if
(
points
[
0
].
y
<
points
[
4
].
y
&&
points
[
0
].
y
<=
points
[
1
].
y
&&
points
[
1
].
y
<=
points
[
2
].
y
&&
points
[
3
].
y
<=
points
[
4
].
y
)
sortY
=
1
;
if
(
sortX
==
1
||
sortY
==
1
)
isFar
=
1
;
if
(
isFar
==
1
)
{
return
0
;
float
len01
=
sqrt
(
pow
(
points
[
0
].
x
-
points
[
1
].
x
,
2
)
+
pow
(
points
[
0
].
y
-
points
[
1
].
y
,
2
));
float
len02
=
sqrt
(
pow
(
points
[
0
].
x
-
points
[
2
].
x
,
2
)
+
pow
(
points
[
0
].
y
-
points
[
2
].
y
,
2
));
float
len03
=
sqrt
(
pow
(
points
[
0
].
x
-
points
[
3
].
x
,
2
)
+
pow
(
points
[
0
].
y
-
points
[
3
].
y
,
2
));
float
len04
=
sqrt
(
pow
(
points
[
0
].
x
-
points
[
4
].
x
,
2
)
+
pow
(
points
[
0
].
y
-
points
[
4
].
y
,
2
));
float
lenAll
=
len01
+
len02
+
len03
+
len04
;
if
(
len04
>
dist_thred
)
{
float
rateX
=
lenAll
/
len04
;
if
(
rateX
>
1.75
&&
rateX
<
3.25
)
return
0
;
else
return
4
;
}
else
return
3
;
}
return
1
;
else
return
2
;
}
Track3D
::
Track3D
()
:
BaseTrack
(
10
,
7
)
...
...
@@ -402,7 +418,40 @@ void Track3D::UpdateDataCheck(const std::vector<float>& data, std::vector<float>
double
rot_y
=
tmp
[
3
];
double
rot_y_detect
=
rot_y
;
//检测到的朝向
int
dataSource
=
data
[
8
];
if
(
dataSource
==
1
&&
m_points
.
size
()
>=
5
&&
IsClosePoint
(
m_points
)
==
0
)
if
(
m_obj
&&
m_points
.
size
()
>
1
)
{
float
speed
=
sqrt
(
pow
(
kf_
->
x_
[
7
],
2
)
+
pow
(
kf_
->
x_
[
8
],
2
));
const
int
speed_cout_max
=
5
;
if
(
speed
>
0.1
&&
m_last_speed
>
0.1
)
m_dist_thred
=
DIST_THRED
;
else
{
if
(
speed
>
m_last_speed
&&
fabs
(
speed
-
m_last_speed
)
>
0.01
)
{
m_speed_change
=
m_speed_change
<
speed_cout_max
?
m_speed_change
+
1
:
speed_cout_max
;
m_dist_thred
-=
0.1
*
m_speed_change
;
}
else
if
(
speed
<
m_last_speed
&&
fabs
(
speed
-
m_last_speed
)
>
0.01
)
{
m_speed_change
=
m_speed_change
>
-
speed_cout_max
?
m_speed_change
-
1
:
-
speed_cout_max
;
m_dist_thred
-=
0.1
*
m_speed_change
;
}
if
(
m_dist_thred
<
DIST_THRED
)
m_dist_thred
=
DIST_THRED
;
else
if
(
m_dist_thred
>
2.0
f
)
m_dist_thred
=
2.0
f
;
}
SDK_LOG
(
SDK_INFO
,
"IsClosePoint objId = %d, m_last_speed = %f, speed = %f,m_speed_change = %d, m_dist_thred = %f, IsClosePoint = %d,points = [%f,%f][%f,%f][%f.%f][%f,%f][%f,%f]"
,
m_obj
->
obj_id
,
m_last_speed
,
speed
,
m_speed_change
,
m_dist_thred
,
IsClosePoint
(
m_points
,
m_dist_thred
),
m_points
.
size
()
>
0
?
m_points
[
0
].
x
:
0
,
m_points
.
size
()
>
0
?
m_points
[
0
].
y
:
0
,
m_points
.
size
()
>
1
?
m_points
[
1
].
x
:
0
,
m_points
.
size
()
>
0
?
m_points
[
1
].
y
:
0
,
m_points
.
size
()
>
2
?
m_points
[
2
].
x
:
0
,
m_points
.
size
()
>
0
?
m_points
[
2
].
y
:
0
,
m_points
.
size
()
>
3
?
m_points
[
3
].
x
:
0
,
m_points
.
size
()
>
0
?
m_points
[
3
].
y
:
0
,
m_points
.
size
()
>
4
?
m_points
[
4
].
x
:
0
,
m_points
.
size
()
>
0
?
m_points
[
4
].
y
:
0
);
m_last_speed
=
speed
;
}
if
(
dataSource
==
1
&&
m_points
.
size
()
>=
5
&&
IsClosePoint
(
m_points
,
m_dist_thred
)
==
0
)
{
double
center_rot_y
=
calc_tangent_direction
(
m_points
);
m_center_rot_y
=
center_rot_y
;
...
...
@@ -419,7 +468,7 @@ void Track3D::UpdateDataCheck(const std::vector<float>& data, std::vector<float>
}
else
if
(
dataSource
>
1
&&
m_points
.
size
()
>=
5
)
{
if
(
IsClosePoint
(
m_points
)
==
0
)
//5个点首尾有距离差才计算方向
if
(
IsClosePoint
(
m_points
,
m_dist_thred
)
==
0
)
//5个点首尾有距离差才计算方向
{
double
center_rot_y
=
calc_tangent_direction
(
m_points
);
m_center_rot_y
=
center_rot_y
;
...
...
BaseTracker/Track3D.h
View file @
8374ccf2
...
...
@@ -83,6 +83,10 @@ public:
std
::
string
name
;
};
std
::
map
<
int
,
TypeNameInfo
>
m_typeNameList
;
float
m_dist_thred
=
2
.
0
f
;
float
m_last_speed
=
0
.
0
f
;
int
m_speed_change
=
0
;
};
double
correct_angle
(
std
::
vector
<
point2d
>&
points
);
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