-
-
Notifications
You must be signed in to change notification settings - Fork 56.5k
Closed
Milestone
Description
System information (version)
- OpenCV => 4.4.0.46
- Operating System / Platform => Ubuntu 18.04
- Compiler => gcc, I believe
Detailed description
calcBackProject picks up values from a wrong cell in case of 3D histogram
Steps to reproduce
#!/usr/bin/python3
import cv2 as cv
import numpy as np
# BGR frame: black field with white dot at (1,1)
frame = np.zeros( [6,6,3], dtype=np.uint8 )
frame[1][1][0]=255
frame[1][1][1]=255
frame[1][1][2]=255
histSize = [4,4,4]
histRanges = [ 0,256, 0,256, 0,256 ]
# preparing the histogram
hist = np.zeros([4,4,4],dtype=np.float32)
hist[0][0][0]=1 # blackish
hist[3][3][3]=101 # symbol for white
hist[3][3][0]=113 # something else
print('hist=',hist)
out = cv.calcBackProject([frame], [0,1,2], hist, histRanges, scale=1)
print('out=',out)
# expected output should have 101 at out[1][1] , but instead it gets 113
this outputs
out= [[ 1 1 1 1 1 1]
[ 1 113 1 1 1 1]
[ 1 1 1 1 1 1]
[ 1 1 1 1 1 1]
[ 1 1 1 1 1 1]
[ 1 1 1 1 1 1]]
,but there should be 101 is place of 113
Issue submission checklist
- [+] I report the issue, it's not a question
- [+] I checked the problem with documentation, FAQ, open issues,
answers.opencv.org, Stack Overflow, etc and have not found solution - [+] I updated to latest OpenCV version and the issue is still there
- [+] There is reproducer code and related data files: videos, images, onnx, etc
Reactions are currently unavailable