【发布时间】:2017-07-08 14:56:44
【问题描述】:
我通过 ssh 连接到远程系统,并尝试在 Python 中使用 OpenCV VideoCapture 读取帧。相同的代码在使用 Python 2.7 时成功,在使用 Python 3.5 时失败:
import cv2
cap = cv2.VideoCapture(0)
Python2.7:
print cap.isOpened() # prints True, further read() calls also return True
Python3.5:
print (cap.isOpened()) # prints False, and so are cap.open(), and of course cap.read().
什么可能导致这种行为?
谢谢!
【问题讨论】:
-
每个 Python 版本都有自己的 openCV 二进制文件副本,也许这两个版本是用不同的选项构建的?
标签: python-2.7 opencv python-3.5