Skip to content

Instantly share code, notes, and snippets.

@MrDavidYu
Created August 26, 2018 19:28
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save MrDavidYu/f5ee5321452e18fbb4872dd0060a925a to your computer and use it in GitHub Desktop.
Save MrDavidYu/f5ee5321452e18fbb4872dd0060a925a to your computer and use it in GitHub Desktop.
import matplotlib.pyplot as plt
import matplotlib.patches as patches
from PIL import Image
import numpy as np
input_test_img = '/your/path/Utah_AGRC-HRO_15.0cm_12TVK220980-CROP.0.0.jpg'
im = np.array(Image.open(input_test_img), dtype=np.uint8)
# Create figure and axes
fig,ax = plt.subplots(figsize=(10, 10))
# Display the image
ax.imshow(im)
# Create a Rectangle patch
rect1 = patches.Rectangle((8.99999999997,2.0000000000099987),0.0466666666667*600,0.0466666666667*600,linewidth=1,edgecolor='r',facecolor='none')
# Add the patch to the Axes
ax.add_patch(rect1)
plt.show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment