Skip to content

Instantly share code, notes, and snippets.

@yosemitebandit
Created October 7, 2015 18:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yosemitebandit/299a36aae03afe9326bb to your computer and use it in GitHub Desktop.
Save yosemitebandit/299a36aae03afe9326bb to your computer and use it in GitHub Desktop.
histogram of an image
import matplotlib.pyplot as plt
import numpy as np
from skimage import io
raw_image = io.imread('test.jpg')
figure_grid = gridspec.GridSpec(1, 1)
ax0 = plt.subplot(figure_grid[0, 0])
hist, bin_edges = np.histogram(raw_image, bins=np.arange(0, 256))
ax0.bar(bin_edges[:-1], hist, width=1)
plt.show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment