Created
June 14, 2017 06:20
-
-
Save hackintoshrao/5bab8a459ee18ee02c73d5bab13d468a to your computer and use it in GitHub Desktop.
draw rectangle boxes at given coordinates on the given image.
This file contains hidden or 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
| import np as numpy | |
| import cv2 | |
| """ | |
| draw rectangle boxes at given coordinates on the given image. | |
| """ | |
| def draw_boxes(img, bboxes, color=(0, 0, 255), thick=6): | |
| # make a copy of the image | |
| draw_img = np.copy(img) | |
| # draw each bounding box on your image copy using cv2.rectangle() | |
| # return the image copy with boxes drawn | |
| for x in bboxes: | |
| print( x) | |
| cv2.rectangle(draw_img, x[0], x[1], color, thick) | |
| return draw_img # Change this line to return image copy with boxes |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment