gpt4 book ai didi

python - OpenCV 2.0 : where is adaptors. py?

转载 作者:太空宇宙 更新时间:2023-11-03 21:09:38 25 4
gpt4 key购买 nike

我正在尝试在 Mac 上的 python 中使用 OpenCV 2.0。我需要能够在 OpenCV IPL 格式和 PIL Python 图像库格式之间进行转换。

此问题的最佳答案 How do I create an OpenCV image from a PIL image?建议使用名为“opencv.adaptors”的模块进行转换,但由于我使用的是 OpenCV 2.0,因此我没有名为“opencv”的模块(我有“cv”),而且似乎不存在任何“cv.适配器”。

最佳答案

您链接的答案已经过时了。适配器现在消失的原因是因为不再需要它。 OpenCV 图像的 Python 绑定(bind)现在支持数组接口(interface)(__array_struct____array_interface__),因此您应该能够使用 Image.fromarray 方法PIL 走一条路,cv.fromarraycv.SetData 走另一条路。

关于python - OpenCV 2.0 : where is adaptors. py?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8584674/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com