Created
January 13, 2019 15:21
-
-
Save vihar/a4099a4bfb8468e61a5723f47660d6db to your computer and use it in GitHub Desktop.
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
img = np.squeeze(images[7]) | |
fig = plt.figure(figsize = (12,12)) | |
ax = fig.add_subplot(111) | |
ax.imshow(img, cmap='gray') | |
width, height = img.shape | |
thresh = img.max()/2.5 | |
for x in range(width): | |
for y in range(height): | |
val = round(img[x][y],2) if img[x][y] !=0 else 0 | |
ax.annotate(str(val), xy=(y,x), | |
color='white' if img[x][y]<thresh else 'black') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment