MCPcopy Index your code
hub / github.com/FoundationVision/ByteTrack / plot_one_box

Function plot_one_box

tutorials/motr/eval.py:73–94  ·  view source on GitHub ↗
(x, img, color=None, label=None, score=None, line_thickness=None)

Source from the content-addressed store, hash-verified

71
72
73def plot_one_box(x, img, color=None, label=None, score=None, line_thickness=None):
74 # Plots one bounding box on image img
75
76 tl = line_thickness or round(
77 0.002 * max(img.shape[0:2])) + 1 # line thickness
78 color = color or [random.randint(0, 255) for _ in range(3)]
79 c1, c2 = (int(x[0]), int(x[1])), (int(x[2]), int(x[3]))
80 cv2.rectangle(img, c1, c2, color, thickness=tl)
81 # if label:
82 # tf = max(tl - 1, 1) # font thickness
83 # t_size = cv2.getTextSize(label, 0, fontScale=tl / 3, thickness=tf)[0]
84 # c2 = c1[0] + t_size[0], c1[1] - t_size[1] - 3
85 # cv2.rectangle(img, c1, c2, color, -1) # filled
86 # cv2.putText(img,
87 # label, (c1[0], c1[1] - 2),
88 # 0,
89 # tl / 3, [225, 255, 255],
90 # thickness=tf,
91 # lineType=cv2.LINE_AA)
92 # if score is not None:
93 # cv2.putText(img, score, (c1[0], c1[1] + 30), 0, tl / 3, [225, 255, 255], thickness=tf, lineType=cv2.LINE_AA)
94 return img
95
96
97def draw_bboxes(ori_img, bbox, identities=None, offset=(0, 0), cvt_color=False):

Callers 1

draw_bboxesFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected