[pypy-dev] Questions about build new extension with RPython

Boxiang Sun daetalusun at gmail.com
Sun Jun 21 19:41:04 CEST 2015


Thanks to Armin and Maciej.

I will try to build a OpenCV-PyPy prototype with cffi first.

Regards,
Sun

2015-06-21 19:04 GMT+08:00 Armin Rigo <arigo at tunes.org>:

> Hi Boxiang,
>
> On 21 June 2015 at 01:33, Boxiang Sun <daetalusun at gmail.com> wrote:
> > Does it mean if wrap OpenCV in PyPy
> > with cffi. OpenCV-PyPy could not use ndarray?
>
> I don't know OpenCV myself, but writing a CFFI module accessing it
> should be easy, even if there are functions that take numpy arrays.
> You can do:
>
>     ffi.from_buffer(some_ndarray)
>
> which returns a ffi ``char *`` pointer, pointing to the data from the
> ndarray.  You can pass this raw pointer to C functions from OpenCV.
> There is no copy of the data; if the C function modifies the data, it
> will be modified in the numpy array too.
>
>
> A bientôt,
>
> Armin.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/pypy-dev/attachments/20150622/96ce6573/attachment.html>


More information about the pypy-dev mailing list