Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Unexpected result with RGB Histogram Backprojection

I noticed that when I apply cv2.calcBackProject on the pixel [b,v,r], it returns the backprojection on the pixel [b,v,0], the third channel's value is ignored while my histogram looks fine.

Here is my code :

channels=[0,1,2]
histSize = [8,8,8]
ranges=[0,256, 0,256, 0,256]

#image is in BGR color
bgr_split = cv2.split(roi_img)

#Compute image bgr histogram
hist = cv2.calcHist(bgr_split, channels, mask, histSize, ranges)
cv2.normalize(hist, hist, 0, 255, cv2.NORM_MINMAX)

#Compute histogram backprojection
dst = cv2.calcBackProject([img],channels,hist,ranges,1)

Can someone confirm if it is a bug?

Unexpected result with RGB Histogram BackprojectionBackprojection in Python

I am using OpenCv 2.4.13 in Python 2.7.12 and I noticed that when I apply cv2.calcBackProject on the pixel [b,v,r], it returns the backprojection on the pixel [b,v,0], the third channel's value is ignored while my histogram looks fine.

Here is my code :

channels=[0,1,2]
histSize = [8,8,8]
ranges=[0,256, 0,256, 0,256]

#image is in BGR color
bgr_split = cv2.split(roi_img)

#Compute image bgr histogram
hist = cv2.calcHist(bgr_split, channels, mask, histSize, ranges)
cv2.normalize(hist, hist, 0, 255, cv2.NORM_MINMAX)

#Compute histogram backprojection
dst = cv2.calcBackProject([img],channels,hist,ranges,1)

Can someone confirm if it is a bug?