Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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