sethrh / pyopencv

Automatically exported from code.google.com/p/pyopencv
0 stars 0 forks source link

use SparseMat in calcHist cause error #17

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
>>> What steps will reproduce the problem?

1. run the following code, which use a SparseMat to get the result of calcHist.

import pyopencv as cv
import numpy as np

img = cv.Mat(100, 100, cv.CV_8UC3)
img[:] = 0

result = cv.SparseMat() # <--- NG
# result = cv.MatND() # <--- OK

r = cv.Mat(1,2,cv.CV_32F)
r[0,:] = 0, 256
ranges = [r, r]

cv.calcHist([img], 
    channels = cv.asMat([0, 1]), 
    mask = cv.Mat(), 
    hist = result, 
    histSize=cv.asMat([10, 10]), 
    ranges=ranges
    )

print result

2. The program cause a system error.
3. using MatND is OK.

>>> What is the expected output? What do you see instead?

The same result as using MatND.

>>> What version of the product are you using? On what operating system?

Windows XP, Version: 2.1.0.wr1.0.2

>>> Please provide any additional information below.

Original issue reported on code.google.com by ruoyu0...@gmail.com on 8 Jun 2010 at 7:50

GoogleCodeExporter commented 9 years ago
Thanks. I think it is the known issue of Boost.Python, which sometimes does not 
recognize the class of a function argument correctly. I'll see if I can find 
any workaround for the issue.

Cheers,
Minh-Tri

Original comment by pmtri80@gmail.com on 9 Jun 2010 at 10:45

GoogleCodeExporter commented 9 years ago
Hi,

I have double-checked this bug and it appears the error does not come from 
Boost.Python. Instead the error comes from OpenCV's calcHist() function that 
outputs a SparseMat histogram. Thus, there is nothing I can do. Sorry.

Cheers,
Minh-Tri

Original comment by pmtri80@gmail.com on 17 Jul 2010 at 7:30