Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

PYTHON C++ SWIG share image pixel data in memory

Hello,

I am working on passing image pixel data from c++ app to python and vice versa. The use case is user creates an image in the c++ application and then retrieve the image (preferably from memory so that we do not need to copy back and forth) and do some image process in python (using python image processing library such as PIL, opencv etc). Once image processing is done in python, we would want to pass the image back to the c++ application (preferably from memory as well, so that we do not need to copy the image data).

So, my question is how to get the image pixel data from python? I can pass the void* that points to the pixel data as well as the width and height information from the C++ application (with SWIG).

And how do we pass the image pixel data from python back to the c++ app (again prefer to just refer it to the pixel data in memory)?

My application is written in c++ and I am using SWIG to interface with python.

Thanks,

Winnie

PYTHON C++ SWIG share image pixel data in memory

Hello,

I am working on passing image pixel data from c++ app to python and vice versa. The use case is user creates an image in the c++ application and then retrieve the image (preferably from memory so that we do not need to copy back and forth) and do some image process in python (using python image processing library such as PIL, opencv etc). Once image processing is done in python, we would want to pass the image back to the c++ application (preferably from memory as well, so that we do not need to copy the image data).

So, my question is how to get the image pixel data from python? I can pass the void* that points to the pixel data as well as the width and height information from the C++ application (with SWIG).

And how do we pass the image pixel data from python back to the c++ app (again prefer to just refer it to the pixel data in memory)?

My application is written in c++ and I am using SWIG to interface with python.

Thanks,

WinnieThanks.