Any way to pass an image loaded from PIL to a C++ function using Boost.Python?
I'm trying to make a wrapper to use a C++ Class in Python but I can't fin开发者_开发知识库d a way to pass this image I already loaded in my Python program.
I could pass the path to the image and load it inside the C++ function again but that's not the solution I want.
"that's not the solution I want."
Why not?
Anyway, the C++ will not understand the Image object. It is more likely that it does want just the raw image data. You can get that by calling the tostring() method on the image object, passing in a encoder and parameters.
But reading the file directly will be much faster.
http://effbot.org/imagingbook/image.htm
精彩评论