在Ubuntu下访问网络摄像头(usb) [英] webcam (usb) access under Ubuntu

查看:959
本文介绍了在Ubuntu下访问网络摄像头(usb)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在尝试使用Python访问我的网络摄像头,但我很失败

。相机在Ubuntu下运行正常(使用camora和

skype),但我无法通过WebCamSpy或libfg访问我的网络摄像头。


首先我尝试过webcamspy( http://webcamspy.sourceforge.net/)

需要pySerial和pyParallel,以及可选的pyI2C。运行

WebCamSpy导致:


异常exception.AttributeError:并行实例没有

属性''_ fd'' " in< bound方法Parallel .__ del__ of

< parallel.parallelppdev.Parallel instance at 0x83326ac>忽略


这似乎来自导入I2C。应用程序窗口打开,

但是有一条错误消息:


没有视频源发现


接下来我尝试了libfg( http://antonym.org/libfg) 。我构建它,制作了

Python绑定并安装它。遗憾的是:

I''ve been trying to access my webcam using Python, but I failed
miserably. The camera works fine under Ubuntu (using camora and
skype), but I am unable to get WebCamSpy or libfg to access my webcam.

First I tried webcamspy (http://webcamspy.sourceforge.net/). That
requires pySerial and pyParallel, and optionally pyI2C. Runing
WebCamSpy results in:

Exception exceptions.AttributeError: "Parallel instance has no
attribute ''_fd''" in <bound method Parallel.__del__ of
<parallel.parallelppdev.Parallel instance at 0x83326ac>ignored

This seems to come from importing I2C. The application window opens,
but there''s an error message:

NO VIDEO SOURCE FOUND

Next I tried libfg (http://antonym.org/libfg). I built it, made the
Python bindings and installed it. Unfortunately the following:


>>> import fg
grabber = fg.Grabber()
>>>import fg
grabber = fg.Grabber()



结果为:


fg_open():打开视频设备失败:没有这样的文件或目录


由于相机在Ubuntu本身工作正常,我的猜测是

问题与python库有关(甚至是更有可能,我使用

他们)。这里有没有人使用Python在linux上访问他们的

网络摄像头?否则我必须驻留在Windows和

VideoCapture(它依赖于win32 api,因此仅限Windows),

我不想做的事情。


感谢您的帮助,

2B


============= ==

我在使用:

WebCam:Logitech QuickCam Pro 400

Ubuntu

Python 2.5

推荐答案

Berco Beute写道:
Berco Beute wrote:

我一直在尝试使用Python访问我的网络摄像头,但我失败了。

惨不忍睹。相机在Ubuntu下运行正常(使用camora和

skype),但我无法通过WebCamSpy或libfg访问我的网络摄像头。


首先我尝试过webcamspy( http://webcamspy.sourceforge.net/)

需要pySerial和pyParallel,以及可选的pyI2C。运行

WebCamSpy导致:


异常exception.AttributeError:并行实例没有

属性''_ fd'' " in< bound方法Parallel .__ del__ of

< parallel.parallelppdev.Parallel instance at 0x83326ac>忽略


这似乎来自导入I2C。应用程序窗口打开,

但是有一条错误消息:


没有视频源发现


接下来我尝试了libfg( http://antonym.org/libfg) 。我构建它,制作了

Python绑定并安装它。遗憾的是:
I''ve been trying to access my webcam using Python, but I failed
miserably. The camera works fine under Ubuntu (using camora and
skype), but I am unable to get WebCamSpy or libfg to access my webcam.

First I tried webcamspy (http://webcamspy.sourceforge.net/). That
requires pySerial and pyParallel, and optionally pyI2C. Runing
WebCamSpy results in:

Exception exceptions.AttributeError: "Parallel instance has no
attribute ''_fd''" in <bound method Parallel.__del__ of
<parallel.parallelppdev.Parallel instance at 0x83326ac>ignored

This seems to come from importing I2C. The application window opens,
but there''s an error message:

NO VIDEO SOURCE FOUND

Next I tried libfg (http://antonym.org/libfg). I built it, made the
Python bindings and installed it. Unfortunately the following:

>>>> import fg
grabber = fg.Grabber()
>>>>import fg
grabber = fg.Grabber()



导致:


fg_open():打开视频设备失败:没有这样的文件或目录


由于相机在Ubuntu本身运行良好,我的猜测是

问题与python库有关(甚至更有可能,我用的是

他们)。这里有没有人使用Python在linux上访问他们的

网络摄像头?否则我必须驻留在Windows和

VideoCapture(它依赖于win32 api,因此只有Windows),

我不想做的事情。


results in:

fg_open(): open video device failed: No such file or directory

Since the camera works fine in Ubuntu itself my guess is that the
problem is with the python libraries (or even likelier, my usage of
them). Is there anybody here that was successful in accessing their
webcam on linux using Python? Else I have to reside to Windows and
VideoCapture (which relies on the win32 api and thus is Windows-only),
something I''d rather not do.



自从我这样做以来已经*年龄*了 - 所以带上一粒盐。

然而,那时候我是能够使用gqcam访问摄像机。看看

的消息来源显示它所做的只是一些简单的

ioctl-calls和/ dev / video * -device的读取。


这对我有用......


另外,你可以考虑使用gstreamer + python绑定来获得

。我也成功地使用它们 - 如果我记得这次谈话

今晚左右,我会把你的消息来源发给你。


Diez


Diez

It has been *ages* since I did this - so take it with a grain of salt.
However, back then I was able to access a video camera using gqcam. Looking
into the source of that revealed that all it did were some simple
ioctl-calls and reading from a /dev/video*-device.

That did the trick for me...

Additionally, you might consider using gstreamer + the python bindings for
that. I was also successful using them - if I remember this conversation
tonight or so, I''ll send you the sources.

Diez

Diez


谢谢,那会很棒。


我在看的时候我想知道如何显示视频预览。这是'b $ b有人使用VideoCapture(win32 lib)和PyGame,但我宁愿

使用GUI框架并直接预览/捕获视频。 />

2B

Thanks, that would be great.

While I''m at it I wondering how to display a video preview. Here''s
someone using VideoCapture (the win32 lib) and PyGame, but I''d rather
use a GUI framework and preview/capture videos directly.

2B


自从我这样做以来已经*年龄* - 所以带上一粒盐。

然而,当时我可以使用gqcam访问摄像机。看看

的消息来源显示它所做的只是一些简单的

ioctl-calls和/ dev / video * -device的读取。


这对我有用......


另外,你可以考虑使用gstreamer + python绑定来获得

。我也成功地使用它们 - 如果我记得这次谈话

今晚左右,我会把你的消息来源发给你。


Diez


Diez
It has been *ages* since I did this - so take it with a grain of salt.
However, back then I was able to access a video camera using gqcam. Looking
into the source of that revealed that all it did were some simple
ioctl-calls and reading from a /dev/video*-device.

That did the trick for me...

Additionally, you might consider using gstreamer + the python bindings for
that. I was also successful using them - if I remember this conversation
tonight or so, I''ll send you the sources.

Diez

Diez


Berco Beute写道:
Berco Beute wrote:

谢谢,这将是伟大的。


当我在它时,我想知道如何显示视频预览。这是'b $ b有人使用VideoCapture(win32 lib)和PyGame,但我宁愿

使用GUI框架并直接预览/捕获视频。
Thanks, that would be great.

While I''m at it I wondering how to display a video preview. Here''s
someone using VideoCapture (the win32 lib) and PyGame, but I''d rather
use a GUI framework and preview/capture videos directly.



gstreamer有一个预览窗口。


Diez

gstreamer has a preview window.

Diez


这篇关于在Ubuntu下访问网络摄像头(usb)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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