views:

75

answers:

5

I want to write an application to video capture from web-cams in linux. Is there a python library to do that?

+1  A: 

You could look into WebCamsPy, which appears to do what you are asking.

Also, see a related question, which asks more generally for windows and Linux but might still help you.

Justin L.
I couldn't find a linux version for WebCams.Py
lamirap
+1  A: 

You should look at Gstreamer and its Python bindings. Here http://pygstdocs.berlios.de/pygst-tutorial/webcam-viewer.html is some sample code to display video from a webcam. To record the video you would have to change the pipeline definition from autovideosink to an encoder and filesink.

Jörn Horstmann
A: 

If you have a favorite video capture C library, you can probably write a simple facade to it using the ctypes module.

Paul McGuire
+1  A: 

OpenCV is the easiest thing I've seen. Take a look at this post: http://www.jperla.com/blog/2007/09/26/capturing-frames-from-a-webcam-on-linux/

You can $ sudo apt-get install python-opencv (I believe), as well as pygame and PIL if you haven't already installed them. Once you have those libraries you can start viewing/saving images - technically if you just want to capture you don't need to use pygame, but it does allow you to also view the images. Technically speaking, the "meat" of the work is done with PIL and opencv, so you can use any type of graphical framework (gtk, tk, wx, qt, etc) that you're familiar with.

I've been trying to do something like this with mine, and I've been getting a crash course in PIL, and it's actually a pretty easy library to use, though I think I'll really need to include numpy for processing in that mix...

Anyway, opencv+PIL == super easy.

Wayne Werner
A: 

there is a lib called open-cv. Try that. It has a lot of features for handling images as well.

Mahesh M