我只是尝试使用以下命令在Raspberry Pi上使用opencv访问USB网络摄像头:
import cv2, time
cap = cv2.VideoCapture(0)
time.sleep(3)
while True:
time.sleep(0.1)
ret, frame = cap.read()
if ret:
cv2.imshow('frame', frame)
if cv2.waitKey(1) & 0xFF == ord('q'):
break
cap.release()
cv2.destroyAllWindows()
它只是生成了永无止境的错误消息流:VIDIOC_QBUF:无效参数
当我插入Logitech网络摄像头C260或Logitech网络摄像头C910时,摄像头指示灯会亮起,并会创建/ dev / video0文件。还尝试了两个不同的RPi 4。
我的个人形象构建:Raspberry Pi 4,Raspbian Buster v10,Python 3.7.3,OpenCV 4.1.0]
PyImageSearch提供的图像构建:树莓派4Raspbian Buster v10,Python 3.7.3,OpenCV 4.1.1
其他人遇到此问题https://raspberrypi.stackexchange.com/questions/105358/raspberry-pi4-error-while-using-2-usb-cameras-vidioc-qbuf-invalid-argument,但我尚未找到任何解决方案。
任何帮助将不胜感激。
我有同样的问题,该问题已通过安装uv4l-uvc修复。
sudo apt install uv4l uv4l-uvc