mimas::image_v4linput< T > Class Template Reference
[Image Input]

Class for reading images from a video4linux device. More...

#include <image_v4linput.h>

Inheritance diagram for mimas::image_v4linput< T >:

Inheritance graph
[legend]
Collaboration diagram for mimas::image_v4linput< T >:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 image_v4linput (const std::string &_device, int channel=0, int width=-1, int height=-1, int channel_norm=VIDEO_MODE_PAL) throw (mimasexception)
 ~image_v4linput (void)
virtual void read (image< T > &img) throw (mimasexception)
 Read image from arbitrary source.
int getWidth (void) const
int getHeight (void) const
void setSensivity (__u16 brightness, __u16 hue, __u16 colour, __u16 contrast) throw (mimasexception)

Protected Member Functions

int xioctl (int request, void *arg)
void selectPalette (void) throw (mimasexception)

Protected Attributes

std::string device
int fd
void * map
video_channel chan
video_picture pic
video_window win
video_mbuf buf

Detailed Description

template<typename T>
class mimas::image_v4linput< T >

Class for reading images from a video4linux device.

The class has been successfully tested for colour-images (i.e. T = rgba< unsigned char >) and the following devices:

See V4L-API for more information about video4linux.

Here is a minimal example program on how to grab and display images with this class:

#include <fstream>
#include <GL/glut.h>
#include "image_v4linput.h"
#include "image_mesaoutput.h"

using namespace std;
using namespace mimas;

// Minimal program for accessing video data using libxine.
int main( int argc, char *argv[] )
{
  int retVal = 0;

  try {

    // Initialise GLUT.
    glutInit( &argc, argv );

    // Open X11 display.
    x11_display display;

    // Open V4L device.
    image_v4linput< rgba< unsigned char > > input( "/dev/video0" );

    // Open window.
    image_mesaoutput< rgba< unsigned char > > window( &display );

    // Allocate image.
    image< rgba< unsigned char > > img;

    // Loop for images.
    while ( input ) {
      
      // Grab image.
      input >> img;

      // Display image.
      window << img;
      
    };

  } catch ( exception &e ) {

    cerr << e.what() << endl;
    retVal = 1;

  };
  
  return retVal;
}

Author:
Bala Amavasai (bala@amavasai.org)

Jan Wedekind (jan at wedesoft.de)

Date:
Wed Mar 2 14:58:34 GMT 2005

Definition at line 36 of file image_v4linput.h.


Constructor & Destructor Documentation

template<typename T>
mimas::image_v4linput< T >::image_v4linput ( const std::string &  _device,
int  channel = 0,
int  width = -1,
int  height = -1,
int  channel_norm = VIDEO_MODE_PAL 
) throw (mimasexception)

template<typename T>
mimas::image_v4linput< T >::~image_v4linput ( void   ) 


Member Function Documentation

template<typename T>
virtual void mimas::image_v4linput< T >::read ( image< T > &  img  )  throw (mimasexception) [virtual]

Read image from arbitrary source.

This function is virtual and has to be implemented by the inheriting class.

Parameters:
img Object to store image in.

Implements mimas::image_input< T >.

template<typename T>
int mimas::image_v4linput< T >::getWidth ( void   )  const [inline]

Definition at line 45 of file image_v4linput.h.

References mimas::image_v4linput< T >::win.

template<typename T>
int mimas::image_v4linput< T >::getHeight ( void   )  const [inline]

Definition at line 46 of file image_v4linput.h.

References mimas::image_v4linput< T >::win.

template<typename T>
void mimas::image_v4linput< T >::setSensivity ( __u16  brightness,
__u16  hue,
__u16  colour,
__u16  contrast 
) throw (mimasexception)

template<typename T>
int mimas::image_v4linput< T >::xioctl ( int  request,
void *  arg 
) [protected]

template<typename T>
void mimas::image_v4linput< T >::selectPalette ( void   )  throw (mimasexception) [protected]


Member Data Documentation

template<typename T>
std::string mimas::image_v4linput< T >::device [protected]

Definition at line 54 of file image_v4linput.h.

template<typename T>
int mimas::image_v4linput< T >::fd [protected]

Definition at line 55 of file image_v4linput.h.

template<typename T>
void* mimas::image_v4linput< T >::map [protected]

Definition at line 56 of file image_v4linput.h.

template<typename T>
struct video_channel mimas::image_v4linput< T >::chan [protected]

Definition at line 57 of file image_v4linput.h.

template<typename T>
struct video_picture mimas::image_v4linput< T >::pic [protected]

Definition at line 58 of file image_v4linput.h.

template<typename T>
struct video_window mimas::image_v4linput< T >::win [protected]

Definition at line 59 of file image_v4linput.h.

Referenced by mimas::image_v4linput< T >::getHeight(), and mimas::image_v4linput< T >::getWidth().

template<typename T>
struct video_mbuf mimas::image_v4linput< T >::buf [protected]

Definition at line 60 of file image_v4linput.h.


The documentation for this class was generated from the following file:
[GNU/Linux] [Qt] [Mesa] [STL] [Lapack] [Boost] [Magick++] [Xalan-C and Xerces-C] [doxygen] [graphviz] [FFTW] [popt] [xine] [Gnuplot] [gnu-arch] [gcc] [gstreamer] [autoconf/automake/make] [freshmeat.net] [opensource.org] [sourceforge.net] [MMVL]
mimas 2.1 - Copyright Mon Oct 30 11:31:35 2006, Bala Amavasai, Stuart Meikle, Arul Selvan, Fabio Caparrelli, Jan Wedekind, Manuel Boissenin, ...