How to create your own function for image histogram? [closed]
hello,
I'm trying to create my own function to calculate histograms for colored images. I wrote my function it returns a message " too many values to unpack (expected 2)"
Below is my code for the Histogram
(r,g,b)=cv2.split(im)
Collor_Channel =("r" , "g", "b")
PixelNum, Collor_Channel = im.shape
mageHistogram = np.zeros(256, im.shape)
for i in range(PixelNum[0]):
for j in range(PixelNum[1]):
for x in range(PixelNum[2]):
totalvalue = im(j,i,x)
ImHistogram[int(totalvalue*255)] += 1
return ImHistogram
enter code here