24 # include <WIN_camera.h>
67 if (!prop.
check(
"pixelType")) {
79 if (!os_device->open(prop)) {
84 os_device->view(deviceRgb);
85 os_device->view(deviceRaw);
86 os_device->view(deviceControls);
87 os_device->view(deviceTimed);
88 os_device->view(deviceRgbVisualParam);
90 if (deviceRaw !=
nullptr) {
91 _width = deviceRaw->width();
92 _height = deviceRaw->height();
95 if (deviceRgb !=
nullptr) {
96 _width = deviceRgb->width();
97 _height = deviceRgb->height();
112 if (deviceRaw !=
nullptr) {
113 return deviceRaw->width();
115 if (deviceRgb !=
nullptr) {
116 return deviceRgb->width();
124 if (deviceRaw !=
nullptr) {
125 return deviceRaw->height();
127 if (deviceRgb !=
nullptr) {
128 return deviceRgb->height();
152 if (deviceTimed !=
nullptr) {
153 return deviceTimed->getLastInputStamp();
161 if (deviceRgbVisualParam !=
nullptr) {
162 return deviceRgbVisualParam->getRgbHeight();
169 if (deviceRgbVisualParam !=
nullptr) {
170 return deviceRgbVisualParam->getRgbWidth();
178 if (deviceRgbVisualParam !=
nullptr) {
179 return deviceRgbVisualParam->getRgbSupportedConfigurations(configurations);
186 if (deviceRgbVisualParam !=
nullptr) {
187 return deviceRgbVisualParam->getRgbResolution(width, height);
194 if (width <= 0 || height <= 0) {
198 if (deviceRgbVisualParam !=
nullptr) {
201 return deviceRgbVisualParam->setRgbResolution(width, height);
208 if (deviceRgbVisualParam !=
nullptr) {
209 return deviceRgbVisualParam->getRgbFOV(horizontalFov, verticalFov);
216 if (deviceRgbVisualParam !=
nullptr) {
217 return deviceRgbVisualParam->setRgbFOV(horizontalFov, verticalFov);
224 if (deviceRgbVisualParam !=
nullptr) {
225 return deviceRgbVisualParam->getRgbIntrinsicParam(intrinsic);
232 if (deviceRgbVisualParam !=
nullptr) {
233 return deviceRgbVisualParam->getRgbMirroring(mirror);
240 if (deviceRgbVisualParam !=
nullptr) {
241 return deviceRgbVisualParam->setRgbMirroring(mirror);
define common interfaces to discover remote camera capabilities
const yarp::os::LogComponent & USBCAMERA()
int height() const override
Return the height of each frame.
~USBCameraDriverRaw() override
int width() const override
Return the width of each frame.
bool getImage(yarp::sig::ImageOf< yarp::sig::PixelMono > &image) override
FrameGrabber image interface, returns the last acquired frame as an rgb image.
int height() const override
Return the height of each frame.
bool getImage(yarp::sig::ImageOf< yarp::sig::PixelRgb > &image) override
FrameGrabber image interface, returns the last acquired frame as an rgb image.
~USBCameraDriverRgb() override
int width() const override
Return the width of each frame.
Yarp device driver implementation for acquiring images from USB cameras.
bool setFeature(int feature, double value) override
Set the requested feature to a value (saturation, brightness ...
bool getRgbBuffer(unsigned char *buffer) override
FrameGrabber bgr interface, returns the last acquired frame as a buffer of bgr triplets.
bool getRgbResolution(int &width, int &height) override
Get the resolution of the rgb image from the camera.
int getRgbWidth() override
Return the width of each frame.
yarp::dev::IFrameGrabberRgb * deviceRgb
bool hasOnePush(int feature, bool *hasOnePush) override
Check if the requested feature has the 'onePush' mode.
USBCameraDriver()
Constructor.
bool getFeature(int feature, double *value) override
Get the current value for the requested feature.
int getRgbHeight() override
Return the height of each frame.
bool hasOnOff(int feature, bool *HasOnOff) override
Check if the camera has the ability to turn on/off the requested feature.
bool setRgbMirroring(bool mirror) override
Set the mirroring setting of the sensor.
~USBCameraDriver() override
Destructor.
bool close() override
Closes the device driver.
bool hasAuto(int feature, bool *hasAuto) override
Check if the requested feature has the 'auto' mode.
yarp::dev::IFrameGrabber * deviceRaw
bool getActive(int feature, bool *isActive) override
Get the current status of the feature, on or off.
bool open(yarp::os::Searchable &config) override
Open the device driver.
int getRawBufferSize() override
Implements the Frame grabber basic interface.
bool getRgbMirroring(bool &mirror) override
Get the mirroring setting of the sensor.
bool setRgbResolution(int width, int height) override
Set the resolution of the rgb image from the camera.
bool getMode(int feature, FeatureMode *mode) override
Get the current mode for the feature.
bool getRgbSupportedConfigurations(yarp::sig::VectorOf< yarp::dev::CameraConfig > &configurations) override
Get the possible configurations of the camera.
bool hasFeature(int feature, bool *hasFeature) override
Check if camera has the requested feature (saturation, brightness ...
int height() const override
Implements FrameGrabber basic interface.
bool setMode(int feature, FeatureMode mode) override
Set the requested mode for the feature.
bool getRgbIntrinsicParam(yarp::os::Property &intrinsic) override
Get the intrinsic parameters of the rgb camera.
bool setOnePush(int feature) override
Set the requested feature to a value (saturation, brightness ...
bool getRawBuffer(unsigned char *buffer) override
Implements FrameGrabber basic interface.
bool getRgbFOV(double &horizontalFov, double &verticalFov) override
Get the field of view (FOV) of the rgb camera.
bool hasManual(int feature, bool *hasManual) override
Check if the requested feature has the 'manual' mode.
yarp::os::Stamp getLastInputStamp() override
Implements the IPreciselyTimed interface.
bool setActive(int feature, bool onoff) override
Set the requested feature on or off.
int width() const override
Implements FrameGrabber basic interface.
bool getCameraDescription(CameraDescriptor *camera) override
Implementation of IFrameGrabberControls2 interface.
yarp::dev::IFrameGrabberControls * deviceControls
bool setRgbFOV(double horizontalFov, double verticalFov) override
Set the field of view (FOV) of the rgb camera.
Interface implemented by all device drivers.
virtual bool setFeature(int feature, double value)=0
Set the requested feature to a value (saturation, brightness ...
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 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.
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 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.
virtual bool getRgbBuffer(unsigned char *buffer)=0
Get a rgb buffer from the frame grabber, if required demosaicking/color reconstruction is applied.
virtual bool getRawBuffer(unsigned char *buffer)=0
Get the raw buffer from the frame grabber.
A class for storing options and configuration information.
void fromString(const std::string &txt, bool wipe=true)
Interprets a string as a list of properties.
void put(const std::string &key, const std::string &value)
Associate the given key with the given string.
bool check(const std::string &key) const override
Check if there exists a property of the given name.
A base class for nested structures that can be searched.
virtual std::string toString() const =0
Return a standard text representation of the content of the object.
An abstraction for a time stamp and/or sequence number.
size_t width() const
Gets width of image in pixels.
unsigned char * getRawImage() const
Access to the internal image buffer.
void resize(size_t imgWidth, size_t imgHeight)
Reallocate an image to be of a desired size, throwing away its current contents.
size_t height() const
Gets height of image in pixels.
#define yCError(component,...)
#define yCTrace(component,...)
An interface for the device drivers.
An interface to the operating system, including Port based communication.