Skip to content

Instantly share code, notes, and snippets.

@hackintoshrao
Created June 14, 2017 06:20
Show Gist options
  • Select an option

  • Save hackintoshrao/5bab8a459ee18ee02c73d5bab13d468a to your computer and use it in GitHub Desktop.

Select an option

Save hackintoshrao/5bab8a459ee18ee02c73d5bab13d468a to your computer and use it in GitHub Desktop.
draw rectangle boxes at given coordinates on the given image.
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