Skip to content

Instantly share code, notes, and snippets.

@quocdat32461997
Last active January 27, 2020 08:09
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 quocdat32461997/dfb32ad56acdee74391895797ad7bf9b to your computer and use it in GitHub Desktop.
Save quocdat32461997/dfb32ad56acdee74391895797ad7bf9b to your computer and use it in GitHub Desktop.
Compute image histogram
def histogram(img_channel):
#hist, _ = np.histogram(im_channele, bins = 256, range = (0, 256))
hist = np.array([0] * 256)
height = len(img_channel)
width = len(img_channel[0])
for row in range(height):
for col in range(width):
hist[img_channel[row, col]] += 1
return hist
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment