My favorites | Sign in
Project Home Downloads Wiki Issues Source
New issue   Search
for
  Advanced search   Search tips   Subscriptions
Issue 15: Error related to numpy array on 64-bit Ubuntu 10.04
2 people starred this issue and may be notified of changes. Back to list
Status:  Fixed
Owner:  ----
Closed:  Jul 2010


Sign in to add a comment
 
Reported by dattan...@gmail.com, May 19, 2010
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?

May 19, 2010
Project Member #1 pmtri80@gmail.com
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
Status: Accepted
May 19, 2010
#2 dattan...@gmail.com
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.
May 21, 2010
#3 dattan...@gmail.com
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.
Jun 9, 2010
#4 neumann....@gmail.com
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? ;-) 
ndarray.patch
1.5 KB   View   Download
Jun 9, 2010
Project Member #5 pmtri80@gmail.com
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

Jun 9, 2010
#6 dattan...@gmail.com
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.
Jul 18, 2010
Project Member #7 pmtri80@gmail.com
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

Status: Fixed
Sign in to add a comment

Powered by Google Project Hosting