7#ifndef YARP_DEVICE_USBCAMERA_LINUX_V4L_CAMERA_H
8#define YARP_DEVICE_USBCAMERA_LINUX_V4L_CAMERA_H
20#include <opencv2/opencv.hpp>
27#include <libv4lconvert.h>
28#include <linux/videodev2.h>
40#define CLEAR(x) memset(&(x), 0, sizeof(x))
43#define DEFAULT_WIDTH 640
44#define DEFAULT_HEIGHT 480
45#define DEFAULT_FRAMERATE 30
46#define VIDIOC_REQBUFS_COUNT 2
117 struct v4l2_format src_fmt;
118 struct v4l2_format dst_fmt;
119 struct v4l2_requestbuffers req;
143 bool close()
override;
150 int height()
const override;
151 int width()
const override;
186 v4lconvert_data* _v4lconvert_data;
187 bool use_exposure_absolute;
192 bool configFx, configFy;
193 bool configPPx, configPPy;
194 bool configRet, configDistM;
199 double timeStart, timeTot, timeNow, timeElapsed;
203 std::map<std::string, supported_cams> camMap;
207 void populateConfigurations();
209 int convertV4L_to_YARP_format(
int format);
222 bool threadInit()
override;
224 void threadRelease()
override;
232 bool readInit(
unsigned int buffer_size);
238 bool userptrInit(
unsigned int buffer_size);
247 bool full_FrameRead();
254 void imagePreProcess();
275 int xioctl(
int fd,
int request,
void* argp);
278 void enumerate_menu();
279 bool enumerate_controls();
280 bool check_V4L2_control(uint32_t
id);
281 bool set_V4L2_control(u_int32_t
id,
double value,
bool verbatim =
false);
282 double get_V4L2_control(uint32_t
id,
bool verbatim =
false);
284 double toEpochOffset;
yarp::dev::ReturnValue getRgbIntrinsicParam(yarp::os::Property &intrinsic) override
Get the intrinsic parameters of the rgb camera.
int getRgbWidth() override
Return the width of each frame.
yarp::dev::ReturnValue getRgbResolution(int &width, int &height) override
Get the resolution of the rgb image from the camera.
yarp::dev::ReturnValue setRgbFOV(double horizontalFov, double verticalFov) override
Set the field of view (FOV) of the rgb camera.
yarp::dev::ReturnValue getFeature(yarp::dev::cameraFeature_id_t feature, double &value) override
Get the current value for the requested feature.
yarp::dev::ReturnValue getRgbSupportedConfigurations(std::vector< yarp::dev::CameraConfig > &configurations) override
Get the possible configurations of the camera.
yarp::os::Stamp getLastInputStamp() override
Return the time stamp relative to the last acquisition.
yarp::dev::ReturnValue setMode(yarp::dev::cameraFeature_id_t feature, yarp::dev::FeatureMode mode) override
Set the requested mode for the feature.
yarp::dev::ReturnValue getImage(yarp::sig::ImageOf< yarp::sig::PixelRgb > &image) override
Get an image from the frame grabber.
yarp::dev::ReturnValue setRgbMirroring(bool mirror) override
Set the mirroring setting of the sensor.
yarp::dev::ReturnValue setActive(yarp::dev::cameraFeature_id_t feature, bool onoff) override
Set the requested feature on or off.
bool close() override
close device
yarp::dev::ReturnValue setRgbResolution(int width, int height) override
Set the resolution of the rgb image from the camera.
int getRgbHeight() override
Return the height of each frame.
yarp::dev::ReturnValue getActive(yarp::dev::cameraFeature_id_t feature, bool &isActive) override
Get the current status of the feature, on or off.
yarp::dev::ReturnValue getRgbFOV(double &horizontalFov, double &verticalFov) override
Get the field of view (FOV) of the rgb camera.
int width() const override
Return the width of each frame.
yarp::dev::ReturnValue getMode(yarp::dev::cameraFeature_id_t feature, yarp::dev::FeatureMode &mode) override
Get the current mode for the feature.
yarp::dev::ReturnValue setFeature(yarp::dev::cameraFeature_id_t feature, double value) override
Set the requested feature to a value (saturation, brightness ... )
yarp::dev::ReturnValue getRgbMirroring(bool &mirror) override
Get the mirroring setting of the sensor.
int height() const override
Return the height of each frame.
yarp::dev::ReturnValue setOnePush(yarp::dev::cameraFeature_id_t feature) override
Set the requested feature to a value (saturation, brightness ... )
bool open(yarp::os::Searchable &config) override
open device
yarp::dev::ReturnValue getCameraDescription(yarp::dev::CameraDescriptor &camera) override
Get a basic description of the camera hw.
Interface implemented by all device drivers.
Control interface for frame grabber devices.
An interface for retrieving intrinsic parameter from a rgb camera.
An abstraction for a periodic thread.
A class for storing options and configuration information.
A base class for nested structures that can be searched.
A class for thread synchronization and mutual exclusion.
An abstraction for a time stamp and/or sequence number.
unsigned char * read_image
unsigned char * raw_image
unsigned char * dst_image_rgb
std::vector< yarp::dev::CameraConfig > configurations
yarp::os::Property intrinsic
unsigned char * src_image
unsigned int dst_image_size_rgb
unsigned int src_image_size
unsigned int raw_image_size