我通过opencv拍了一张图片,检查我是否有网络摄像头问题,但网络摄像头正常工作。现在在下面提到的代码中,只有else语句正在执行,而frame始终没有。
video = cv2.VideoCapture(0)
if video.isOpened():
while True:
check, frame = video.read()
if frame != None:
cv2.imshow("Color Frame", frame)
key = cv2.waitKey(50)
if key == ord("q"):
break
else:
print("Frame not available")
print(video.isOpened())
答案 0 :(得分:0)
在Raspberry Pi 3中,我必须执行以下操作才能使其正常工作:
$ sudo modprobe bcm2835-v4l2
答案 1 :(得分:0)
cv2.Videocapture.read()返回false,无,解决方案运行: conda安装-c conda-forge ffmpeg conda install -c conda-forge opencv