opencv - 无法从树莓派上的相机捕获帧 [英] opencv - unable to capture frame from camera on raspberry pi

查看:77
本文介绍了opencv - 无法从树莓派上的相机捕获帧的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的pi相机已连接并启用,raspistill拍照成功.在 python 中, cv2.VideoCapture(-1).read() 总是返回 (False, None).我被难住了.

My pi camera is connected and enabled, raspistill takes photos successfully. In python, cv2.VideoCapture(-1).read() always returns (False, None). I'm stumped.

推荐答案

OpenCV 依赖于 V4L2 (Video for Linux) 模块,因此尝试在文件底部添加以下行 /etc/modules 并重启你的树莓派.

OpenCV relies on the V4L2 (Video for Linux) module, so try adding the following line at the bottom of the file /etc/modules and rebooting your Raspberry Pi.

bcm2835-v4l2

我的现在看起来像这样整体:

Mine now looks like this in toto:

# /etc/modules: kernel modules to load at boot time.
#
# This file contains the names of kernel modules that should be loaded
# at boot time, one per line. Lines beginning with "#" are ignored.

bcm2835-v4l2

这可确保在所有后续重新启动时加载 Broadcom Video For Linux 2 (v4l2) 驱动程序.

This ensures that the Broadcom Video For Linux 2 (v4l2) driver is loaded at all subsequent reboots.

这篇关于opencv - 无法从树莓派上的相机捕获帧的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