Main Page | Modules | Alphabetical List | Class List | Directories | File List | Class Members | Related Pages

Camera Class Reference

#include <camera.h>

List of all members.


Detailed Description

This class controls a Video4Linux based camera.

Any Video4Linux compatible device can be used with this class. It can handle 8 - 24 bit, greyscale or RGB images at any resolution supported by the camera. This class is for camera control only, and it does not contain image processing routines.

Definition at line 79 of file camera.h.

Public Member Functions

 Camera ()
 Constructor.
 ~Camera ()
 Deconstructor.
int init ()
 Camera initialization.
camParams getCamParams ()
 Get camera parameters.
int setCamParams (camParams params)
 Set camera properties.
picParams getPicParams ()
 Get camera image properties.
int setPicParams (picParams params)
 Set camera image properties.
int capture (struct Frame *f)
 Captures a frame to a buffer.
void stop ()
 Shutdown camera.

Public Attributes

char * dev
 Video device file.


Constructor & Destructor Documentation

Camera::Camera  ) 
 

Constructor.

Initializes class variables.

Definition at line 6 of file camera.cpp.

References dev, and camParams::extended.

Camera::~Camera  ) 
 

Deconstructor.

Called when class instance is destroyed. Ensures that camera was properly shut down.

Definition at line 13 of file camera.cpp.

References stop().


Member Function Documentation

int Camera::capture struct Frame f  ) 
 

Captures a frame to a buffer.

This method captures a frame from the camera to a specified buffer. The formatting is taken care of automatically. At this point other methods can be used to save this image to a file, display it on screen, etc.

Parameters:
f - Frame* struct containing buffer and image statistics.
Returns:
int - Number of bytes saved into buffer.
Todo:
Add support for bpp other than 24 (read from frame or cam??)

Definition at line 285 of file camera.cpp.

References Frame::buffer, camParams::colorType, Frame::convertToRGB(), Frame::height, and Frame::width.

Referenced by Tracker::track().

camParams Camera::getCamParams  ) 
 

Get camera parameters.

This method simply copies the private class variables that contain the camera's parameters. These are collected when the init() method is called to initialize the device. It is NOT possible to write a new camParams struct back to the camera.

Returns:
camParams - Camera capabilities and parameters.

Definition at line 82 of file camera.cpp.

References camParams::colorType, camParams::depth, camParams::extended, camParams::framerate, camParams::height, camParams::led, camParams::maxHeight, camParams::maxWidth, camParams::minHeight, camParams::minWidth, camParams::name, camParams::width, camParams::x, and camParams::y.

Referenced by Tracker::init().

picParams Camera::getPicParams  ) 
 

Get camera image properties.

This method returns the current image settings for the camera. It includes things like color, brightness, etc. that can be adjusted in real time by the user. This method must be called to load in the values of a picParams struct before calling setPicParams().

Returns:
picParams - Camera image properties.

Definition at line 152 of file camera.cpp.

References picParams::brightness, picParams::color, picParams::contrast, picParams::depth, camParams::extended, picParams::gain, picParams::hue, picParams::noise_reduction, picParams::palette, picParams::quality, picParams::wb, and picParams::whiteness.

Referenced by Tracker::init().

int Camera::init  ) 
 

Camera initialization.

Connects to specified camera device and attempts to poll it for its capabilities.

Returns:
int - TRUE if successful, FALSE if error

Definition at line 18 of file camera.cpp.

References dev, camParams::extended, camParams::framerate, and camParams::probe.

Referenced by Tracker::init().

int Camera::setCamParams camParams  params  ) 
 

Set camera properties.

This method is used to send new camera properties to the camera device. This is usually done after calling getCamParams(), reading the parameters, and modifying them as necessary.

Parameters:
params - camParams struct with new camera properties.
Returns:
int - TRUE if successful, FALSE if error.

Definition at line 191 of file camera.cpp.

References camParams::colorType, camParams::depth, camParams::extended, camParams::framerate, camParams::height, camParams::led, camParams::width, camParams::x, and camParams::y.

Referenced by Tracker::init().

int Camera::setPicParams picParams  params  ) 
 

Set camera image properties.

This method is used to send new image properties to the camera device. This is usually done after calling getPicParams(), reading the parameters, and modifying them as necessary.

Parameters:
params - picParams struct with new image properties.
Returns:
int - TRUE if successful, FALSE if error.

Definition at line 245 of file camera.cpp.

References picParams::brightness, picParams::color, picParams::contrast, picParams::depth, camParams::extended, picParams::gain, picParams::hue, picParams::noise_reduction, picParams::palette, picParams::quality, picParams::wb, and picParams::whiteness.

void Camera::stop  ) 
 

Shutdown camera.

Closes the device file and make sure camera is properly shut down.

Definition at line 297 of file camera.cpp.

References camParams::name.

Referenced by ~Camera().


The documentation for this class was generated from the following files:
Generated on Wed Aug 31 15:16:39 2005 for Chair by  doxygen 1.4.2