Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Grabbing a random frame from a webcam with GStreamer in Python

I'm trying to write a program to control a robot by interpreting frames from a webcam and happened upon GStreamer.

I've been able to stream video in Python from the webcam with GStreamer with help from this page: http://www.ndeschildre.net/2008/04/04/python-power/

However, I don't know how to ask for a single RGB-encoded frame from the Pipeline, and while I've managed to find and read some of the documentation, I've found no obvious answer.

Does anyone have any ideas?

EDIT: I've attempted to use OpenCV to solve this problem first, but the buffer isn't staying put or something, and is causing successive images to not start at the top left corner of the buffer. (operating system is Ubuntu Linux)

like image 257
Raceimaztion Avatar asked Dec 21 '25 00:12

Raceimaztion


2 Answers

Look at the source code for cheese, the Gnome photobooth application.

You could also try the usersink.

like image 90
joeforker Avatar answered Dec 22 '25 17:12

joeforker


I've heard of some success with OpenCV's Python bindings. Here is one of those successes: http://blog.jozilla.net/2008/06/27/fun-with-python-opencv-and-face-detection/

like image 27
timv Avatar answered Dec 22 '25 17:12

timv