Commit cb1b7264 authored by oscar's avatar oscar

提交跟踪时加入颜色信息的记录。

parent 46cd2214
......@@ -479,4 +479,32 @@ double Track3D::get_acceleration_y(double time_interval){
double v_0 = (m_points[n-1].y - m_points[n-2].y) / time_interval;
double v_1 = (m_points[n-2].y - m_points[n-3].y) / time_interval;
return (v_0 - v_1) / time_interval;
}
int Track3D::UpdateColorInfo(std::string color)
{
if(color.empty() || color == "unknown" || color == "null" || color == "None")
return -1;
if(m_colorInfos.find(color) == m_colorInfos.end())
m_colorInfos[color] = 0;
m_colorInfos[color]++;
return 0;
}
int Track3D::GetColorInfo(std::string& color)
{
if(m_colorInfos.empty())
{
color = "unknown";
return -1;
}
int max = 0;
for(auto& iter : m_colorInfos)
{
if(iter.second > max)
{
max = iter.second;
color = iter.first;
}
}
return 0;
}
\ No newline at end of file
......@@ -66,6 +66,11 @@ public:
std::string m_number;//记录车牌号,出现一次就一直记录
std::map<std::string,int> m_captureInfos;//记录车辆类型检测类型的次数
std::map<std::string,int> m_colorInfos;///< 记录车辆的颜色信息
int UpdateColorInfo(std::string color);
int GetColorInfo(std::string& color);
};
double correct_angle(std::vector<point2d>& points);
......@@ -572,7 +572,8 @@ void TrackingRos::ThreadTrackingProcess()
obj.obj_id = iter.first;
obj.acc_x = iter.second->get_acceleration_x(0.1);
obj.acc_y = iter.second->get_acceleration_y(0.1);
iter.second->UpdateColorInfo(obj.color_name);
iter.second->GetColorInfo(obj.color_name);
#ifdef _ABUZHABI_
double lon = 0.0f;
double lat = 0.0f;
......@@ -654,6 +655,7 @@ void TrackingRos::ThreadTrackingProcess()
obj.obj_id = iter.first;
obj.acc_x = iter.second->get_acceleration_x(0.1);
obj.acc_y = iter.second->get_acceleration_y(0.1);
iter.second->GetColorInfo(obj.color_name);
#ifdef _ABUZHABI_
double lon = 0.0f;
double lat = 0.0f;
......@@ -808,9 +810,9 @@ void TrackingRos::ThreadTrackingProcess()
t_marker.pose.orientation.y = 0.0;
t_marker.pose.orientation.z = 0.0;
t_marker.pose.orientation.w = 1.0;
t_marker.scale.x = 1.5;
t_marker.scale.y = 1.5;
t_marker.scale.z = 1.5;
t_marker.scale.x = 4;
t_marker.scale.y = 4;
t_marker.scale.z = 4;
t_marker.color.a = 1.0;
t_marker.color.r = 0;
t_marker.color.g = 1.0;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment