|
@@ -277,20 +277,27 @@ namespace gsd
|
|
|
|
|
|
if(config::getPtr()->Hepu)
|
|
if(config::getPtr()->Hepu)
|
|
{
|
|
{
|
|
- //find the biggest target
|
|
|
|
- double tar_max = 0;
|
|
|
|
|
|
+ int x_center,y_center,w_center,h_center;
|
|
|
|
+ int dist2mid = 167936;//320*320 + 256*256;
|
|
for(auto &obj : cnstreamInferData->Objects)
|
|
for(auto &obj : cnstreamInferData->Objects)
|
|
{
|
|
{
|
|
- double size_temp = obj.BBox.w*obj.BBox.w + obj.BBox.h*obj.BBox.h;
|
|
|
|
- if( size_temp >= tar_max)
|
|
|
|
|
|
+ int x_temp,y_temp;
|
|
|
|
+ x_temp = obj.BBox.x * 640;
|
|
|
|
+ y_temp = obj.BBox.y * 512;
|
|
|
|
+ int dist2mid_temp = pow(x_temp-320,2) + pow(y_temp-256,2);
|
|
|
|
+ if(dist2mid_temp <= dist2mid)
|
|
{
|
|
{
|
|
- tar_max = size_temp;
|
|
|
|
- target->trackingRect.x = obj.BBox.x * 1920;
|
|
|
|
- target->trackingRect.y = obj.BBox.y * 1080;
|
|
|
|
- target->trackingRect.w = obj.BBox.w * 1920;
|
|
|
|
- target->trackingRect.h = obj.BBox.h * 1080;
|
|
|
|
|
|
+ x_center = x_temp;
|
|
|
|
+ y_center = y_temp;
|
|
|
|
+ w_center = obj.BBox.w * 640;
|
|
|
|
+ h_center = obj.BBox.h * 512;
|
|
|
|
+ dist2mid = dist2mid_temp;
|
|
}
|
|
}
|
|
- }
|
|
|
|
|
|
+ }
|
|
|
|
+ target->trackingRect.x = x_center;
|
|
|
|
+ target->trackingRect.y = y_center;
|
|
|
|
+ target->trackingRect.w = w_center;
|
|
|
|
+ target->trackingRect.h = h_center;
|
|
}
|
|
}
|
|
|
|
|
|
// 获取时间
|
|
// 获取时间
|
|
@@ -345,29 +352,22 @@ namespace gsd
|
|
|
|
|
|
if(config::getPtr()->Hepu)
|
|
if(config::getPtr()->Hepu)
|
|
{
|
|
{
|
|
- int x_center,y_center,w_center,h_center;
|
|
|
|
- int dist2mid = 167936;//320*320 + 256*256;
|
|
|
|
|
|
+ //find the biggest target
|
|
|
|
+ double tar_max = 0;
|
|
for(auto &obj : cnstreamInferData->Objects)
|
|
for(auto &obj : cnstreamInferData->Objects)
|
|
{
|
|
{
|
|
- int x_temp,y_temp;
|
|
|
|
- x_temp = obj.BBox.x * 640;
|
|
|
|
- y_temp = obj.BBox.y * 512;
|
|
|
|
- int dist2mid_temp = pow(x_temp-320,2) + pow(y_temp-256,2);
|
|
|
|
- if(dist2mid_temp <= dist2mid)
|
|
|
|
|
|
+ double size_temp = obj.BBox.w*obj.BBox.w + obj.BBox.h*obj.BBox.h;
|
|
|
|
+ if( size_temp >= tar_max)
|
|
{
|
|
{
|
|
- x_center = x_temp;
|
|
|
|
- y_center = y_temp;
|
|
|
|
- w_center = obj.BBox.w * 640;
|
|
|
|
- h_center = obj.BBox.h * 512;
|
|
|
|
- dist2mid = dist2mid_temp;
|
|
|
|
|
|
+ tar_max = size_temp;
|
|
|
|
+ target->rect.x = obj.BBox.x * 1920;
|
|
|
|
+ target->rect.y = obj.BBox.y * 1080;
|
|
|
|
+ target->rect.width = obj.BBox.w * 1920;
|
|
|
|
+ target->rect.height = obj.BBox.h * 1080;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
target->size.width = 1920;
|
|
target->size.width = 1920;
|
|
- target->size.height = 1080;
|
|
|
|
- target->rect.x = x_center;
|
|
|
|
- target->rect.y = y_center;
|
|
|
|
- target->rect.width = w_center;
|
|
|
|
- target->rect.height = h_center;
|
|
|
|
|
|
+ target->size.height = 1080;
|
|
}
|
|
}
|
|
|
|
|
|
// 获取时间
|
|
// 获取时间
|