OpenCV python bindings

Nathaniel Fairfield than at cmu.edu
Thu Mar 22 11:26:52 PDT 2007


Hi,

I've been trying to get the python wrapping for OpenCV to work.  Right
now, every time I try to "import opencv", I get a Bus Error (seg fault,
I assume).  From gdb, I get the following, which isn't very helpful to me:

Starting program: /opt/local/bin/python
Reading symbols for shared libraries .+ done
Python 2.4.3 (#1, Jan  4 2007, 19:19:23)
[GCC 4.0.1 (Apple Computer, Inc. build 5247)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
Reading symbols for shared libraries ... done
>>> import opencv
Reading symbols for shared libraries .... done

Program received signal EXC_BAD_ACCESS, Could not access memory.
Reason: KERN_PROTECTION_FAILURE at address: 0x00000000
PyInt_FromLong (ival=88) at Objects/intobject.c:89
89      Objects/intobject.c: No such file or directory.
         in Objects/intobject.c

I've tried both OpenCV 0.9.9 (which is in the current portfile) and
OpenCV 1.0.0 (the latest release), and get the same result.

I'm running MacPorts Python 2.4.3.  Rummaging around with google shows
that other people have had similar problems, but have been able to get
the 'built-in' Python 2.3 that comes with Tiger to work.  I'd like to
get it working with 2.4 if possible.

The crux of the matter seems to be when python loads "_cv.so".

otool -L _cv.so
_cv.so:
         /opt/local/lib/libpython2.4.dylib (compatibility version 2.4.0,
current version 2.4.0)
         /opt/local/lib/libcv.1.dylib (compatibility version 2.0.0,
current version 2.0.0)
         /opt/local/lib/libcxcore.1.dylib (compatibility version 2.0.0,
current version 2.0.0)
         /usr/lib/libSystem.B.dylib (compatibility version 1.0.0,
current version 88.1.8)
         /usr/lib/libstdc++.6.dylib (compatibility version 7.0.0,
current version 7.4.0)
         /usr/lib/libgcc_s.1.dylib (compatibility version 1.0.0, current
version 1.0.0)

I've tried compiling OpenCV with Carbon (the default), and also with the
configure.args --without-carbon --with-gtk --without-quicktime --with-swig

Any help would be much appreciated.

Thanks,
Nathaniel




More information about the macports-dev mailing list