MCPcopy Create free account
hub / github.com/Vegetebird/GraphMLP / write

Function write

demo/lib/yolov3/bbox.py:99–111  ·  view source on GitHub ↗
(x, batches, results, colors, classes)

Source from the content-addressed store, hash-verified

97
98
99def write(x, batches, results, colors, classes):
100 c1 = tuple(x[1:3].int())
101 c2 = tuple(x[3:5].int())
102 img = results[int(x[0])]
103 cls = int(x[-1])
104 label = "{0}".format(classes[cls])
105 color = random.choice(colors)
106 cv2.rectangle(img, c1, c2,color, 1)
107 t_size = cv2.getTextSize(label, cv2.FONT_HERSHEY_PLAIN, 1 , 1)[0]
108 c2 = c1[0] + t_size[0] + 3, c1[1] + t_size[1] + 4
109 cv2.rectangle(img, c1, c2,color, -1)
110 cv2.putText(img, label, (c1[0], c1[1] + t_size[1] + 4), cv2.FONT_HERSHEY_PLAIN, 1, [225,255,255], 1);
111 return img

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected