Last active
May 4, 2023 07:04
-
-
Save syanyong/5fd83ff7d006d4566e115f9dbf203905 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Plot bounding box from Pytorch Hub | |
def plot_boxes(result_dict, frame): | |
for ob in result_dict: | |
rec_start = (int(ob['xmin']), int(ob['ymin'])) | |
rec_end = (int(ob['xmax']), int(ob['ymax'])) | |
color = (255, 0, 0) | |
thickness = 3 | |
cv2.rectangle(frame, rec_start, rec_end, color, thickness) | |
cv2.putText(frame, "%s %0.2f" % (ob['name'], ob['confidence']), rec_start, cv2.FONT_HERSHEY_DUPLEX, 2, color, thickness) | |
return frame | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment