YARP
Yet Another Robot Platform
USBcamera.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2006-2020 Istituto Italiano di Tecnologia (IIT)
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2.1 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with this library; if not, write to the Free Software
16  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17  */
18 
19 
20 #ifndef YARP_DEVICE_USBCAMERA_COMMON_USBCAMERA_H
21 #define YARP_DEVICE_USBCAMERA_COMMON_USBCAMERA_H
22 
23 
24 #include <yarp/os/Bottle.h>
25 #include <yarp/os/Semaphore.h>
26 #include <yarp/os/Stamp.h>
27 
28 #include <yarp/dev/DeviceDriver.h>
30 #include <yarp/dev/IVisualParams.h>
32 
43 {
44  USBCameraDriver(const USBCameraDriver&) = delete;
45  void operator=(const USBCameraDriver&) = delete;
46 
47 protected:
54 
55  size_t _width;
56  size_t _height;
57  int pixelType;
58 
59 public:
64 
68  ~USBCameraDriver() override;
69 
75  bool open(yarp::os::Searchable& config) override;
76 
81  bool close() override;
82 
86  int height() const override;
87 
91  int width() const override;
92 
98  bool getRawBuffer(unsigned char* buffer) override;
99 
105  int getRawBufferSize() override;
106 
114  bool getRgbBuffer(unsigned char* buffer) override;
115 
121 
127  bool getCameraDescription(CameraDescriptor* camera) override;
128  bool hasFeature(int feature, bool* hasFeature) override;
129  bool setFeature(int feature, double value) override;
130  bool getFeature(int feature, double* value) override;
131  bool setFeature(int feature, double value1, double value2) override;
132  bool getFeature(int feature, double* value1, double* value2) override;
133  bool hasOnOff(int feature, bool* HasOnOff) override;
134  bool setActive(int feature, bool onoff) override;
135  bool getActive(int feature, bool* isActive) override;
136  bool hasAuto(int feature, bool* hasAuto) override;
137  bool hasManual(int feature, bool* hasManual) override;
138  bool hasOnePush(int feature, bool* hasOnePush) override;
139  bool setMode(int feature, FeatureMode mode) override;
140  bool getMode(int feature, FeatureMode* mode) override;
141  bool setOnePush(int feature) override;
146  int getRgbHeight() override;
147 
152  int getRgbWidth() override;
153 
168  bool getRgbResolution(int& width, int& height) override;
169 
177  bool setRgbResolution(int width, int height) override;
178 
186  bool getRgbFOV(double& horizontalFov, double& verticalFov) override;
187 
195  bool setRgbFOV(double horizontalFov, double verticalFov) override;
196 
205  bool getRgbIntrinsicParam(yarp::os::Property& intrinsic) override;
206 
213  bool getRgbMirroring(bool& mirror) override;
214 
221  bool setRgbMirroring(bool mirror) override;
222 };
223 
224 
226  public USBCameraDriver,
229 {
230 private:
231  USBCameraDriverRgb(const USBCameraDriverRgb&) = delete;
232  void operator=(const USBCameraDriverRgb&) = delete;
233 
234 public:
236  ~USBCameraDriverRgb() override;
237 
246 
254 
259  int height() const override;
260 
265  int width() const override;
266 };
267 
268 
270  public USBCameraDriver,
272 {
273 private:
274  USBCameraDriverRaw(const USBCameraDriverRaw&) = delete;
275  void operator=(const USBCameraDriverRaw&) = delete;
276 
277 public:
279  ~USBCameraDriverRaw() override;
280 
289 
294  int height() const override;
295 
300  int width() const override;
301 };
302 
303 #endif // YARP_DEVICE_USBCAMERA_COMMON_USBCAMERA_H
define common interfaces to discover remote camera capabilities
int height() const override
Return the height of each frame.
Definition: USBcamera.cpp:317
~USBCameraDriverRaw() override
Definition: USBcamera.cpp:297
int width() const override
Return the width of each frame.
Definition: USBcamera.cpp:312
bool getImage(yarp::sig::ImageOf< yarp::sig::PixelMono > &image) override
FrameGrabber image interface, returns the last acquired frame as an rgb image.
Definition: USBcamera.cpp:302
int height() const override
Return the height of each frame.
Definition: USBcamera.cpp:284
bool getImage(yarp::sig::ImageOf< yarp::sig::PixelRgb > &image) override
FrameGrabber image interface, returns the last acquired frame as an rgb image.
Definition: USBcamera.cpp:260
~USBCameraDriverRgb() override
Definition: USBcamera.cpp:255
int width() const override
Return the width of each frame.
Definition: USBcamera.cpp:279
Yarp device driver implementation for acquiring images from USB cameras.
Definition: USBcamera.h:43
bool setFeature(int feature, double value) override
Set the requested feature to a value (saturation, brightness ...
Definition: USBcamera.cpp:344
bool getRgbBuffer(unsigned char *buffer) override
FrameGrabber bgr interface, returns the last acquired frame as a buffer of bgr triplets.
Definition: USBcamera.cpp:145
size_t _width
Definition: USBcamera.h:55
bool getRgbResolution(int &width, int &height) override
Get the resolution of the rgb image from the camera.
Definition: USBcamera.cpp:184
int getRgbWidth() override
Return the width of each frame.
Definition: USBcamera.cpp:167
yarp::dev::IFrameGrabberRgb * deviceRgb
Definition: USBcamera.h:48
bool hasOnePush(int feature, bool *hasOnePush) override
Check if the requested feature has the 'onePush' mode.
Definition: USBcamera.cpp:416
USBCameraDriver()
Constructor.
Definition: USBcamera.cpp:42
bool getFeature(int feature, double *value) override
Get the current value for the requested feature.
Definition: USBcamera.cpp:352
int getRgbHeight() override
Return the height of each frame.
Definition: USBcamera.cpp:159
bool hasOnOff(int feature, bool *HasOnOff) override
Check if the camera has the ability to turn on/off the requested feature.
Definition: USBcamera.cpp:376
bool setRgbMirroring(bool mirror) override
Set the mirroring setting of the sensor.
Definition: USBcamera.cpp:238
~USBCameraDriver() override
Destructor.
Definition: USBcamera.cpp:48
bool close() override
Closes the device driver.
Definition: USBcamera.cpp:102
bool hasAuto(int feature, bool *hasAuto) override
Check if the requested feature has the 'auto' mode.
Definition: USBcamera.cpp:400
yarp::dev::IFrameGrabber * deviceRaw
Definition: USBcamera.h:50
bool getActive(int feature, bool *isActive) override
Get the current status of the feature, on or off.
Definition: USBcamera.cpp:392
bool open(yarp::os::Searchable &config) override
Open the device driver.
Definition: USBcamera.cpp:54
int getRawBufferSize() override
Implements the Frame grabber basic interface.
Definition: USBcamera.cpp:140
bool getRgbMirroring(bool &mirror) override
Get the mirroring setting of the sensor.
Definition: USBcamera.cpp:230
bool setRgbResolution(int width, int height) override
Set the resolution of the rgb image from the camera.
Definition: USBcamera.cpp:192
bool getMode(int feature, FeatureMode *mode) override
Get the current mode for the feature.
Definition: USBcamera.cpp:432
bool getRgbSupportedConfigurations(yarp::sig::VectorOf< yarp::dev::CameraConfig > &configurations) override
Get the possible configurations of the camera.
Definition: USBcamera.cpp:176
bool hasFeature(int feature, bool *hasFeature) override
Check if camera has the requested feature (saturation, brightness ...
Definition: USBcamera.cpp:336
int height() const override
Implements FrameGrabber basic interface.
Definition: USBcamera.cpp:122
bool setMode(int feature, FeatureMode mode) override
Set the requested mode for the feature.
Definition: USBcamera.cpp:424
yarp::dev::IPreciselyTimed * deviceTimed
Definition: USBcamera.h:49
bool getRgbIntrinsicParam(yarp::os::Property &intrinsic) override
Get the intrinsic parameters of the rgb camera.
Definition: USBcamera.cpp:222
bool setOnePush(int feature) override
Set the requested feature to a value (saturation, brightness ...
Definition: USBcamera.cpp:440
bool getRawBuffer(unsigned char *buffer) override
Implements FrameGrabber basic interface.
Definition: USBcamera.cpp:135
size_t _height
Definition: USBcamera.h:56
bool getRgbFOV(double &horizontalFov, double &verticalFov) override
Get the field of view (FOV) of the rgb camera.
Definition: USBcamera.cpp:206
bool hasManual(int feature, bool *hasManual) override
Check if the requested feature has the 'manual' mode.
Definition: USBcamera.cpp:408
yarp::dev::DeviceDriver * os_device
Definition: USBcamera.h:51
yarp::os::Stamp getLastInputStamp() override
Implements the IPreciselyTimed interface.
Definition: USBcamera.cpp:150
yarp::dev::IRgbVisualParams * deviceRgbVisualParam
Definition: USBcamera.h:53
bool setActive(int feature, bool onoff) override
Set the requested feature on or off.
Definition: USBcamera.cpp:384
int width() const override
Implements FrameGrabber basic interface.
Definition: USBcamera.cpp:110
bool getCameraDescription(CameraDescriptor *camera) override
Implementation of IFrameGrabberControls2 interface.
Definition: USBcamera.cpp:328
yarp::dev::IFrameGrabberControls * deviceControls
Definition: USBcamera.h:52
bool setRgbFOV(double horizontalFov, double verticalFov) override
Set the field of view (FOV) of the rgb camera.
Definition: USBcamera.cpp:214
Interface implemented by all device drivers.
Definition: DeviceDriver.h:38
Control interface for frame grabber devices.
Read a YARP-format image from a device.
Read a YARP-format image from a device.
RGB Interface to a FrameGrabber device.
Common interface to a FrameGrabber.
An interface for retrieving intrinsic parameter from a rgb camera.
Definition: IVisualParams.h:73
A class for storing options and configuration information.
Definition: Property.h:37
A base class for nested structures that can be searched.
Definition: Searchable.h:69
An abstraction for a time stamp and/or sequence number.
Definition: Stamp.h:25