Skip to content

Instantly share code, notes, and snippets.

@vizowl
Last active August 29, 2015 14:16
Show Gist options
  • Save vizowl/2f965d21f91920eb37d4 to your computer and use it in GitHub Desktop.
Save vizowl/2f965d21f91920eb37d4 to your computer and use it in GitHub Desktop.
Histogram 2
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('/output/out.png')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment