Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

calcHist on BGR in python

Hey,

I want to use the calcHist function in python on an BGR, but I get some unexpected results. The code I use to compute the histogram is as follows:

hist = cv2.calcHist([image], [0,1,2], (seg == 1).astype(np.uint8), [25,25,25], [0, 255, 0, 255, 0, 255])

However the result of hist is of shape (25, 25, 25). I was expecting to get (25,3), as in 25 bins per channel. What is this result I am getting? The opencv documentation simply states

hist – Output histogram, which is a dense or sparse dims -dimensional array.

But I don't quite understand what this means exactly.

Best regards, Hans