ilikecats567 / pyopencv

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

Error related to numpy array on 64-bit Ubuntu 10.04 #15

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Download PyOpenCV and Boost
2. Compile Boost.Python from source
3. Compile PyOpenCV from source using Boost.Python from source
4. Try to run the following code in ipython

import pyopencv as cv
a = cv.Mat(3,3,cv.CV_32F)
a

What is the expected output? What do you see instead?
I expect to see the content of a.
What I get is a huge pile of error message ending with:
/home/dchu/Desktop/PythonURxDTest/pyopencv/core.pyc in _Mat__repr__(self)
   1831 
   1832 def _Mat__repr__(self):
-> 1833     return "Mat()" if self.empty() else "Mat(rows=" +
repr(self.rows)         + ", cols=" + repr(self.cols) + ", nchannels=" +
repr(self.channels())         + ", depth=" + repr(self.depth()) + "):\n" +
repr(self.ndarray)
   1834 Mat.__repr__ = _Mat__repr__
   1835 

ValueError: dimensions too large.

What version of the product are you using? On what operating system?
PyOpenCV1.0.2.tar.gz
Ubuntu 10.04 64-bit

Please provide any additional information below.
This seems to be a problem with 64-bit systems. Is there anyone out there
with the same Ubuntu version in 32-bit who can confirm this?

Original issue reported on code.google.com by dattan...@gmail.com on 20 May 2010 at 1:44

GoogleCodeExporter commented 9 years ago
Thanks, Dat. I wish I had time to soon upgrade my OS to 64-bit so that I can 
test and
fix errors like this. By the way, are you using 64-bit numpy or 32-bit numpy? 
IIRC,
64-bit numpy is still experimental. It may not be included in 64-bit Ubuntu by 
default.

Cheers,
Minh-Tri

Original comment by pmtri80@gmail.com on 20 May 2010 at 2:09

GoogleCodeExporter commented 9 years ago
You are welcome, Tri. I submit this bug so other people who find the same 
problem
will know that we will try to address it.

I am quite sure that everything that I have on this Ubuntu box is 64-bit. I 
installed
numpy from the repository with 

sudo apt-get install python-numpy

It is my desire to be able to work in C++ on cv::Mat and have the result 
wrapped and
converted to Python cv::Mat (and Numpy Array). As far as I have researched, 
being to
get PyOpenCV to compile on my machine is the only way to enable this.

Original comment by dattan...@gmail.com on 20 May 2010 at 2:17

GoogleCodeExporter commented 9 years ago
Confirmed. I install Ubuntu 32-bit on a VirtualBox machine and I tested the same
code. PyOpenCV works. The problem is with something about 64-bit.

Original comment by dattan...@gmail.com on 21 May 2010 at 3:52

GoogleCodeExporter commented 9 years ago
I recently compiled pyopencv (the 2.1.0-wr1.0.2 release) from source on Ubuntu 
10.04 64bit with OpenCV 2.1 and numpy from the ubuntu binary package 
(python-numpy). I used the CMake file that was posted by dattan in Issue 2.

I can confirm the bug reported here. Attached you find a patch that fixed this 
issue for me. The problem was that the npy_intp type - which is used to define 
dimensions of numpy arrays on creation - is actually 8byte on 64bit systems, 
but pyopencv passed 4byte integers to numpy.

BTW: May I ask if there is anyone working on a full 64bit port of pyopencv, 
yet? ;-) 

Original comment by neumann....@gmail.com on 9 Jun 2010 at 8:48

Attachments:

GoogleCodeExporter commented 9 years ago
Great! Many thanks, Newmann. This patch is very helpful. Unfortunately, I'm 
still too busy with my daily work from now until mid July. However, when I am 
done with it, I will start upgrading my OS to 64-bit and incorporate all the 
recent nice patches provided by you and Dat.

Cheers,
Minh-Tri

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

GoogleCodeExporter commented 9 years ago
Confirmed that Neumann's patch works. This is great news. Next version of 
pyopencv will be one step closer to full 64-bit compatible.

@Neumann: I don't think anyone is working on 64-bit port of pyopencv.

Original comment by dattan...@gmail.com on 9 Jun 2010 at 12:38

GoogleCodeExporter commented 9 years ago
Good news: The latest version, PyOpenCV 2.1.0.wr.1.1.0, is now compilable on a 
64-bit Ubuntu 10.4 platform and appears to work properly. Feel free to test it 
on your 64-bit platforms. Thanks to both Thomas and Dat for your contributions. 
I really appreciate them.

I haven't included Dat's CMakelists.txt file yet. But I will work towards 
migrating PyOpenCV to the CMake build system.

Cheers,
Minh-Tri

Original comment by pmtri80@gmail.com on 18 Jul 2010 at 10:20