I have a USB camera (uEye) which has a C++ interface allowing you to configure some features of the camera. The C++ program can read the image data from the camera and store it somewhere in pre-allocated memory. All of this runs under Windows.
Python with numpy gives me a simple environment to manipulate images and spend some quality time working on my processing algorithms.
What I would like to do is:
- Use the c++ program to configure the camera and obtain images (at video rate),
- Pass the data to Python
- Process the data in Python
I am under the impression that I do not want to embed C++ in Python or Python in C++, as I prefer to have two stand-alone systems (so I can use the camera without the Python stuff, or use the Python stuff without the camera).
What I can find so far are methods to share some data using pipes, sockets, or mapped memory, though it appears to be restricted to small amounts of data or strings. What I can not find, however, is an indication if this is fast enough and something that I should attempt to implement. Should I want to do this?
If this is a bad idea, what would be a better alternative? Embed the Python code in C++ or vice versa? Or ditch Python all together because the savings in development time there do not offset the additional effort in getting the interprocess communication to work?
There was a recent post on the PyPy blog about real-time video processing. In the example they use mplayer to be grab and display video, which might be preferable to trying to interface with your C++ program (assuming it works with your webcam). If not, thinking along those lines a simple solution is to just connect stdout/stdin of your two applications. Also probably a good idea to look at PyPy for video processing.