Main Page | Namespace List | Class Hierarchy | Class List | Directories | File List | Class Members | File Members

Dc1394 Class Reference

Dc1394 is a class which encapsulates the libdc1394 camera handling routines. More...

#include <Dc1394.h>

Inheritance diagram for Dc1394:

LBuffer List of all members.

Public Member Functions

 Dc1394 (int W=320, int H=240)
 Initializes the camera capture.
 ~Dc1394 ()

Detailed Description

Dc1394 is a class which encapsulates the libdc1394 camera handling routines.

Dc1394 is a class which encapsulates the libdc1394 camera handling routines It is a "Thread" class (commonc++), which means that after it is constructed, it's start() method must be called which starts the thread running. While dc1394 is running, it is continually grabbing images from a camera, and placing them in its lockable buffer. When an image is recieved from the camera, Dc1394 is locked, updated, and unlocked. If another thread wants to use this image, it should lock, use( ptr() ), then unlock.

See the LBuffer class for more information.

Typical usage:


  //construct a 1394 capture object, using 320x240 resolution.
  // options are 640x480, 320x240, 160x120
  Dc1394 CamSource(320,240);

  // make a texture
  glGenTextures(1, &tex);              // texture 
  glTexEnvi( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE,  GL_REPLACE );
  glBindTexture(GL_TEXTURE_RECTANGLE_NV, tex);
  glTexImage2D(GL_TEXTURE_RECTANGLE_NV, 0, GL_RGBA, width,height, 0,
                GL_RGB, GL_UNSIGNED_BYTE,NULL );
  
  //start the camera capture
  CamSource.start();

   // rendering loop
   while(1) {

        //wait for a new frame to be captured.
        // this can be removed if you dont mind re-using a previous frame.
        CamSource.wait();
        //lock the image data so it is not updated while we are capturing.
        CamSource.lock();

        glBindTexture(GL_TEXTURE_RECTANGLE_NV, tex);
        glTexSubImage2D(GL_TEXTURE_RECTANGLE_NV, 0, 0,0, width,height,
                         GL_RGB, GL_UNSIGNED_BYTE,CamSource.ptr());

        //free the image data so it can be updated again.
        CamSource.unlock();

        //use the image...
   }
 


Constructor & Destructor Documentation

Dc1394::Dc1394 int  W = 320,
int  H = 240
 

Initializes the camera capture.

The lockable LBuffer which holds the camera image data. When accessing it, remember to: lock(), use(), unlock()

Parameters:
W  desired capture width, either 320 or 640
H  desired capture height, either 240 or 480

Dc1394::~Dc1394  ) 
 


The documentation for this class was generated from the following file:
Generated on Mon Jun 27 14:54:29 2005 for OPENVIDIA by  doxygen 1.4.0