python:
font = cv2.FONT_HERSHEY_SIMPLEX # 使用默认字体
cv2.rectangle(im, (10, 10), (110, 110), (0, 0, 255), thickness=2)
# cv2.floodFill()
cv2.rectangle(im, (113), int(110)), (int(300), int(135),
(255, 0, 0), thickness=-1)
cv2.putText(im, class_name + ' ' + str(score), (int(113, int(126)), font, 0.6,
(255, 255, 255), 1)
c++:
//显示通用通用模板
int fontface = cv::FONT_HERSHEY_SIMPLEX;
double scale = 0.5;
int thickness = 1.5;
int baseline = 0;
char buff[50]="hello";
cv::Size text = cv::getTextSize(buff, fontface, scale, thickness,
&baseline);
Mat dd=Mat(pair_p, false);
cv::rectangle(dd, cv::Point(0, 0),
cv::Point(text.width, (text.height + baseline)*3),
CV_RGB(255, 255, 255), CV_FILLED);
cv::putText(dd, buff, cv::Point(0, text.height + baseline / 2.),
fontface, scale, CV_RGB(0, 0, 0), thickness, 8);
cv::imshow("detections", dd);