Re: [Cython] interfacing with OpenCV?

2009-05-19 Thread Chris Colbert
> > Once you get used to code > Cython, and assuming you have some C/C++ background, I bet you will > stop using ctypes ;-) .. > I think you are right :). In an afternoon, I've got a decent amount of what I need wrapped :) Cheers! Chris ___ Cython-dev

Re: [Cython] interfacing with OpenCV?

2009-05-18 Thread Lisandro Dalcin
Likely (never used ctypes) you will need to call "ctypes.addressof", and a call to PyLong_AsVoidPtr(). See yourself: http://svn.python.org/view/python/trunk/Modules/_ctypes/callproc.c?view=markup http://docs.python.org/c-api/long.html#PyLong_AsVoidPtr cdef extern from "Python.h" void *PyLong

Re: [Cython] interfacing with OpenCV?

2009-05-18 Thread Chris Colbert
yet again: for various reasons, I would like to use both the ctypes wrapper and cython in same program. Specifically I have a ctypes instance of an OpenCV image. I pass the pointer of this image to a cython function which returns a pointer to a new image. I need to get this pointer back into pytho

Re: [Cython] interfacing with OpenCV?

2009-05-18 Thread Chris Colbert
Hoyt, All functions, even external ones, that can be run without the gil > need the "nogil" decorator on the end or cython assumes it needs the > gil. E.g. > > > cdef extern from "highgui.h": > > cdef IplImage* cvLoadImage(char* file, int iscolor) nogil > > cdef int cvNamedWindow(char* na

Re: [Cython] interfacing with OpenCV?

2009-05-18 Thread Hoyt Koepke
Hi, > How do i get this to release the gil: > > when i change the cython module to the following Cython compilation fails > claiming I'm calling a gil required function: All functions, even external ones, that can be run without the gil need the "nogil" decorator on the end or cython assumes it n

Re: [Cython] interfacing with OpenCV?

2009-05-18 Thread Chris Colbert
new question: How do i get this to release the gil: when i change the cython module to the following Cython compilation fails claiming I'm calling a gil required function: cdef extern from "cxtypes.h": ctypedef struct IplImage: pass cdef extern from "highgui.h": cdef IplImage* c

Re: [Cython] interfacing with OpenCV?

2009-05-18 Thread Chris Colbert
On Mon, May 18, 2009 at 7:30 PM, Chris Colbert wrote: > > >> >> This error seems like you're not linking to the python library. I >> would recommend using distutils to compile your files. Can you >> compile the Cython file >> >> print "hello" >> >> >> This is totally doable from Cython. >> >> >

Re: [Cython] interfacing with OpenCV?

2009-05-18 Thread Chris Colbert
> > > This error seems like you're not linking to the python library. I > would recommend using distutils to compile your files. Can you > compile the Cython file > > print "hello" > > > This is totally doable from Cython. > > I can compile and use cython modules that don't depend on external c li

Re: [Cython] interfacing with OpenCV?

2009-05-18 Thread Robert Bradshaw
On May 18, 2009, at 3:21 PM, Chris Colbert wrote: > "You can probably skip the "write my functions in a pure C source > file" step and write them directly in Cython. > > - Robert" > > > > i tried doing that today and was running into boat loads of trouble > resolving the IplImage data type and h

Re: [Cython] interfacing with OpenCV?

2009-05-18 Thread Chris Colbert
"You can probably skip the "write my functions in a pure C source file" step and write them directly in Cython. - Robert" i tried doing that today and was running into boat loads of trouble resolving the IplImage data type and header dependencies. This is actually turning out to be quite diffi

Re: [Cython] interfacing with OpenCV?

2009-05-18 Thread Robert Bradshaw
On May 17, 2009, at 1:23 PM, Chris Colbert wrote: > How would I go about interfacing with OpenCV data types in cython? > > I've read the wiki on interfacing with external C code but didn't > fully follow. > > I'm currently using a ctypes wrapper for OpenCV from python and > doing some manipula

[Cython] interfacing with OpenCV?

2009-05-17 Thread Chris Colbert
How would I go about interfacing with OpenCV data types in cython? I've read the wiki on interfacing with external C code but didn't fully follow. I'm currently using a ctypes wrapper for OpenCV from python and doing some manipulation there, but I would like to chain together a bunch of functions