kn::V4L2Webcam Class Reference

Class Defining V4L2 webcam. More...

#include <LIN_V4L2Webcam.hpp>

Inherits kn::CameraController.

Collaboration diagram for kn::V4L2Webcam:

Collaboration graph
[legend]

List of all members.

Public Member Functions

 V4L2Webcam (void)
 Default constructor for a V4L2 Webcam.
 ~V4L2Webcam (void)
 /brief Destructor
void openDevice (const V4L2WebcamParams &params)
 Enables the webcam.
void openDevice (void)
 Activates the camera.
void closeDevice (void)
 Disables the webcam.
void start (void)
 Starts the capture of the images.
void stop (void)
 Stops the capture of the images.
bool isStarted (void) const
 Returns if capture has been started.
bool isOpened (void) const
 returns if device has been opened
unsigned char * getImage (void)
 Get the last image captured.
size_t width (void) const
 Returns the width of the images captured by the webcam.
size_t height (void) const
 Returns the height of the images captured by the webcam.
bool isControlSupported (const WebcamControl &control)
 Checks if the control is supported by the webcam.
int getControlValue (const WebcamControl &control)
 Returns the current value related to the control.
bool resetControlValue (const WebcamControl &control)
 Sets control's value to default value.
int getControlMinValue (const WebcamControl &control)
 Returns the minimal value allowed for the control.
int getControlMaxValue (const WebcamControl &control)
 Returns the maximal value allowed for the control.
int getControlStepValue (const WebcamControl &control)
 Returns the step between two values of the control.
bool setControlUpValue (const WebcamControl &control)
 Increases the value of the control of one step.
bool setControlDownValue (const WebcamControl &control)
 Decreases the value of the control of one step.
bool setControlValue (const WebcamControl &control, const int &value)
 Sets control's value to the one's in argument.
bool toggleControlValue (const WebcamControl &control, const WebcamToggleControl &value)
 Switches to ON/OFF the control based on the value given in argument.


Detailed Description

Class Defining V4L2 webcam.

This class only works with V4L2 compatible webcams

Special recommandations : Sometimes, under Linux, the webcam could turns out of control. You will have to unplug and replug the webcam to get back to normal. If you nocite luminosity problems (dark image, white image, brightness, exposure, etc.), you can also use this method. However, it can be useless due to uvcvideo driver limits so a solution is to restart the driver :

This class have been tested with :

Depending on the webcam, some controls are enabled or disabled like auto-exposure, auto-brightness... Please use v4l-info command to check crontrols avaibility.

Author:
Frankoi

Definition at line 142 of file LIN_V4L2Webcam.hpp.


Constructor & Destructor Documentation

kn::V4L2Webcam::V4L2Webcam ( void   )  [inline]

Default constructor for a V4L2 Webcam.

It doesn't open the device.

Author:
Frankoi

Definition at line 244 of file LIN_V4L2Webcam.hpp.

kn::V4L2Webcam::~V4L2Webcam ( void   )  [inline]

/brief Destructor

The destructor closes the device.

Author:
Frankoi

Definition at line 262 of file LIN_V4L2Webcam.hpp.


Member Function Documentation

void kn::V4L2Webcam::closeDevice ( void   )  [virtual]

Disables the webcam.

It stops the capture

Author:
Frankoi

Implements kn::CameraController.

Definition at line 241 of file LIN_V4L2Webcam.cpp.

int kn::V4L2Webcam::getControlMaxValue ( const WebcamControl control  ) 

Returns the maximal value allowed for the control.

Parameters:
control the id of the control
Returns:
the max value of the control
Author:
Frankoi

Definition at line 434 of file LIN_V4L2Webcam.cpp.

int kn::V4L2Webcam::getControlMinValue ( const WebcamControl control  ) 

Returns the minimal value allowed for the control.

Parameters:
control the id of the control
Returns:
the min value of the control
Author:
Frankoi

Definition at line 426 of file LIN_V4L2Webcam.cpp.

int kn::V4L2Webcam::getControlStepValue ( const WebcamControl control  ) 

Returns the step between two values of the control.

Parameters:
control the id of the control
Returns:
the values step of the control
Author:
Frankoi

Definition at line 442 of file LIN_V4L2Webcam.cpp.

int kn::V4L2Webcam::getControlValue ( const WebcamControl control  ) 

Returns the current value related to the control.

Parameters:
control the id of the control
Returns:
the value of the control
Author:
Frankoi

