我有Raspberry Pi 3,安装的操作系统是Raspbian Jessie。我试图访问我的USB网络摄像头,因为我没有覆盆子相机模块。这是我的代码:
import cv2
# initialize the camera
cam = cv2.VideoCapture(0)
ret, image = cam.read()
if ret:
cv2.imshow('SnapshotTest',image)
cv2.waitKey(0)
cv2.destroyWindow('SnapshotTest')
cv2.imwrite('/home/pi/book/output/SnapshotTest.jpg',image)
cam.release()
但我唯一能看到的就是灰屏。我必须做什么?谢谢你的帮助
它提出了这个输出:
Xlib:扩展' RANDR'缺少展出":1.0"。