Skip to content

Instantly share code, notes, and snippets.

@qmaruf
Created January 29, 2019 01:14
Show Gist options
  • Save qmaruf/728fa20cacb70332b028764a917b2776 to your computer and use it in GitHub Desktop.
Save qmaruf/728fa20cacb70332b028764a917b2776 to your computer and use it in GitHub Desktop.
def draw_rectangle(path, x1, y1, x2, y2):
im = np.array(Image.open(path), dtype=np.uint8)
fig,ax = plt.subplots(1)
ax.imshow(im)
rect = patches.Rectangle((x1,y1),x2-x1,y2-y1,linewidth=1,edgecolor='r',facecolor='none')
ax.add_patch(rect)
plt.show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment