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

Function plot_tracking

yolox/utils/visualize.py:52–80  ·  view source on GitHub ↗
(image, tlwhs, obj_ids, scores=None, frame_id=0, fps=0., ids2=None)

Source from the content-addressed store, hash-verified

50
51
52def plot_tracking(image, tlwhs, obj_ids, scores=None, frame_id=0, fps=0., ids2=None):
53 im = np.ascontiguousarray(np.copy(image))
54 im_h, im_w = im.shape[:2]
55
56 top_view = np.zeros([im_w, im_w, 3], dtype=np.uint8) + 255
57
58 #text_scale = max(1, image.shape[1] / 1600.)
59 #text_thickness = 2
60 #line_thickness = max(1, int(image.shape[1] / 500.))
61 text_scale = 2
62 text_thickness = 2
63 line_thickness = 3
64
65 radius = max(5, int(im_w/140.))
66 cv2.putText(im, 'frame: %d fps: %.2f num: %d' % (frame_id, fps, len(tlwhs)),
67 (0, int(15 * text_scale)), cv2.FONT_HERSHEY_PLAIN, 2, (0, 0, 255), thickness=2)
68
69 for i, tlwh in enumerate(tlwhs):
70 x1, y1, w, h = tlwh
71 intbox = tuple(map(int, (x1, y1, x1 + w, y1 + h)))
72 obj_id = int(obj_ids[i])
73 id_text = '{}'.format(int(obj_id))
74 if ids2 is not None:
75 id_text = id_text + ', {}'.format(int(ids2[i]))
76 color = get_color(abs(obj_id))
77 cv2.rectangle(im, intbox[0:2], intbox[2:4], color=color, thickness=line_thickness)
78 cv2.putText(im, id_text, (intbox[0], intbox[1]), cv2.FONT_HERSHEY_PLAIN, text_scale, (0, 0, 255),
79 thickness=text_thickness)
80 return im
81
82
83_COLORS = np.array(

Callers 3

image_demoFunction · 0.90
imageflow_demoFunction · 0.90
imageflow_demoFunction · 0.90

Calls 1

get_colorFunction · 0.85

Tested by

no test coverage detected