Hi,
I have this definition file:
#### cy_cvtypes.pxd #####
cimport c_cxcore
cimport c_highgui
cdef class IplImage:
cdef c_cxcore.IplImage* thisptr
cdef int needs_free
###########################
and the corresponding implementation:
#### cy_cvtypes.pxy ######
cimport c_cxcore
cimport c_highgui
cdef class IplImage:
def __cinit__(self, needs_free=1):
# sets the flag which determines whether or not to free the image
resource during
# garbage collection. Make sure to set to zero if your not supposed to
release the
# the image.
self.needs_free = needs_free
def __dealloc__(self):
if self.needs_free:
c_cxcore.cvReleaseImage(&self.thisptr)
#Convienience Functions
def show(self):
# a convienience function which displays the image in a new window
# useful for debugging. window exits on keypress.
c_highgui.cvNamedWindow('test', 1)
c_highgui.cvShowImage('test', self.thisptr)
c_highgui.cvWaitKey(0)
c_highgui.cvDestroyWindow('test')
#############################################
c_cxcore and c_highgui define the types and funtions from the respective
header files
when compiling, I get complaints about not being able to convert python
objects.
example:
Error converting Pyrex file to C:
------------------------------------------------------------
...
def show(self):
# a convienience function which displays the image in a new window
# useful for debugging. window exits on keypress.
c_highgui.cvNamedWindow('test', 1)
c_highgui.cvShowImage('test', self.thisptr)
^
------------------------------------------------------------
F:\Desktop\cythonopencv\cy_cvtypes.pyx:22:42: Cannot convert Python object
to 'c
_cxcore.CvArr *'
It seems that the cython compiler is not reading the cy_cvtype.pxd defintion
file.
Also, I am attempting to compile more than one .pyx source file into the
same module by adding multiple .pyx files to the sources [] in setup.py.
Could that be the source of the problem? i.e. to I have to compile a
separate .pyd module for every .pyx file?
Chris
_______________________________________________
Cython-dev mailing list
[email protected]
http://codespeak.net/mailman/listinfo/cython-dev