Ask Your Question

Revision history [back]

Calculate histogram for collored image

hello,

I'm trying to create my own function to calculate histograms for colored images. I wrote my function it returns a message " tuple' object cannot be interpreted as an integer"

Bellow is my code for the Histogram

(r,g,b)=cv2.split(im)
Collor_Channel =("r" , "g", "b")
# initialize the histogram to zero
ImageHistogram = np.zeros([256, Collor_Channel])
#define the dimesion if my imported image and store it to a variable
PixelNum = im.shape
#two for loop in which
for i in range (PixelNum[0]):
    for j in range(PixelNum[1]):
        for x in range(Collor_Channel[1]):
        #determine image size (all pixel element)
            Histogram[im[i,j,x],x]+=1 

return ImageHistogram