tensorrt_inference
tensorrt_inference copied to clipboard
Question about calculating rect.x-rect.w/2 in yolov5.cpp
Hello,
Can you explain why you are doing this calculation?
cv::putText(org_img, name, cv::Point(rect.x - rect.w / 2, rect.y - rect.h / 2 - 5), cv::FONT_HERSHEY_COMPLEX, 0.7, class_colors[rect.classes], 2); cv::Rect rst(rect.x - rect.w / 2, rect.y - rect.h / 2, rect.w, rect.h); cv::rectangle(org_img, rst, class_colors[rect.classes], 2, cv::LINE_8, 0);
Thank you.
this code just for draw rectangles and labels, the rect.x, rect.y means the center x and y of the rect.
this code just for draw rectangles and labels, the rect.x, rect.y means the center x and y of the rect.
Why do I need the center of rect when drawing a rectangle?
only need left, top, width, height
only need left**,** top, width, height
left top, width, height ?
Thank you.