Ask Your Question
0

Unexpected result with RGB Histogram Backprojection in Python

asked 2016-12-29 10:46:12 -0600

Mai Kar gravatar image

updated 2016-12-30 04:11:09 -0600

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?

edit retag flag offensive close merge delete

Comments

LBerger gravatar imageLBerger ( 2016-12-29 11:06:24 -0600 )edit

I updated my post, I am using OpenCv 2.4.13 in Python 2.7.12

Mai Kar gravatar imageMai Kar ( 2016-12-30 04:11:50 -0600 )edit

1 answer

Sort by ยป oldest newest most voted
0

answered 2017-02-19 12:38:43 -0600

fastdeath gravatar image

updated 2017-02-19 12:40:40 -0600

Same for me, it's ok with 2d but it fails with 3d

It seems like a bug (opencv 3.2.0, python 2.7)

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2016-12-29 10:46:12 -0600

Seen: 461 times

Last updated: Feb 19 '17