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
59fd78c7
Commit
59fd78c7
authored
Jan 14, 2022
by
oscar
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
提交相机消息iou过滤
parent
8e65a616
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
62 additions
and
21 deletions
+62
-21
Track3D.cpp
BaseTracker/Track3D.cpp
+18
-18
TrackingRosEx.cpp
TrackingRosEx.cpp
+11
-1
TrackingRosEx.h
TrackingRosEx.h
+1
-0
Component.cpp
common/Component.cpp
+27
-2
Component.h
common/Component.h
+5
-0
No files found.
BaseTracker/Track3D.cpp
View file @
59fd78c7
...
...
@@ -161,23 +161,23 @@ float calcIOU(cv::RotatedRect rect1, cv::RotatedRect rect2) {
}
double
calcIntersectionArea
(
cv
::
RotatedRect
rect1
,
cv
::
RotatedRect
rect2
)
{
std
::
vector
<
cv
::
Point2f
>
vertices
;
int
intersectionType
=
cv
::
rotatedRectangleIntersection
(
rect1
,
rect2
,
vertices
);
if
(
vertices
.
size
()
==
0
)
return
0.0
;
else
{
std
::
vector
<
cv
::
Point2f
>
order_pts
;
// 找到交集(交集的区域),对轮廓的各个点进行排序
cv
::
convexHull
(
cv
::
Mat
(
vertices
),
order_pts
,
true
);
double
area
=
cv
::
contourArea
(
order_pts
);
//float inner = (float)(area / (areaRect1 + areaRect2 - area + 0.0001));
return
area
;
}
}
//
double calcIntersectionArea(cv::RotatedRect rect1, cv::RotatedRect rect2)
//
{
//
std::vector<cv::Point2f> vertices;
//
int intersectionType = cv::rotatedRectangleIntersection(rect1, rect2, vertices);
//
if (vertices.size() == 0)
//
return 0.0;
//
else
//
{
//
std::vector<cv::Point2f> order_pts;
//
// 找到交集(交集的区域),对轮廓的各个点进行排序
//
//
cv::convexHull(cv::Mat(vertices), order_pts, true);
//
double area = cv::contourArea(order_pts);
//
//float inner = (float)(area / (areaRect1 + areaRect2 - area + 0.0001));
//
return area;
//
}
//
}
double
Track3D
::
CalculateIou
(
const
std
::
vector
<
float
>&
data
)
{
...
...
@@ -238,7 +238,7 @@ double Track3D::CalculateIou(const std::vector<float>& data)
else
if
(
tru_maxz
<
land_maxz
&&
tru_maxz
>
land_minz
)
{
interHeight
=
tru_maxz
-
land_minz
;
}
if
(
interHeight
>
0
)
if
(
1
)
//
interHeight > 0)
{
//double inter3D = area * interHeight;
//iou_3d = inter3D / (states[4] * states[5] * states[6] + data[5] * data[6] * data[7] - inter3D);
...
...
TrackingRosEx.cpp
View file @
59fd78c7
...
...
@@ -281,6 +281,8 @@ void TrackingRos::Init(ros::NodeHandle& nh)
SDK_LOG
(
SDK_INFO
,
"detect_recv_msg_only = %d"
,
m_recvMsgBit
);
nh
.
param
<
int32_t
>
(
"detct_camera_car_size"
,
m_detectCameraCarSize
,
150
);
SDK_LOG
(
SDK_INFO
,
"detct_camera_car_size = %d"
,
m_detectCameraCarSize
);
nh
.
param
<
float
>
(
"lidar_camera_msg_iou"
,
m_lidar_camera_msg_iou
,
0.4
);
SDK_LOG
(
SDK_INFO
,
"matrix_angle_r_value = %f"
,
m_lidar_camera_msg_iou
);
YAML
::
Node
config
=
YAML
::
LoadFile
(
file
.
c_str
());
...
...
@@ -552,7 +554,15 @@ void TrackingRos::TrackingCameraCallBackFunc(const jfx_common_msgs::InferResesCo
{
for
(
auto
&
obj
:
cloudPtr
->
array
)
{
if
(
abs
(
obj
.
x
-
objMsg
.
x
)
<
std
::
max
(
objMsg
.
l
*
2
,
(
double
)
3.0
)
&&
abs
(
obj
.
y
-
objMsg
.
y
)
<
std
::
max
(
objMsg
.
w
*
2.0
,
(
double
)
3.0
))
//if (abs(obj.x - objMsg.x) < std::max(objMsg.l * 2.0, (double)3.0) && abs(obj.y - objMsg.y) < std::max(objMsg.w * 2.0, (double)3.0))
//{
// duplicate = 1;
// break;
//}
cv
::
RotatedRect
rect1
=
cv
::
RotatedRect
(
cv
::
Point2f
(
objMsg
.
x
,
objMsg
.
y
),
cv
::
Size2f
(
objMsg
.
l
,
objMsg
.
w
),
objMsg
.
rot_y
);
cv
::
RotatedRect
rect2
=
cv
::
RotatedRect
(
cv
::
Point2f
(
obj
.
x
,
obj
.
y
),
cv
::
Size2f
(
obj
.
l
,
obj
.
w
),
obj
.
rot_y
*
180
/
3.1415926
);
float
rate
=
calcIntersectionRate
(
rect1
,
rect2
);
if
(
rate
>
m_lidar_camera_msg_iou
)
{
duplicate
=
1
;
break
;
...
...
TrackingRosEx.h
View file @
59fd78c7
...
...
@@ -61,4 +61,5 @@ public:
int
m_recvMsgBit
=
0
b1111
;
//处理消息的类型
int
m_detectCameraCarSize
=
150
;
//处理相机汽车边长的最小限制
float
m_lidar_camera_msg_iou
;
//相机和雷达消息过滤用iou值
};
common/Component.cpp
View file @
59fd78c7
...
...
@@ -86,4 +86,30 @@ std::string GetTimeStr(uint64_t timestamp)
sprintf
(
tStr
,
".%d"
,
misc
);
std
::
string
timeStr
=
std
::
string
(
str
)
+
std
::
string
(
tStr
);
return
timeStr
;
}
\ No newline at end of file
}
double
calcIntersectionArea
(
cv
::
RotatedRect
rect1
,
cv
::
RotatedRect
rect2
)
{
std
::
vector
<
cv
::
Point2f
>
vertices
;
int
intersectionType
=
cv
::
rotatedRectangleIntersection
(
rect1
,
rect2
,
vertices
);
if
(
vertices
.
size
()
==
0
)
return
0.0
;
else
{
std
::
vector
<
cv
::
Point2f
>
order_pts
;
// 找到交集(交集的区域),对轮廓的各个点进行排序
cv
::
convexHull
(
cv
::
Mat
(
vertices
),
order_pts
,
true
);
double
area
=
cv
::
contourArea
(
order_pts
);
//float inner = (float)(area / (areaRect1 + areaRect2 - area + 0.0001));
return
area
;
}
}
float
calcIntersectionRate
(
cv
::
RotatedRect
rect1
,
cv
::
RotatedRect
rect2
)
{
double
area
=
calcIntersectionArea
(
rect1
,
rect2
);
float
iou_2d
=
area
/
(
rect1
.
size
.
width
*
rect1
.
size
.
height
+
rect2
.
size
.
width
*
rect2
.
size
.
height
);
return
iou_2d
;
}
common/Component.h
View file @
59fd78c7
...
...
@@ -2,6 +2,7 @@
#include <string>
#include <vector>
#include <opencv2/opencv.hpp>
uint64_t
GetCurTime
();
...
...
@@ -12,3 +13,7 @@ std::string GetMatrixStr(const float* data_ptr, int col, int row);
std
::
string
GetMatrixStr
(
const
std
::
vector
<
std
::
vector
<
float
>>&
data_ptr
,
int
col
,
int
row
);
std
::
string
GetMatrixStr
(
const
std
::
vector
<
std
::
vector
<
double
>>&
data_ptr
,
int
col
,
int
row
);
std
::
string
GetMatrixStr
(
float
**
data_ptr
,
int
col
,
int
row
);
double
calcIntersectionArea
(
cv
::
RotatedRect
rect1
,
cv
::
RotatedRect
rect2
);
float
calcIntersectionRate
(
cv
::
RotatedRect
rect1
,
cv
::
RotatedRect
rect2
);
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