Definition at line 394 of file LIN_V4L2Webcam.cpp.

unsigned char * kn::V4L2Webcam::getImage ( void   )  [virtual]

Get the last image captured.

Since it returns a pointer, this means that the webcam manager can change the data without warnings. So if you want to use these data during a long time, tou will have to make a copy.

! Don't try to delete the returned pointer

Returns:
array of RGB24 data
Author:
Frankoi

Implements kn::CameraController.

Definition at line 291 of file LIN_V4L2Webcam.cpp.

size_t kn::V4L2Webcam::height ( void   )  const [virtual]

Returns the height of the images captured by the webcam.

Returns:
height
Author:
Frankoi

Implements kn::CameraController.

Definition at line 344 of file LIN_V4L2Webcam.cpp.

bool kn::V4L2Webcam::isControlSupported ( const WebcamControl control  ) 

Checks if the control is supported by the webcam.

Parameters:
control the id of the control
Returns:
if control is supported
Author:
Frankoi

Definition at line 349 of file LIN_V4L2Webcam.cpp.

bool kn::V4L2Webcam::isOpened ( void   )  const [inline]

returns if device has been opened

Author:
Frankoi

Definition at line 349 of file LIN_V4L2Webcam.hpp.

bool kn::V4L2Webcam::isStarted ( void   )  const [inline]

Returns if capture has been started.

Author:
Frankoi

Definition at line 342 of file LIN_V4L2Webcam.hpp.

void kn::V4L2Webcam::openDevice ( void   )  [inline, virtual]

Activates the camera.

Implements kn::CameraController.

Definition at line 312 of file LIN_V4L2Webcam.hpp.

void kn::V4L2Webcam::openDevice ( const V4L2WebcamParams params  ) 

Enables the webcam.

It doesn't start the capture

Parameters:
params parameters for the webcam (devicename, size, grabbing method, format, framerate, force)
Author:
Frankoi

Definition at line 95 of file LIN_V4L2Webcam.cpp.

bool kn::V4L2Webcam::resetControlValue ( const WebcamControl control  ) 

Sets control's value to default value.

Parameters:
control the id of the control
Returns:
true if operation was a success, false otherwise
Author:
Frankoi

Definition at line 407 of file LIN_V4L2Webcam.cpp.

bool kn::V4L2Webcam::setControlDownValue ( const WebcamControl control  ) 

Decreases the value of the control of one step.

Parameters:
control the id of the control
Returns:
true if operation was a success, false otherwise
Author:
Frankoi

Definition at line 502 of file LIN_V4L2Webcam.cpp.

bool kn::V4L2Webcam::setControlUpValue ( const WebcamControl control  ) 

Increases the value of the control of one step.

Parameters:
control the id of the control
Returns:
true if operation was a success, false otherwise
Author:
Frankoi

Definition at line 473 of file LIN_V4L2Webcam.cpp.

bool kn::V4L2Webcam::setControlValue ( const WebcamControl control,
const int &  value 
)

Sets control's value to the one's in argument.

Parameters:
control the id of the control
value the value used to set the control
Returns:
true if operation was a success, false otherwise
Author:
Frankoi

Definition at line 450 of file LIN_V4L2Webcam.cpp.

void kn::V4L2Webcam::start ( void   )  [virtual]

Starts the capture of the images.

It starts the capture if necessary

Author:
Frankoi

Implements kn::CameraController.

Definition at line 273 of file LIN_V4L2Webcam.cpp.

void kn::V4L2Webcam::stop ( void   )  [virtual]

Stops the capture of the images.

Implements kn::CameraController.

Definition at line 282 of file LIN_V4L2Webcam.cpp.

bool kn::V4L2Webcam::toggleControlValue ( const WebcamControl control,
const WebcamToggleControl value 
)

Switches to ON/OFF the control based on the value given in argument.

Parameters:
control the id of the control
value the value used to set the control
Returns:
true if operation was a success, false otherwise
Author:
Frankoi

Definition at line 531 of file LIN_V4L2Webcam.cpp.

size_t kn::V4L2Webcam::width ( void   )  const [virtual]

Returns the width of the images captured by the webcam.

Returns:
width
Author:
Frankoi

Implements kn::CameraController.

Definition at line 339 of file LIN_V4L2Webcam.cpp.


The documentation for this class was generated from the following files:

Generated on Thu Nov 12 16:06:36 2009 for OpenKraken-controller by  doxygen 1.5.8