本文介绍了VideoCapture.open(0) 无法识别 pi cam的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用 Raspberry Pi 2B 已经有一段时间了.使用 raspistill 测试 Pi cam 效果很好,但尝试使用 OpenCV 函数,例如 VideoCapture.open(); 将不起作用.使用 USB 摄像头尝试相同的命令效果很好.我尝试了不同的索引作为输入,但对 pi cam 没有任何作用.我在这里错过了什么?

I have been working with my Raspberry Pi 2B for a while now. Testing the Pi cam using raspistill works great but trying to use OpenCV functions such as VideoCapture.open(); won't work. trying the same command with a USB camera works just fine. I tried different indexes as inputs but nothing works for the pi cam. What am I missing here?

推荐答案

sudo modprobe bcm2835-v4l2

将自动为opencv启用"相机.

will "enable" the camera for opencv automatically.

确保从树莓派配置(gui 或 raspi-config)中启用了摄像头.以上加载了必要的驱动程序来自动处理所有事情,即为树莓派相机加载适当的接口(v4l2 驱动程序).

make sure you have the camera enabled from the raspberry config, either gui or raspi-config. the above loads the necessary drivers to handle everything automatically, i.e. loads the appropriate interfaces (v4l2 drivers) for the raspberry camera.

在 raspbian jessie 上开箱即用.其他版本可能默认包含驱动程序,但下面的链接包含有关在最坏情况下编译驱动程序的信息.所以你应该能够让它与 pidora 一起工作.

works out of the box on raspbian jessie. other releases might include the drivers by default, but the link below contains info on compiling the drivers in your worst case. so you should be able to get this to work with pidora as well.

更多信息:https://www.raspberrypi.org/forums/viewtopic.php?f=43&t=62364

这篇关于VideoCapture.open(0) 无法识别 pi cam的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

05-17 23:59