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
to run outside of the GIL on another core.

>From ctypes, I can pass a function a pointer to my IPLimage (the opencv
data).

So I would imagine it would be something along the lines of:

- write my functions in a pure C source file
- declare extern functions in cython for the functions in the C source
- compile the Cython file
- compil the C source and compiled cython into the same pyd file

The program flow would be like:
- pass the pointer to the image to the cython function
- forward that pointer to another function that executes with nogil which
calls the functions from the C library
- return the pointer to the modified image to calling function
- return that same pointer back to python.


Is that about right? Or am I way off?

Chris
_______________________________________________
Cython-dev mailing list
Cython-dev@codespeak.net
http://codespeak.net/mailman/listinfo/cython-dev

Reply via email to