the problem is that the C library has several functions that will accept one
of many types of arrays.

The function parameter type is CvArr whose definition is (in C):

typedef void CvArr;

and the functions are declared as accepting CvArr* types as arguments.

two of the types I am wrapping are IplImage and CvMat both of which can be
passed as CvArr*.

I would like to make python callable functions that accept either instance
of IplImage or CvMat (which I have created as extension types).

Unfortunately, i haven't yet been able to figure it out through various
tinkering with subclassing, casting, or void pointers....


I would greatly appreciate any insight one could give..

Thanks and Cheers!

Chris

On Thu, May 21, 2009 at 7:05 PM, Chris Colbert <[email protected]> wrote:

> I have certain functions that should accept types of IplImage or CvMat
>
> I have the two types declared as inheriting from a generic CvArr as such
>
> cdef class CvArr:
>        cdef void* thisptr
>
> cdef class IplImage(CvArr):
>       .....
>
> cdef class CvMat(CvArr):
>       ....
>
>
> and a function declared like this:
>
> def cvSmooth(CvArr src, .....):
>       c_lib.cvSmooth(src.thisptr, ....)
>
> when compiling and calling that function with instances of IplImage, the
> Cython compiler complains that src is not a CvArr.
>
> Is there a way around this?
>
> Chris
>
_______________________________________________
Cython-dev mailing list
[email protected]
http://codespeak.net/mailman/listinfo/cython-dev

Reply via email to