#include <LIN_V4L2Webcam.hpp>
Inherits kn::CameraController.

Public Member Functions | |
| V4L2Webcam (void) | |
| Default constructor for a V4L2 Webcam. | |
| ~V4L2Webcam (void) | |
| /brief Destructor | |
| void | openDevice (const V4L2WebcamParams ¶ms) |
| 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. | |
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.
Definition at line 142 of file LIN_V4L2Webcam.hpp.
| kn::V4L2Webcam::V4L2Webcam | ( | void | ) | [inline] |
Default constructor for a V4L2 Webcam.
It doesn't open the device.
Definition at line 244 of file LIN_V4L2Webcam.hpp.
| kn::V4L2Webcam::~V4L2Webcam | ( | void | ) | [inline] |
/brief Destructor
The destructor closes the device.
Definition at line 262 of file LIN_V4L2Webcam.hpp.
| void kn::V4L2Webcam::closeDevice | ( | void | ) | [virtual] |
Disables the webcam.
It stops the capture
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.
| control | the id of the control |
Definition at line 434 of file LIN_V4L2Webcam.cpp.
| int kn::V4L2Webcam::getControlMinValue | ( | const WebcamControl & | control | ) |
Returns the minimal value allowed for the control.
| control | the id of the control |
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.
| control | the id of the control |
Definition at line 442 of file LIN_V4L2Webcam.cpp.
| int kn::V4L2Webcam::getControlValue | ( | const WebcamControl & | control | ) |
Returns the current value related to the control.
| control | the id of the control |
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
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.
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.
| control | the id of the control |
Definition at line 349 of file LIN_V4L2Webcam.cpp.
| bool kn::V4L2Webcam::isOpened | ( | void | ) | const [inline] |
| bool kn::V4L2Webcam::isStarted | ( | void | ) | const [inline] |
| 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
| params | parameters for the webcam (devicename, size, grabbing method, format, framerate, force) |
Definition at line 95 of file LIN_V4L2Webcam.cpp.
| bool kn::V4L2Webcam::resetControlValue | ( | const WebcamControl & | control | ) |
Sets control's value to default value.
| control | the id of the control |
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.
| control | the id of the control |
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.
| control | the id of the control |
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.
| control | the id of the control | |
| value | the value used to set the control |
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
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.
| control | the id of the control | |
| value | the value used to set the control |
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.
Implements kn::CameraController.
Definition at line 339 of file LIN_V4L2Webcam.cpp.
1.5.8