how do a pass a pointer to a C datatype to my python extension type
constructor? I have the following in my code:


 #### in a cdef extern from .h block ######
struct _IplImage:
         <filler>
ctypedef _IplImage IplImage


###### extension type declaration #######
cdef class PyIplImage:

    cdef IplImage* img
    cdef readonly int width, height

    def __cinit__(self, IplImage* imgptr):
        self.img = imgptr
        self.width = self.img[0].width
        self.height = self.img[0].height


###### test functions #################

cdef IplImage* load(char* filename):
    cdef IplImage* img = cvLoadImage(filename, 1)

    return img

def testload(filename):
    cdef IplImage* img = load(filename)
    pyimg = PyIplImage(img)
    return pyimg




Cython compilation errs with "Cannot convert IplImage* to python object"


Chris
_______________________________________________
Cython-dev mailing list
[email protected]
http://codespeak.net/mailman/listinfo/cython-dev

Reply via email to