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
7660e684
Commit
7660e684
authored
May 31, 2023
by
oscar
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
提交检测5个点是运动点的方法。
parent
20d252b8
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
3 deletions
+25
-3
Track3D.cpp
BaseTracker/Track3D.cpp
+25
-3
No files found.
BaseTracker/Track3D.cpp
View file @
7660e684
...
...
@@ -7,7 +7,7 @@
#include <opencv2/opencv.hpp>
#include <algorithm>
#define DIST_THRED
0.5
#define DIST_THRED
1
double
calc_tangent_direction
(
const
std
::
vector
<
point2d
>&
points
)
{
if
(
points
.
size
()
<
5
)
{
...
...
@@ -75,6 +75,28 @@ double correct_angle(std::vector<point2d>& points)
return
center_rot_y
;
}
int
IsClosePoint
(
std
::
vector
<
point2d
>&
points
)
{
if
(
points
.
size
()
!=
5
)
return
1
;
float
lenAllX
=
fabs
(
points
[
0
].
x
-
points
[
1
].
x
)
+
fabs
(
points
[
0
].
x
-
points
[
2
].
x
)
+
fabs
(
points
[
0
].
x
-
points
[
3
].
x
)
+
fabs
(
points
[
0
].
x
-
points
[
4
].
x
);
float
lenX
=
fabs
(
points
[
0
].
x
-
points
[
4
].
x
);
float
lenAllY
=
fabs
(
points
[
0
].
y
-
points
[
1
].
y
)
+
fabs
(
points
[
0
].
y
-
points
[
2
].
y
)
+
fabs
(
points
[
0
].
y
-
points
[
3
].
y
)
+
fabs
(
points
[
0
].
y
-
points
[
4
].
y
);
float
lenY
=
fabs
(
points
[
0
].
y
-
points
[
4
].
y
);
if
(
lenX
>
DIST_THRED
)
{
float
rateX
=
lenAllX
/
lenX
;
if
(
rateX
>
1.75
&&
rateX
<
2.25
)
return
0
;
}
if
(
lenY
>
DIST_THRED
)
{
float
rateY
=
lenAllY
/
lenY
;
if
(
rateY
>
1.75
&&
rateY
<
2.25
)
return
0
;
}
return
1
;
}
Track3D
::
Track3D
()
:
BaseTrack
(
10
,
7
)
{
...
...
@@ -380,7 +402,7 @@ 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
&&
(
abs
(
m_points
[
4
].
x
-
m_points
[
0
].
x
)
>
DIST_THRED
||
abs
(
m_points
[
4
].
y
-
m_points
[
0
].
y
)
>
DIST_THRED
)
)
if
(
dataSource
==
1
&&
m_points
.
size
()
>=
5
&&
IsClosePoint
(
m_points
)
==
0
)
{
double
center_rot_y
=
calc_tangent_direction
(
m_points
);
m_center_rot_y
=
center_rot_y
;
...
...
@@ -397,7 +419,7 @@ void Track3D::UpdateDataCheck(const std::vector<float>& data, std::vector<float>
}
else
if
(
dataSource
>
1
&&
m_points
.
size
()
>=
5
)
{
if
(
(
abs
(
m_points
[
4
].
x
-
m_points
[
0
].
x
)
>
DIST_THRED
||
abs
(
m_points
[
4
].
y
-
m_points
[
0
].
y
)
>
DIST_THRED
)
)
//5个点首尾有距离差才计算方向
if
(
IsClosePoint
(
m_points
)
==
0
)
//5个点首尾有距离差才计算方向
{
double
center_rot_y
=
calc_tangent_direction
(
m_points
);
m_center_rot_y
=
center_rot_y
;
...
...
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