Passing an image from C++ to Python 3.4 -
i using python interpreter embedded in c++ programme generate reports. part of report, python script grabs image info c++ programme , building pil
image follows:
width = getimagewidth () height = getimageheight () pixels = getimagepixels () piltile = image.frombuffer ('rgb', (width, height), pixels, 'raw', 'rgb', 0, -1)
on c++ side of things, i've been returning image pixels buffer using boost.python
:
object getimagepixels () { glubyte *buf = getimage () ; size_t size = getsize () ; object obj = object ((handle<>(borrowed (pybuffer_frommemory ( (char *) buf, size, pybuf_read))))) ; homecoming obj ; }
the problem is, python 3.x eliminates pybuffer_frommemory
interface. i've tried replacing pymemoryview_frommemory
, pil
doesn't seem able utilize memoryviews.
what best way replace pybuffer_frommemory
here?
thanks help!
python python-3.x python-imaging-library boost-python
No comments:
Post a Comment