I want to measure pixel intensities in a 16 bit image. Therefore I did a numpy histogram that shows the number of Pixels against the grayscale value from 0 to 65535 (16 bit). I did it with
hist= numpy.histogram(grayscaleimage.ravel(), 65536, [0, 65536])
After that I measure the whole intensity of my image with (that means the sum of : number of pixels * pixel value for each):
Intensity = 0
for i in range(len(hist[0])):
Intensity += hist[0][i]*hist[1][i]
print(Intesity)
Now I want to see my histogram. I don't know how to plot hist
, although I have my needed values. Can someone help me with this?
bins = range (0, 65536) plt.hist (hist[0][i], bins) plt.show()
but nothing happens. Either a shown plot nor an error?