简体   繁体   English

无法在Ubuntu上使用OpenCV和Python捕获视频

[英]Failing to capture video using OpenCV and Python on Ubuntu

I'm trying to write a simple python script to capture an image from a webcam using OpenCV. 我正在尝试编写一个简单的python脚本,以使用OpenCV从网络摄像头捕获图像。 This is running on Ubuntu 11.10 32-bit. 它在32位Ubuntu 11.10上运行。

when I run lsusb in the terminal i get: 当我在终端中运行lsusb时,我得到:

Bus 002 Device 002: ID 045e:00f7 Microsoft Corp. LifeCam VX-1000 总线002设备002:ID 045e:00f7 Microsoft Corp.LifeCam VX-1000

Which leads me to believe that the driver for the camera is installed 这使我相信相机的驱动程序已安装

In a python shell I type: capture=cv.CaptureFromCAM(0) # also tried -1, 1, 2, 3 在python shell中,我输入:capture = cv.CaptureFromCAM(0)#还尝试了-1,1,2,3

but capture is always null. 但是捕获始终为空。

I also tried: capture = cv.CreateCameraCapture(0) 我也尝试过:capture = cv.CreateCameraCapture(0)

But i get the same results. 但我得到相同的结果。

Would appreciate any help 希望有帮助

Cheers, 干杯,

Merely probing the driver does not validate that the camera will work. 仅探测驱动程序并不能验证相机是否可以工作。

Here is a ubuntu support page on testing your camera with vlc 这是有关使用vlc测试相机的ubuntu支持页面

Basically you should try something like : 基本上,您应该尝试类似的方法:

$ vlc v4l2:///dev/video0

I don't think this camera is supported by OpenCV. 我认为OpenCV不支持此相机。

OpenCV has a compatibility list , check if yours is there. OpenCV有一个兼容性列表 ,请检查您的兼容性列表

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

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