merge with master
This commit is contained in:
+16
-9
@@ -23,6 +23,7 @@
|
||||
#define MAX_DETECT_SIZE 100
|
||||
|
||||
bool gRun;
|
||||
std::string obj_class[10]{"person", "car", "truck", "bus", "motor", "bike", "rider", "traffic light", "traffic sign", "train"};
|
||||
|
||||
cv::Mat frame_v;
|
||||
cv::Mat frame_top_v;
|
||||
@@ -205,24 +206,30 @@ int main(int argc, char *argv[])
|
||||
int x1 = b.x + b.w;
|
||||
int y0 = b.y;
|
||||
int y1 = b.y + b.h;
|
||||
int obj_class = b.cl;
|
||||
int objClass = b.cl;
|
||||
std::string det_class = obj_class[b.cl];
|
||||
float prob = b.prob;
|
||||
|
||||
cv::Scalar intensity = mask.at<uchar>(cv::Point(int(x0 + b.w / 2), y1));
|
||||
|
||||
if (intensity[0])
|
||||
{
|
||||
|
||||
if (obj_class == 0 /*person*/ || obj_class == 1 /*bicycle*/ || obj_class == 2 /*car*/
|
||||
|| obj_class == 3 /*motorbike*/ || obj_class == 5 /*bus*/)
|
||||
if (objClass < 6)
|
||||
{
|
||||
convert_coords(coords, coord_i, x0 + b.w / 2, y1, obj_class, H, adfGeoTransform, frame_nbr);
|
||||
convert_coords(coords, coord_i, x0 + b.w / 2, y1, objClass, H, adfGeoTransform, frame_nbr);
|
||||
coord_i++;
|
||||
|
||||
//std::cout<<objClass<<" ("<<prob<<"): "<<x0<<" "<<y0<<" "<<x1<<" "<<y1<<"\n";
|
||||
cv::rectangle(frame, cv::Point(x0, y0), cv::Point(x1, y1), yolo.colors[objClass], 2);
|
||||
// draw label
|
||||
int baseline = 0;
|
||||
float fontScale = 0.5;
|
||||
int thickness = 2;
|
||||
cv::Size textSize = getTextSize(det_class, cv::FONT_HERSHEY_SIMPLEX, fontScale, thickness, &baseline);
|
||||
cv::rectangle(frame, cv::Point(x0, y0), cv::Point((x0 + textSize.width - 2), (y0 - textSize.height - 2)), yolo.colors[b.cl], -1);
|
||||
cv::putText(frame, det_class, cv::Point(x0, (y0 - (baseline / 2))), cv::FONT_HERSHEY_SIMPLEX, fontScale, cv::Scalar(255, 255, 255), thickness);
|
||||
}
|
||||
|
||||
float prob = b.prob;
|
||||
|
||||
//std::cout<<obj_class<<" ("<<prob<<"): "<<x0<<" "<<y0<<" "<<x1<<" "<<y1<<"\n";
|
||||
cv::rectangle(frame, cv::Point(x0, y0), cv::Point(x1, y1), yolo.colors[obj_class], 2);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user