Bug#607499: Python crash when using CreateHist function

Henry Del Rosario delrohenry at gmail.com
Sat Nov 26 23:43:33 UTC 2011


Hi,

I'm using:
Python 2.7.2
Opencv 2.3.1
Windows 7 Ultimate SP1
(I know it's not debian, but this might help others in solving this problem)

Python 2.7.2 (default, Jun 12 2011, 15:08:59) [MSC v.1500 32 bit (Intel)]
on win
32
Type "help", "copyright", "credits" or "license" for more information.
>>> import cv
>>> cv.CreateHist(1, cv.CV_HIST_ARRAY, rango, 1)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
NameError: name 'rango' is not defined
>>> from array import array
>>> rango = ('f', [0, 255])
>>> cv.CreateHist(1, cv.CV_HIST_ARRAY, rango, 1)

this will make python.exe to stop working. The function makes python crash.
I'm not sure if I am wrong or is the function that is making python crash.

So I tried to find what was going on. so i went to the library, and
curiously checked the calchist.py sample. It was very interesting to found
that the firs value dims, should be an array, else it would not work and
return this error.

hist = cv.CreateHist([h_bins, s_bins], cv.CV_HIST_ARRAY, ranges, 1)

the first parameter is [h_bins, s_bins] and in the documentation doesn't
specifies that it should be like that.

and the first parameter seems to be the number of bins.

So i did the same as in the example:

import cv2.cv as cv
and calling the function as this:
cv.CreateHist([number_of_bins], cv.CV_HIST_ARRAY, rango, 1)

I hope this helps others.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.alioth.debian.org/pipermail/debian-science-maintainers/attachments/20111126/c166a259/attachment.html>


More information about the debian-science-maintainers mailing list