开发者

Any way to pass an image loaded from PIL to a C++ function using Boost.Python?

开发者 https://www.devze.com 2023-01-31 13:31 出处:网络
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'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

0

精彩评论

暂无评论...
验证码 换一张
取 消