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

本文是小编为大家收集整理的关于Ubuntu下的网络摄像头(usb)访问的处理/解决方法,可以参考本文帮助大家快速定位并解决问题,中文翻译不准确的可切换到English标签页查看源文。

问题描述

我一直在尝试使用 Python 访问我的网络摄像头,但我失败了
悲惨地.相机在 Ubuntu 下工作正常(使用 camora 和
skype),但我无法让 WebCamSpy 或 libfg 访问我的网络摄像头.

首先我尝试了 webcamspy (http://webcamspy.sourceforge.net/).那个
需要 pySerial 和 pyParallel,以及可选的 pyI2C.跑步
WebCamSpy 结果:

Exception exceptions.AttributeError: "并行实例没有
属性"_fd"""在<绑定方法Parallel.__del__ of
<parallel.parallelppdev.Parallel 实例在 0x83326ac>忽略

这似乎来自导入 I2C.应用程序窗口打开,
但是有一个错误信息:

找不到视频源

接下来我尝试了 libfg (http://antonym.org/libfg).我建造了它,制造了它
Python绑定并安装它.不幸的是:

>>>导入 fg
grabber = fg.Grabber()
结果:

fg_open(): 打开视频设备失败: 没有那个文件或目录

由于相机在 Ubuntu 本身中运行良好,我的猜测是
问题出在 python 库上(或者更可能的是,我对
的使用他们).这里有没有人成功访问他们的
使用Python在Linux上的网络摄像头?否则我必须住在 Windows 和
VideoCapture(依赖于 win32 api,因此仅适用于 Windows),
我不想做的事.

感谢您的帮助,
2B

================
我正在使用:
网络摄像头:罗技 QuickCam Pro 400
Ubuntu
Python 2.5

推荐答案

Berco Beute 写道:
我一直在尝试使用 Python 访问我的网络摄像头,但我失败了
悲惨地.相机在 Ubuntu 下工作正常(使用 camora 和
skype),但我无法让 WebCamSpy 或 libfg 访问我的网络摄像头.

首先我尝试了 webcamspy (http://webcamspy.sourceforge.net/).那个
需要 pySerial 和 pyParallel,以及可选的 pyI2C.跑步
WebCamSpy 结果:

Exception exceptions.AttributeError: "并行实例没有
属性"_fd"""在<绑定方法Parallel.__del__ of
<parallel.parallelppdev.Parallel 实例在 0x83326ac>忽略

这似乎来自导入 I2C.应用程序窗口打开,
但是有一个错误信息:

找不到视频源

接下来我尝试了 libfg (http://antonym.org/libfg).我建造了它,制造了它
Python绑定并安装它.不幸的是:
>>>>导入 fg
grabber = fg.Grabber()

结果:

fg_open(): 打开视频设备失败: 没有那个文件或目录

由于相机在 Ubuntu 本身中运行良好,我的猜测是
问题出在 python 库上(或者更可能的是,我对
的使用他们).这里有没有人成功访问他们的
使用Python在Linux上的网络摄像头?否则我必须住在 Windows 和
VideoCapture(依赖于 win32 api,因此仅适用于 Windows),
我宁愿不做的事情.
自从我这样做以来已经 * 好多年了 - 所以请谨慎对待.
但是,那时我可以使用 gqcam 访问摄像机.看着
进入源代码发现它所做的只是一些简单的
ioctl-calls 并从/dev/video*-device 读取.

这对我有用...

此外,您可以考虑使用 gstreamer + python 绑定
那.我也成功地使用了它们——如果我记得这段对话
今晚左右,我会把资源发给你.

迪兹

Diez

谢谢,那太好了.

当我在做的时候,我想知道如何显示视频预览.这里是
有人使用 VideoCapture(win32 库)和 PyGame,但我宁愿
使用 GUI 框架并直接预览/捕获视频.

2B

自从我这样做以来已经 * 好多年了 - 所以请谨慎对待.
但是,那时我可以使用 gqcam 访问摄像机.看着
进入源代码发现它所做的只是一些简单的
ioctl-calls 并从/dev/video*-device 读取.

这对我有用...

此外,您可以考虑使用 gstreamer + python 绑定
那.我也成功地使用了它们——如果我记得这段对话
今晚左右,我会把资源发给你.

迪兹

迪兹

Berco Beute 写道:
谢谢,那太好了.

当我在做的时候,我想知道如何显示视频预览.这里是
有人使用 VideoCapture(win32 库)和 PyGame,但我宁愿
使用 GUI 框架并直接预览/捕获视频.
gstreamer 有一个预览窗口.

迪兹

本文地址:https://www.itbaoku.cn/post/1050816.html

问题描述

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()
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.

Thanks for any help,
2B

===============
I am uUsing:
WebCam: Logitech QuickCam Pro 400
Ubuntu
Python 2.5

推荐答案

Berco Beute wrote:
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()

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.
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

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

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 wrote:
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 has a preview window.

Diez