webcam (usb) access under Ubuntu
Diez B. Roggisch
deets at nospam.web.de
Tue Apr 15 08:32:37 EDT 2008
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
More information about the Python-list
mailing list