in src/webcam_client.py [0:0]
def annotate_frame(frame, response_dict):
labels_to_annotate = {
'Person': (255, 0, 0), # cv2 is BGR, so this is blue
'Helmet': (0, 255, 0)
}
for label, color in labels_to_annotate.items():
for p in response_dict['labels'][label]['Instances']:
bbox = resize_bbox(frame, p['BoundingBox'])
draw_bounding_box(frame, bbox, color)
# Draw label
if response_dict['compliant']:
draw_label(frame, dict(Left=0, Top=22), 'Protected', (255, 0, 0))
else:
draw_label(frame, dict(Left=0, Top=22), 'Not protected', (0, 0, 255))