[C++-sig] how to return arbitrary (python-)objects from boost?
Joerg Kurlbaum
jkur at informatik.uni-bremen.de
Wed Apr 23 12:28:42 CEST 2008
Hello list,
i'm using boost-python to wrap a C++ class that implements a camera with
libdc1394.
At some point i want to get the image from the camera, which is a uchar
array into some python object.
For further processing i converted the image to a numpy array.
But for displaying the image the QImage class from pyqt4 is a better
choice. To convert the numpy array to a QImage class i used
toQimage() from pyqwt5.
But importing pyqwt5 for only just function seems overkill to me and the
image data follows a path from C++ --> Python --> C++ --> Python
Now i want my boost wrapper to return a QImage directly that is usable
with pyqt4. But i have no idea how i can return arbitrary objects with
boost. For the numpy array i used the num_utils and can then do
something like this:
return boost::python::extract<boost::python::numeric::array>(obj);
I tried to look at the code from pyqwt5 but at some point they use SIP
magic.
I'm kind of lost. Is this even possible with boost::python?
Best regards,
Jörg :-)
--
Jörg Kurlbaum (jkur at informatik.uni-bremen.de) Cartesium 00.056
GPG-ID: CAC40EA9 Enrique Schmidt Str. 5
T: 0421/218-64201 Universität Bremen
More information about the Cplusplus-sig
mailing list