简体   繁体   中英

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 find 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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM