Instalando GSVideo en Processing bajo GNU/Linux

Introducción

GSVideo es una librería para Processing desarrollada por Andrés Colubri y basada en GStreamer.  Esta librería permite reproducir videos (incluyendo a la cámara web), capturar imágenes y realizar grabaciones.  Su API sigue los lineamientos de la librería nativa (processing.video.*) la cual por estar basada en Apple QuickTime no se encuentra disponible en GNU/Linux.

Instalación

La instalación de la distribución binaria es muy simple y se describe a continuación.

Descargar la versión mas reciente de la librería desde la siguiente ubicación.

http://sourceforge.net/projects/gsvideo/files/gsvideo/

En este caso se obtuvo el archivo GSVideo-1.0.0-linux.zip.

Descomprimir el paqute con la distribución de la librería.

$ unzip GSVideo-1.0.0-linux.zip

Reubicar la librería en el lugar apropiado del sketchbook.

$ mv GSVideo ~/sketchbook/libraries/

Dependencias

Como se mencionó inicialmente esta librería depende de GStreamer para su funcionamiento.  Utilizando GNU/Linux Mint 12 no fue necesario instalar ningún paquete adicional para trabajar con la librería.

$ sudo aptitude search gstream | grep "^i"

i   bluez-gstreamer                 – Bluetooth GStreamer support               
i   gir1.2-gstreamer-0.10           – Description: GObject introspection data fo
i   gstreamer0.10-alsa              – GStreamer plugin for ALSA                 
i   gstreamer0.10-ffmpeg            – FFmpeg plugin for GStreamer               
i   gstreamer0.10-fluendo-mp3       – Fluendo mp3 decoder GStreamer plugin      
i   gstreamer0.10-gconf             – GStreamer plugin for getting the sink/sour
i   gstreamer0.10-nice              – ICE library (GStreamer plugin)            
i   gstreamer0.10-pitfdll           – GStreamer plugin for using MS Windows bina
i   gstreamer0.10-plugins-bad       – GStreamer plugins from the "bad" set      
i   gstreamer0.10-plugins-bad-multi – GStreamer plugins from the "bad" set (Mult
i   gstreamer0.10-plugins-base      – GStreamer plugins from the "base" set     
i   gstreamer0.10-plugins-base-apps – GStreamer helper programs from the "base"
i   gstreamer0.10-plugins-good      – GStreamer plugins from the "good" set     
i   gstreamer0.10-plugins-ugly      – GStreamer plugins from the "ugly" set     
i   gstreamer0.10-pulseaudio        – GStreamer plugin for PulseAudio           
i   gstreamer0.10-tools             – Tools for use with GStreamer              
i   gstreamer0.10-x                 – GStreamer plugins for X11 and Pango       
i   libgstreamer-plugins-base0.10-0 – GStreamer libraries from the "base" set   
i   libgstreamer0.10-0              – Core GStreamer libraries and elements

Demostración

El siguiente código se basa en el ejemplo GettingStartedCaptureLinux incluído en la distribución de la librería.

// Import the GSVideo library classes
import codeanticode.gsvideo.*;
// GSVideo capture object reference
GSCapture cam;
void setup()
{
  size(640, 480);
  // Create the GSVideo capture object with the capture's resolution
  cam = new GSCapture(this, 640, 480);
  // Begin the video capture process
  cam.start();
  // Retrieve the video resolutions available
  println("Supported video resolutions: ");
  int[][] res = cam.resolutions();
  for (int i = 0; i < res.length; i++)
  {
    println(res[i][0] + "x" + res[i][1]);
  }
  println();
  // Retrieve the video framerates available
  println("Supported video framerates: ");
  String[] fps = cam.framerates();
  for (int i = 0; i < fps.length; i++)
  {
    println(fps[i]);
  }
}
void stop()
{
  // Stop the GSVideo webcam capture
  cam.stop();
  // Stop the sketch
  this.stop();
}
void draw()
{
  // Check if there is a capture device available
  if (cam.available() == true)
  {
    // In this case, read an image from it
    cam.read();
    // Display it on the window
    image(cam, 0, 0);
  }
}

Enlaces

Artículos relacionados:

  1. Instalación de la librería de OpenCV en Processing bajo GNU/Linux Mint 12
  2. Construcción de la librería Simple-OpenNI para Processing bajo Ubuntu de 32 bits
  3. Instalando Google Chrome en GNU/Linux Ubuntu 11.04 (y otros)
  4. Instalando GNOME3 en GNU/Linux Ubuntu 10.10
  5. Instalando GNOME3 en GNU/Linux Ubuntu 11.04

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>