YARP
Yet Another Robot Platform
IFrameGrabberControls.h
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2006-2021 Istituto Italiano di Tecnologia (IIT)
3 * SPDX-FileCopyrightText: 2006-2010 RobotCub Consortium
4 * SPDX-License-Identifier: BSD-3-Clause
5 */
6
7#ifndef YARP_DEV_IFRAMEGRABBERCONTROLS_H
8#define YARP_DEV_IFRAMEGRABBERCONTROLS_H
9
10#include <yarp/dev/api.h>
11
12#include <string>
13
14
15typedef enum {
20
21typedef enum {
26
27typedef struct {
29 std::string deviceDescription;
31
32typedef enum {
57 YARP_FEATURE_NUMBER_OF // this has to be the last one
59
60namespace yarp::dev {
61
68{
69public:
74
75#ifndef YARP_NO_DEPRECATED // Since YARP 3.0.0
76// set
82 YARP_DEPRECATED_MSG("Use setFeature(YARP_FEATURE_BRIGHTNESS, v) instead")
83 virtual bool setBrightness(double v) { return false; }
89 YARP_DEPRECATED_MSG("Use setFeature(YARP_FEATURE_EXPOSURE, v) instead")
90 virtual bool setExposure(double v) { return false; }
96 YARP_DEPRECATED_MSG("Use setFeature(YARP_FEATURE_SHARPNESS, v) instead")
97 virtual bool setSharpness(double v) { return false; }
104 YARP_DEPRECATED_MSG("Use setFeature(YARP_FEATURE_WHITE_BALANCE, blue, red) instead")
105 virtual bool setWhiteBalance(double blue, double red) { return false; }
111 YARP_DEPRECATED_MSG("Use setFeature(YARP_FEATURE_HUE, v) instead")
112 virtual bool setHue(double v) { return false; }
118 YARP_DEPRECATED_MSG("Use setFeature(YARP_FEATURE_SATURATION, v) instead")
119 virtual bool setSaturation(double v) { return false; }
125 YARP_DEPRECATED_MSG("Use setFeature(YARP_FEATURE_GAMMA, v) instead")
126 virtual bool setGamma(double v) { return false; }
132 YARP_DEPRECATED_MSG("Use setFeature(YARP_FEATURE_SHUTTER, v) instead")
133 virtual bool setShutter(double v) { return false; }
139 YARP_DEPRECATED_MSG("Use setFeature(YARP_FEATURE_GAIN, v) instead")
140 virtual bool setGain(double v) { return false; }
146 YARP_DEPRECATED_MSG("Use setFeature(YARP_FEATURE_IRIS, v) instead")
147 virtual bool setIris(double v) { return false; }
148
149// get
154 YARP_DEPRECATED_MSG("Use getFeature(YARP_FEATURE_BRIGHTNESS, v) instead")
155 virtual double getBrightness() { return -1.0; }
160 YARP_DEPRECATED_MSG("Use getFeature(YARP_FEATURE_EXPOSURE, v) instead")
161 virtual double getExposure() { return -1.0; }
166 YARP_DEPRECATED_MSG("Use getFeature(YARP_FEATURE_SHARPNESS, v) instead")
167 virtual double getSharpness() { return -1.0; }
174 YARP_DEPRECATED_MSG("Use getFeature(YARP_FEATURE_WHITE_BALANCE, blue, red) instead")
175 virtual bool getWhiteBalance(double &blue, double &red) { return false; }
180 YARP_DEPRECATED_MSG("Use getFeature(YARP_FEATURE_HUE, v) instead")
181 virtual double getHue() { return -1.0; }
186 YARP_DEPRECATED_MSG("Use getFeature(YARP_FEATURE_SATURATION, v) instead")
187 virtual double getSaturation() { return -1.0; }
192 YARP_DEPRECATED_MSG("Use getFeature(YARP_FEATURE_GAMMA, v) instead")
193 virtual double getGamma() { return -1.0; }
198 YARP_DEPRECATED_MSG("Use getFeature(YARP_FEATURE_SHUTTER, v) instead")
199 virtual double getShutter() { return -1.0; }
204 YARP_DEPRECATED_MSG("Use getFeature(YARP_FEATURE_GAIN, v) instead")
205 virtual double getGain() { return -1.0; }
210 YARP_DEPRECATED_MSG("Use getFeature(YARP_FEATURE_IRIS, v) instead")
211 virtual double getIris() { return -1.0; }
212#endif
213
214 std::string busType2String(BusType type)
215 {
216 switch (type) {
217 case BUS_FIREWIRE:
218 return "FireWire";
219 break;
220
221 case BUS_USB:
222 return "USB";
223 break;
224
225 default:
226 return "bus type undefined";
227 break;
228 }
229 }
230
231 inline FeatureMode toFeatureMode(bool _auto)
232 {
233 return _auto ? MODE_AUTO : MODE_MANUAL;
234 }
241 virtual bool getCameraDescription(CameraDescriptor *camera)=0;
242
249 virtual bool hasFeature(int feature, bool *hasFeature)=0;
250
257 virtual bool setFeature(int feature, double value)=0;
258
265 virtual bool getFeature(int feature, double *value)=0;
266
275 virtual bool setFeature(int feature, double value1, double value2)=0;
276
284 virtual bool getFeature(int feature, double *value1, double *value2)=0;
285
292 virtual bool hasOnOff(int feature, bool *HasOnOff)=0;
293
300 virtual bool setActive(int feature, bool onoff)=0;
301
308 virtual bool getActive(int feature, bool *isActive)=0;
309
316 virtual bool hasAuto(int feature, bool *hasAuto)=0;
317
324 virtual bool hasManual(int feature, bool *hasManual)=0;
325
332 virtual bool hasOnePush(int feature, bool *hasOnePush)=0;
333
340 virtual bool setMode(int feature, FeatureMode mode)=0;
341
348 virtual bool getMode(int feature, FeatureMode *mode)=0;
349
356 virtual bool setOnePush(int feature)=0;
357};
358
359} // namespace yarp::dev
360
361#endif // YARP_DEV_IFRAMEGRABBERCONTROLS_H
@ BUS_FIREWIRE
@ BUS_UNKNOWN
cameraFeature_id_t
@ YARP_FEATURE_NUMBER_OF
@ YARP_FEATURE_CAPTURE_SIZE
@ YARP_FEATURE_SHARPNESS
@ YARP_FEATURE_FRAME_RATE
@ YARP_FEATURE_BRIGHTNESS
@ YARP_FEATURE_TRIGGER
@ YARP_FEATURE_HUE
@ YARP_FEATURE_WHITE_BALANCE
@ YARP_FEATURE_GAMMA
@ YARP_FEATURE_TILT
@ YARP_FEATURE_EXPOSURE
@ YARP_FEATURE_CAPTURE_QUALITY
@ YARP_FEATURE_INVALID
@ YARP_FEATURE_TRIGGER_DELAY
@ YARP_FEATURE_IRIS
@ YARP_FEATURE_MIRROR
@ YARP_FEATURE_SATURATION
@ YARP_FEATURE_WHITE_SHADING
@ YARP_FEATURE_FOCUS
@ YARP_FEATURE_SHUTTER
@ YARP_FEATURE_TEMPERATURE
@ YARP_FEATURE_GAIN
@ YARP_FEATURE_PAN
@ YARP_FEATURE_OPTICAL_FILTER
@ YARP_FEATURE_ZOOM
@ MODE_MANUAL
@ MODE_UNKNOWN
Control interface for frame grabber devices.
virtual bool setFeature(int feature, double value)=0
Set the requested feature to a value (saturation, brightness ... )
virtual ~IFrameGrabberControls()
Destructor.
virtual bool setOnePush(int feature)=0
Set the requested feature to a value (saturation, brightness ... )
virtual bool getFeature(int feature, double *value)=0
Get the current value for the requested feature.
virtual bool setFeature(int feature, double value1, double value2)=0
Set the requested feature to a value using 2 params (like white balance)
virtual bool hasManual(int feature, bool *hasManual)=0
Check if the requested feature has the 'manual' mode.
virtual bool setMode(int feature, FeatureMode mode)=0
Set the requested mode for the feature.
std::string busType2String(BusType type)
virtual bool hasOnOff(int feature, bool *HasOnOff)=0
Check if the camera has the ability to turn on/off the requested feature.
virtual bool hasAuto(int feature, bool *hasAuto)=0
Check if the requested feature has the 'auto' mode.
virtual bool getMode(int feature, FeatureMode *mode)=0
Get the current mode for the feature.
virtual bool getFeature(int feature, double *value1, double *value2)=0
Get the current value for the requested feature.
virtual bool getCameraDescription(CameraDescriptor *camera)=0
Get a basic description of the camera hw.
virtual bool getActive(int feature, bool *isActive)=0
Get the current status of the feature, on or off.
virtual bool setActive(int feature, bool onoff)=0
Set the requested feature on or off.
virtual bool hasFeature(int feature, bool *hasFeature)=0
Check if camera has the requested feature (saturation, brightness ... )
virtual bool hasOnePush(int feature, bool *hasOnePush)=0
Check if the requested feature has the 'onePush' mode.
#define YARP_DEPRECATED_MSG(MSG)
Expands to either the standard [[deprecated]] attribute or a compiler-specific decorator such as __at...
Definition: compiler.h:2895
For streams capable of holding different kinds of content, check what they actually have.
std::string deviceDescription
#define YARP_dev_API
Definition: api.h:18