You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
37 lines
1.1 KiB
Python
37 lines
1.1 KiB
Python
import cv2
|
|
|
|
|
|
def drawing_frame(images_frame,
|
|
result_list,
|
|
line_1=3,
|
|
line_2=1,
|
|
color_1=(0, 0, 255),
|
|
color_2=(0, 255, 255),
|
|
txt_num=0.75,
|
|
scores_list_id=False):
|
|
'''
|
|
result_dicts_list: 格式为[{labels1:result1},{labels2:result2},{labels2:result2}...]
|
|
'''
|
|
|
|
# img = images_frame.copy()
|
|
|
|
for result_list in result_list:
|
|
|
|
label_name = list(result_list.keys())[0]
|
|
bbox_list = list(result_list.values())[0]
|
|
|
|
print(bbox_list)
|
|
|
|
if scores_list_id:
|
|
scores_list = result_list['scores_list']
|
|
lables = str(label_name) + "__" + str(scores_list)
|
|
else:
|
|
lables = str(label_name)
|
|
|
|
cv2.rectangle(images_frame, (int(bbox_list[0]), int(bbox_list[1])), (int(
|
|
bbox_list[2]), int(bbox_list[3])), color_1, line_1)
|
|
cv2.putText(images_frame, lables, (int(bbox_list[0]) - 10, int(
|
|
bbox_list[1]) - 10), cv2.FONT_HERSHEY_SIMPLEX, txt_num, color_2, line_2)
|
|
|
|
return images_frame
|