Hi all!
I hope that somebody can help because I am stuck on a project!
From Python, I need to call some C++ code that modifies an image and returns it. I am able to write the wrapper so that it converts correctly from Python to C++ but I am not able to do the opposite. I don't know much about Python so the mistake might be really stupid.
The relevant part of the wrapper:
so now, from Python, I call:Code:static PyObject* FunctionName(PyObject* self, PyObject* args){ CFbsBitmap *image; PyObject *input; if (!PyArg_ParseTuple(args, "O", &input1)) { return Py_BuildValue("s", "Cannot parse arguments."); } // Check if the call was made on a python object if (!PyCObject_Check(input1) || !PyCObject_Check(input2)) { return Py_BuildValue("i", -1); } // Turn PyCObject into CFbsBitmap image = (CFbsBitmap *)PyCObject_AsVoidPtr(input); //here call some C++ code on image // From here on I am not sure it is correct PyObject *pyObj; pyObj = (PyObject *)PyCObject_FromVoidPtr(image, NULL); return pyObj;
Everything works but now imOut is a PyCObject at 0x.... and I don't know how to convert it back to an image.Code:imOut = wrapper.FunctionName(PyImage._bitmapapi())
Any idea? Even the reference to some useful documentation would be helpful: where I looked there wasn't even a mention for _bitmapapi().
PLEASE!!
Thanks,
Pdcb
PS: sorry for the double posting but I hit post by mistake and I wasn't able to delete the post

Reply With Quote


