Programming the camera: Difference between revisions

From OLPC
Jump to navigation Jump to search
(Initial stub for how to program the camera)
 
(Getting started with the camera (plus inprogress notes))
Line 1: Line 1:
This page explores how to interact with the laptop's built-in video camera.
This page explores how to interact with the laptop's built-in video camera.

== Getting started ==

First, let's see the quickest way we can capture a still image from the camera--using a GStreamer command-line tool:

gst-launch-0.10 v4l2src ! ffmpegcolorspace ! pngenc ! filesink location=foo.png

You'll need to run the above command in either a terminal in the developer console or one of the virtual terminals (e.g. <tt>ctrl-alt-f1</tt>). Note this means you don't need the Sugar GUI to be running to access the camera.


===== Camera =====
* Have to script v4l2 via gstreamer to capture a single frame from the camera. See sugar/shell/intro/glive.py for sample code
* Try this from the command line: <tt>gst-launch-0.10 v4l2src ! ffmpegcolorspace ! pngenc ! filesink location=foo.png</tt>

===== Camera-as-video-camera (v4l2?) =====
* Is a regular v4l2 device available via gstreamer (gst module)
* Try this from a terminal in the developer console: <tt>gst-launch-0.10 v4l2src ! ximagesink</tt> (The image will appear <i>behind </i>the developer console window so you'll need to move the window aside.)




[[Category:Developers]]
[[Category:Developers]]

Revision as of 15:10, 13 April 2007

This page explores how to interact with the laptop's built-in video camera.

Getting started

First, let's see the quickest way we can capture a still image from the camera--using a GStreamer command-line tool:

 gst-launch-0.10 v4l2src ! ffmpegcolorspace ! pngenc ! filesink location=foo.png

You'll need to run the above command in either a terminal in the developer console or one of the virtual terminals (e.g. ctrl-alt-f1). Note this means you don't need the Sugar GUI to be running to access the camera.


Camera
  • Have to script v4l2 via gstreamer to capture a single frame from the camera. See sugar/shell/intro/glive.py for sample code
  • Try this from the command line: gst-launch-0.10 v4l2src ! ffmpegcolorspace ! pngenc ! filesink location=foo.png
Camera-as-video-camera (v4l2?)
  • Is a regular v4l2 device available via gstreamer (gst module)
  • Try this from a terminal in the developer console: gst-launch-0.10 v4l2src ! ximagesink (The image will appear behind the developer console window so you'll need to move the window aside.)