#include <image_v4linput.h>
Inheritance diagram for mimas::image_v4linput< T >:
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 |
The class has been successfully tested for colour-images (i.e. T = rgba< unsigned char >) and the following devices:
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; }
Definition at line 36 of file image_v4linput.h.
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) |
mimas::image_v4linput< T >::~image_v4linput | ( | void | ) |
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.
img | Object to store image in. |
Implements mimas::image_input< T >.
int mimas::image_v4linput< T >::getWidth | ( | void | ) | const [inline] |
int mimas::image_v4linput< T >::getHeight | ( | void | ) | const [inline] |
void mimas::image_v4linput< T >::setSensivity | ( | __u16 | brightness, | |
__u16 | hue, | |||
__u16 | colour, | |||
__u16 | contrast | |||
) | throw (mimasexception) |
int mimas::image_v4linput< T >::xioctl | ( | int | request, | |
void * | arg | |||
) | [protected] |
void mimas::image_v4linput< T >::selectPalette | ( | void | ) | throw (mimasexception) [protected] |
std::string mimas::image_v4linput< T >::device [protected] |
Definition at line 54 of file image_v4linput.h.
int mimas::image_v4linput< T >::fd [protected] |
Definition at line 55 of file image_v4linput.h.
void* mimas::image_v4linput< T >::map [protected] |
Definition at line 56 of file image_v4linput.h.
struct video_channel mimas::image_v4linput< T >::chan [protected] |
Definition at line 57 of file image_v4linput.h.
struct video_picture mimas::image_v4linput< T >::pic [protected] |
Definition at line 58 of file image_v4linput.h.
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().
struct video_mbuf mimas::image_v4linput< T >::buf [protected] |
Definition at line 60 of file image_v4linput.h.