Created
November 19, 2015 00:02
-
-
Save victorhcm/510156a6e5cd5339d656 to your computer and use it in GitHub Desktop.
overlay image with annotations.
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
# coding: utf-8 | |
import matplotlib.pyplot as plt | |
import Image | |
img = Image.open('truman-stairs.jpg') | |
fig, ax = plt.subplots(figsize=(12,12)) | |
ax.imshow(img, aspect='equal') | |
ax.add_patch( | |
plt.Rectangle((30,30), | |
64, 128, fill = False, edgecolor='red', linewidth=3.5) | |
) | |
ax.text(30, 30-2, | |
'helloooooooo', | |
bbox=dict(facecolor='blue', alpha=0.5), | |
fontsize=20, color='white') | |
plt.axis('off') | |
plt.tight_layout() | |
plt.show() | |
fig.savefig('/tmp/edited.png') | |
plt.close(fig) |
Author
victorhcm
commented
Nov 19, 2015
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment