Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在尝试制作一个包装器以在 Python 中使用 C++ 类,但我找不到一种方法来传递我已经加载到我的 Python 程序中的这个图像。
我可以将路径传递给图像并再次将其加载到 C++ 函数中,但这不是我想要的解决方案。
“这不是我想要的解决方案。”
为什么不?
无论如何,C++ 不会理解 Image 对象。它更有可能只需要原始图像数据。您可以通过在图像对象上调用 tostring() 方法、传入编码器和参数来获得它。
但是直接读取文件会快很多。
http://effbot.org/imagingbook/image.htm