Last active
August 29, 2015 14:16
-
-
Save vizowl/286cc3cfa6cc3f977bac to your computer and use it in GitHub Desktop.
Image histogram
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
import matplotlib as mpl | |
mpl.use('Agg') | |
import matplotlib.image as mpimg | |
import matplotlib.pyplot as plt | |
import numpy as np | |
img=mpimg.imread('image.jpg') | |
lum_img = img[:,:,0] | |
p = plt.hist(lum_img.flatten(), 256, range=(0.0,255), fc='k', ec='k') | |
plt.savefig('out.png') | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Try
range=(0, 255)
for a more exciting plot!