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 python as a new image.
The following cython code complains that it cant convert the pointer to a
python object. but thats exactly the purpose of the POINTER() call from
ctypes (from what I gather).
Here is the code:
from ctypes import *
cdef extern from "cxtypes.h":
ctypedef struct IplImage:
pass
cdef extern from "cxcore.h":
cdef IplImage* cvCloneImage(IplImage* img) nogil
cdef IplImage* clone(IplImage* img) nogil:
cdef IplImage* out = cvCloneImage(img)
return out
def myclone(pyimg):
cdef IplImage* dst
with nogil:
dst = clone(byref(pyimg))
pydst = POINTER(dst)
return pydst
any ideas?
Chris
_______________________________________________
Cython-dev mailing list
[email protected]
http://codespeak.net/mailman/listinfo/cython-dev