Assigning pointer to PySwigObject in Boost

willievdm at gmail.com willievdm at gmail.com
Mon Feb 5 03:11:21 EST 2007


Hi all

I'm working with Boost.Python at the moment and have to do the
following:
-Using Boost, assign a char* in C++ to a PySwigObject (SWIG exposed
object) of type uchar*, which is received in C++ as a
boost::python::object class.

The uchar* pointer in the PySwigObject points to a buffer containing
image data. All I wish to do is assign a C++ pointer that is also
pointing to a buffer with image data to the PySwigObject pointer and
send it back to Python. The PySwigObject is part of the CvMat class
used with OpenCV for image-processing in Python. It is already wrapped
in SWIG, so I CANNOT change it. I've already been to the python Wiki
that explains how to extract SWIG exposed pointers in python (http://
wiki.python.org/moin/boost.python/HowTo), but this does NOT tell me
how to do the opposite: assigning C++ pointers to SWIG exposed
pointers with Boost.

Any tips or tricks to get this working?

Thanks

Will




More information about the Python-list mailing list