Ask Your Question

isida's profile - activity

2019-11-21 16:20:13 +0200 asked a question How to fix problem when creating image histogram

Hello, I'm trying to develop a function that calculates histograms for the colored images. When I run my program it says 'too many values to unpack (expected 2)'. What am I doing wrong here?

Below is my code

Collor_Channel =("r" , "g", "b")
PixelNum, Collor_Channel = im.shape
ImageHistogram = np.zeros(256)
    for i in range(PixelNum[0]):
          for j in range(PixelNum[1]):
               for x in range(PixelNum[2]):
                     totalvalue = im [j,i,x]
                            ImageHistogram[int(totalvalue)] += 1

                     return ImageHistogram
2019-11-21 16:20:13 +0200 asked a question How to create your own function for image histogram?

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