How to create your own function for image histogram? [closed]

asked 2019-11-21 12:51:12 +0100

isida gravatar image

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
edit retag flag offensive reopen merge delete

Closed for the following reason duplicate question by tmonteil
close date 2019-11-21 16:22:49.111982