简体   繁体   English

网络摄像头无法在Ubuntu 12.04上使用python接口连接OpenCV 2.4

[英]Webcam not working with python interface to OpenCV 2.4 on Ubuntu 12.04

Yesterday I installed Ubuntu 12.04 on a brand new HD, ran all the updates ( sudo apt-get updates && sudo apt-get upgrade ), installed a bunch of stuff from apt ( sudo apt-get install git libsdl1.2-dev python-dev python-setuptools python-numpy python-scipy python-nose ipython python-pygame libcv-dev python-opencv ), then installed openCV 2.4 from source (following the instructions here ). 昨天我在全新HD上安装了Ubuntu 12.04,运行了所有更新( sudo apt-get updates && sudo apt-get upgrade ),从apt中安装了一堆东西( sudo apt-get install git libsdl1.2-dev python-dev python-setuptools python-numpy python-scipy python-nose ipython python-pygame libcv-dev python-opencv ),然后从源代码安装openCV 2.4(按照此处的说明进行操作)。 However, when I attempt to use the python interface to capture an image from a webcam (I've tried both c910 and c920 models from logitech), I get "None" as the result: 但是,当我尝试使用python接口从网络摄像头捕获图像时(我尝试过Logitech的c910和c920模型),结果是“无”:

>>> import cv
>>> webcam_stream = cv.CaptureFromCAM(0) #I've also tried cv.CaptureFromCAM(-1) with the same results
>>> this_image = cv.QueryFrame(webcam_stream)
>>> print(this_image)
None

Any ideas why this is failing? 有什么想法为什么会失败吗? Webcam apps available from the Ubuntu software center (like Cheese) seem to grab images from the cameras just fine, so I'm very confused! Ubuntu软件中心提供的网络摄像头应用程序(例如Cheese)似乎可以从摄像头中捕获图像,所以我很困惑!

今天遇到了完全相同的问题,不知道为什么网络摄像头停止使用openCV,要对其进行修复,我进入了OpenCV源代码构建目录并运行了sudo make install,该方法起作用了-安装方法链接的答案毫无意义且具有误导性

You need to install v4l-utils to set up the webcam. 您需要安装v4l-utils才能设置网络摄像头。 Here is a detailed step by step information about installing OpenCV 2.4 from source. 这是有关从源代码安装OpenCV 2.4的详细分步信息。 http://jayrambhia.com/blog/install-opencv-2-4-in-ubuntu-12-04-precise-pangolin/ http://jayrambhia.com/blog/install-opencv-2-4-in-ubuntu-12-04-precise-pangolin/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM