Calculate histogram for collored image [closed]

asked 2019-11-19 17:07:19 -0600

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

Closed for the following reason question is off-topic or not relevant by berak
close date 2019-11-20 00:51:34.488250

Comments

1

not an opencv problem. please look up numpy.zero docs

berak gravatar imageberak ( 2019-11-20 00:51:27 -0600 )edit