【发布时间】:2019-06-13 12:24:58
【问题描述】:
我使用从 opencv 网站复制的以下代码:
import cv2
cap = cv2.VideoCapture(0)
while(True):
# Capture frame-by-frame
ret, frame = cap.read()
cv2.imshow('frame',frame)
if cv2.waitKey(1) & 0xFF == ord('q'):
break
cap.release()
cv2.destroyAllWindows()
但是图像是黑色的,带有一些白噪声:
我很确定问题不是来自我的网络摄像头设备,因为我在 Windows 10 中使用“相机”APP,图片可以很好地显示。
以下是我的python环境:
Python : 3.7.1
OpenCV : 4.1.0.25 (also tried 3.4.5.20)
OS : windows 10
Webcam : Logitech C525
--------------更新------ --------------
我使用 anaconda spyder 运行相同的代码,它运行良好!
问题只有在我使用 jupyter notebook 时才会出现,有什么解决办法吗?
【问题讨论】:
标签: python opencv jupyter-notebook ipython webcam