YARP
Yet Another Robot Platform
yarp::dev::IRGBDSensor Class Referenceabstract

A generic interface for cameras that have both color camera as well as depth camera sensor, like kinect device. More...

#include <yarp/dev/IRGBDSensor.h>

+ Inheritance diagram for yarp::dev::IRGBDSensor:

Detailed Description

A generic interface for cameras that have both color camera as well as depth camera sensor, like kinect device.

This interface uses the existing IRgbVisualParams and IDepthVisualParams interfaces to retrieve the information about the cameras. This device extends the functionality by adding methods for getting extrinsic parameters and to actually retrieve the images. The images can be synchronized on client side by using the PortSynchronizer object. How the synch policy is implemented depends on the client device, custom policy can be used.

Definition at line 56 of file IRGBDSensor.h.

Public Types

enum  RGBDSensor_status {
  RGBD_SENSOR_NOT_READY = 0,
  RGBD_SENSOR_OK_STANBY = 1,
  RGBD_SENSOR_OK_IN_USE = 2,
  RGB_SENSOR_ERROR = 3,
  DEPTH_SENSOR_ERROR = 4,
  RGBD_SENSOR_GENERIC_ERROR = 5,
  RGBD_SENSOR_TIMEOUT = 6
}
 

Public Member Functions

virtual ~IRGBDSensor ()
 
int getRgbHeight () override=0
 Return the height of each frame. More...
 
int getRgbWidth () override=0
 Return the width of each frame. More...
 
bool getRgbSupportedConfigurations (yarp::sig::VectorOf< CameraConfig > &configurations) override
 Get the possible configurations of the camera. More...
 
bool getRgbResolution (int &width, int &height) override
 Get the resolution of the rgb image from the camera. More...
 
bool setRgbResolution (int width, int height) override=0
 Set the resolution of the rgb image from the camera. More...
 
bool getRgbFOV (double &horizontalFov, double &verticalFov) override=0
 Get the field of view (FOV) of the rgb camera. More...
 
bool setRgbFOV (double horizontalFov, double verticalFov) override=0
 Set the field of view (FOV) of the rgb camera. More...
 
bool getRgbIntrinsicParam (yarp::os::Property &intrinsic) override=0
 Get the intrinsic parameters of the rgb camera. More...
 
int getDepthHeight () override=0
 Return the height of each frame. More...
 
int getDepthWidth () override=0
 Return the height of each frame. More...
 
bool setDepthResolution (int width, int height) override=0
 Set the resolution of the depth image from the camera. More...
 
bool getDepthFOV (double &horizontalFov, double &verticalFov) override=0
 Get the field of view (FOV) of the depth camera. More...
 
bool setDepthFOV (double horizontalFov, double verticalFov) override=0
 Set the field of view (FOV) of the depth camera. More...
 
double getDepthAccuracy () override=0
 Get the minimum detectable variation in distance [meter]. More...
 
bool setDepthAccuracy (double accuracy) override=0
 Set the minimum detectable variation in distance [meter] when possible. More...
 
bool getDepthClipPlanes (double &nearPlane, double &farPlane) override=0
 Get the clipping planes of the sensor. More...
 
bool setDepthClipPlanes (double nearPlane, double farPlane) override=0
 Set the clipping planes of the sensor. More...
 
bool getDepthIntrinsicParam (yarp::os::Property &intrinsic) override=0
 Get the intrinsic parameters of the depth camera. More...
 
virtual bool getExtrinsicParam (yarp::sig::Matrix &extrinsic)=0
 Get the extrinsic parameters from the device. More...
 
virtual std::string getLastErrorMsg (yarp::os::Stamp *timeStamp=NULL)=0
 Return an error message in case of error. More...
 
virtual bool getRgbImage (yarp::sig::FlexImage &rgbImage, yarp::os::Stamp *timeStamp=NULL)=0
 Get the rgb frame from the device. More...
 
virtual bool getDepthImage (yarp::sig::ImageOf< yarp::sig::PixelFloat > &depthImage, yarp::os::Stamp *timeStamp=NULL)=0
 Get the depth frame from the device. More...
 
virtual bool getImages (yarp::sig::FlexImage &colorFrame, yarp::sig::ImageOf< yarp::sig::PixelFloat > &depthFrame, yarp::os::Stamp *colorStamp=NULL, yarp::os::Stamp *depthStamp=NULL)=0
 Get the both the color and depth frame in a single call. More...
 
virtual RGBDSensor_status getSensorStatus ()=0
 Get the surrent status of the sensor, using enum type. More...
 
- Public Member Functions inherited from yarp::dev::IRgbVisualParams
virtual ~IRgbVisualParams ()
 
virtual bool getRgbMirroring (bool &mirror)=0
 Get the mirroring setting of the sensor. More...
 
virtual bool setRgbMirroring (bool mirror)=0
 Set the mirroring setting of the sensor. More...
 
- Public Member Functions inherited from yarp::dev::IDepthVisualParams
virtual ~IDepthVisualParams ()
 
virtual bool getDepthMirroring (bool &mirror)=0
 Get the mirroring setting of the sensor. More...
 
virtual bool setDepthMirroring (bool mirror)=0
 Set the mirroring setting of the sensor. More...
 

Member Enumeration Documentation

◆ RGBDSensor_status

Enumerator
RGBD_SENSOR_NOT_READY 
RGBD_SENSOR_OK_STANBY 
RGBD_SENSOR_OK_IN_USE 
RGB_SENSOR_ERROR 
DEPTH_SENSOR_ERROR 
RGBD_SENSOR_GENERIC_ERROR 
RGBD_SENSOR_TIMEOUT 

Definition at line 64 of file IRGBDSensor.h.

Constructor & Destructor Documentation

◆ ~IRGBDSensor()

virtual yarp::dev::IRGBDSensor::~IRGBDSensor ( )
inlinevirtual

Definition at line 75 of file IRGBDSensor.h.

Member Function Documentation

◆ getDepthAccuracy()

double yarp::dev::IRGBDSensor::getDepthAccuracy ( )
overridepure virtual

Get the minimum detectable variation in distance [meter].

Returns
the sensor resolution in meters.

Implements yarp::dev::IDepthVisualParams.

Implemented in depthCameraDriver, yarp::dev::RGBDSensorClient, realsense2Driver, and fakeDepthCameraDriver.

◆ getDepthClipPlanes()

bool yarp::dev::IRGBDSensor::getDepthClipPlanes ( double &  nearPlane,
double &  farPlane 
)
overridepure virtual

Get the clipping planes of the sensor.

Parameters
nearPlaneminimum distance at which the sensor start measuring. Object closer than this distance will not be detected.
farPlanemaximum distance beyond which the sensor stop measuring. Object farther than this distance will not be detected.
Returns
true if success

Implements yarp::dev::IDepthVisualParams.

Implemented in depthCameraDriver, yarp::dev::RGBDSensorClient, realsense2Driver, and fakeDepthCameraDriver.

◆ getDepthFOV()

bool yarp::dev::IRGBDSensor::getDepthFOV ( double &  horizontalFov,
double &  verticalFov 
)
overridepure virtual

Get the field of view (FOV) of the depth camera.

Parameters
horizontalFovwill return the value of the horizontal fov in degrees
verticalFovwill return the value of the vertical fov in degrees
Returns
true if success

Implements yarp::dev::IDepthVisualParams.

Implemented in depthCameraDriver, yarp::dev::RGBDSensorClient, realsense2Driver, and fakeDepthCameraDriver.

◆ getDepthHeight()

int yarp::dev::IRGBDSensor::getDepthHeight ( )
overridepure virtual

Return the height of each frame.

Returns
depth image height

Implements yarp::dev::IDepthVisualParams.

Implemented in depthCameraDriver, yarp::dev::RGBDSensorClient, realsense2Driver, and fakeDepthCameraDriver.

◆ getDepthImage()

virtual bool yarp::dev::IRGBDSensor::getDepthImage ( yarp::sig::ImageOf< yarp::sig::PixelFloat > &  depthImage,
yarp::os::Stamp timeStamp = NULL 
)
pure virtual

Get the depth frame from the device.

Parameters
depthImagethe depth image to be filled, depth measured in meters.
timeStamptime in which the image was acquired. Optional, ignored if nullptr.
Returns
True on success

Implemented in yarp::dev::RGBDSensorClient.

◆ getDepthIntrinsicParam()

bool yarp::dev::IRGBDSensor::getDepthIntrinsicParam ( yarp::os::Property intrinsic)
overridepure virtual

Get the intrinsic parameters of the depth camera.

Parameters
intrinsicreturn a Property containing intrinsic parameters of the optical model of the camera.
Returns
true if success

The yarp::os::Property describing the intrinsic parameters is expected to be in the form:

Parameter name SubParameter Type Units Default Value Required Description Notes
physFocalLength - double m - Yes Physical focal length of the lens in meters
focalLengthX - double pixel - Yes Horizontal component of the focal length as a multiple of pixel width
focalLengthY - double pixel - Yes Vertical component of the focal length as a multiple of pixel height
principalPointX - double pixel - Yes X coordinate of the principal point
principalPointY - double pixel - Yes Y coordinate of the principal point
retificationMatrix - 4x4 double matrix - - Yes Matrix that describes the lens' distortion
distortionModel - string - - Yes Reference to group of parameters describing the distortion model of the camera, example 'cameraDistortionModelGroup' This is another group's name to be searched for in the config file
cameraDistortionModelGroup
name string - - Yes Name of the distortion model, see notes right now only 'plumb_bob' is supported
k1 double - - Yes Radial distortion coefficient of the lens
k2 double - - Yes Radial distortion coefficient of the lens
k3 double - - Yes Radial distortion coefficient of the lens
t1 double - - Yes Tangential distortion of the lens
t2 double - - Yes Tangential distortion of the lens

Implements yarp::dev::IDepthVisualParams.

Implemented in depthCameraDriver, yarp::dev::RGBDSensorClient, realsense2Driver, and fakeDepthCameraDriver.

◆ getDepthWidth()

int yarp::dev::IRGBDSensor::getDepthWidth ( )
overridepure virtual

Return the height of each frame.

Returns
depth image height

Implements yarp::dev::IDepthVisualParams.

Implemented in depthCameraDriver, yarp::dev::RGBDSensorClient, realsense2Driver, and fakeDepthCameraDriver.

◆ getExtrinsicParam()

virtual bool yarp::dev::IRGBDSensor::getExtrinsicParam ( yarp::sig::Matrix extrinsic)
pure virtual

Get the extrinsic parameters from the device.

Parameters
extrinsicreturn a rototranslation matrix describing the position of the depth optical frame with respect to the rgb frame
Returns
true if success

Implemented in depthCameraDriver, yarp::dev::RGBDSensorClient, realsense2Driver, and fakeDepthCameraDriver.

◆ getImages()

virtual bool yarp::dev::IRGBDSensor::getImages ( yarp::sig::FlexImage colorFrame,
yarp::sig::ImageOf< yarp::sig::PixelFloat > &  depthFrame,
yarp::os::Stamp colorStamp = NULL,
yarp::os::Stamp depthStamp = NULL 
)
pure virtual

Get the both the color and depth frame in a single call.

Implementation should assure the best possible synchronization is achieved accordingly to synch policy set by the user. TimeStamps are referred to acquisition time of the corresponding piece of information. If the device is not providing TimeStamps, then 'timeStamp' field should be set to '-1'.

Parameters
colorFramepointer to FlexImage data to hold the color frame from the sensor
depthFramepointer to FlexImage data to hold the depth frame from the sensor
colorStamppointer to memory to hold the Stamp of the color frame
depthStamppointer to memory to hold the Stamp of the depth frame
Returns
true if able to get both data.

Implemented in yarp::dev::RGBDSensorClient.

◆ getLastErrorMsg()

virtual std::string yarp::dev::IRGBDSensor::getLastErrorMsg ( yarp::os::Stamp timeStamp = NULL)
pure virtual

Return an error message in case of error.

For debugging purpose and user notification. Error message will be reset after any successful command

Returns
A string explaining the last error occurred.

Implemented in depthCameraDriver, yarp::dev::RGBDSensorClient, realsense2Driver, and fakeDepthCameraDriver.

◆ getRgbFOV()

bool yarp::dev::IRGBDSensor::getRgbFOV ( double &  horizontalFov,
double &  verticalFov 
)
overridepure virtual

Get the field of view (FOV) of the rgb camera.

Parameters
horizontalFovwill return the value of the horizontal fov in degrees
verticalFovwill return the value of the vertical fov in degrees
Returns
true on success

Implements yarp::dev::IRgbVisualParams.

Implemented in depthCameraDriver, yarp::dev::RGBDSensorClient, realsense2Driver, and fakeDepthCameraDriver.

◆ getRgbHeight()

int yarp::dev::IRGBDSensor::getRgbHeight ( )
overridepure virtual

Return the height of each frame.

Returns
rgb image height

Implements yarp::dev::IRgbVisualParams.

Implemented in depthCameraDriver, yarp::dev::RGBDSensorClient, realsense2Driver, and fakeDepthCameraDriver.

◆ getRgbImage()

virtual bool yarp::dev::IRGBDSensor::getRgbImage ( yarp::sig::FlexImage rgbImage,
yarp::os::Stamp timeStamp = NULL 
)
pure virtual

Get the rgb frame from the device.

The pixel type of the source image will usually be set as a VOCAB_PIXEL_RGB, but the user can call the function with the pixel type of his/her choice. The conversion if possible, will be done automatically on client side (TO BO VERIFIED). Note: this will consume CPU power because it will not use GPU optimization. Use VOCAB_PIXEL_RGB for best performances.

Parameters
rgbImagethe image to be filled.
timeStamptime in which the image was acquired. Optional, ignored if nullptr.
Returns
True on success

Implemented in yarp::dev::RGBDSensorClient, depthCameraDriver, realsense2Driver, and fakeDepthCameraDriver.

◆ getRgbIntrinsicParam()

bool yarp::dev::IRGBDSensor::getRgbIntrinsicParam ( yarp::os::Property intrinsic)
overridepure virtual

Get the intrinsic parameters of the rgb camera.

Parameters
intrinsicreturn a Property containing intrinsic parameters of the optical model of the camera.
Returns
true if success

The yarp::os::Property describing the intrinsic parameters is expected to be in the form:

Parameter name SubParameter Type Units Default Value Required Description Notes
physFocalLength - double m - Yes Physical focal length of the lens in meters
focalLengthX - double pixel - Yes Horizontal component of the focal length as a multiple of pixel width
focalLengthY - double pixel - Yes Vertical component of the focal length as a multiple of pixel height
principalPointX - double pixel - Yes X coordinate of the principal point
principalPointY - double pixel - Yes Y coordinate of the principal point
retificationMatrix - 4x4 double matrix - - Yes Matrix that describes the lens' distortion
distortionModel - string - - Yes Reference to group of parameters describing the distortion model of the camera, example 'cameraDistortionModelGroup' This is another group's name to be searched for in the config file
cameraDistortionModelGroup
name string - - Yes Name of the distortion model, see notes right now only 'plumb_bob' is supported
k1 double - - Yes Radial distortion coefficient of the lens
k2 double - - Yes Radial distortion coefficient of the lens
k3 double - - Yes Radial distortion coefficient of the lens
t1 double - - Yes Tangential distortion of the lens
t2 double - - Yes Tangential distortion of the lens

Implements yarp::dev::IRgbVisualParams.

Implemented in depthCameraDriver, yarp::dev::RGBDSensorClient, realsense2Driver, and fakeDepthCameraDriver.

◆ getRgbResolution()

bool yarp::dev::IRGBDSensor::getRgbResolution ( int &  width,
int &  height 
)
inlineoverridevirtual

Get the resolution of the rgb image from the camera.

Parameters
widthimage width
heightimage height
Returns
true on success

Reimplemented from yarp::dev::IRgbVisualParams.

Reimplemented in depthCameraDriver, yarp::dev::RGBDSensorClient, realsense2Driver, and fakeDepthCameraDriver.

Definition at line 83 of file IRGBDSensor.h.

◆ getRgbSupportedConfigurations()

bool yarp::dev::IRGBDSensor::getRgbSupportedConfigurations ( yarp::sig::VectorOf< CameraConfig > &  configurations)
inlineoverridevirtual

Get the possible configurations of the camera.

Parameters
configurationslist of camera supported configurations as CameraConfig type
Returns
true on success

Reimplemented from yarp::dev::IRgbVisualParams.

Reimplemented in depthCameraDriver, yarp::dev::RGBDSensorClient, realsense2Driver, and fakeDepthCameraDriver.

Definition at line 82 of file IRGBDSensor.h.

◆ getRgbWidth()

int yarp::dev::IRGBDSensor::getRgbWidth ( )
overridepure virtual

Return the width of each frame.

Returns
rgb image width

Implements yarp::dev::IRgbVisualParams.

Implemented in depthCameraDriver, yarp::dev::RGBDSensorClient, realsense2Driver, and fakeDepthCameraDriver.

◆ getSensorStatus()

virtual RGBDSensor_status yarp::dev::IRGBDSensor::getSensorStatus ( )
pure virtual

Get the surrent status of the sensor, using enum type.

Returns
an enum representing the status of the robot or an error code if any error is present

Implemented in depthCameraDriver, yarp::dev::RGBDSensorClient, realsense2Driver, and fakeDepthCameraDriver.

◆ setDepthAccuracy()

bool yarp::dev::IRGBDSensor::setDepthAccuracy ( double  accuracy)
overridepure virtual

Set the minimum detectable variation in distance [meter] when possible.

Parameters
thedesired resolution in meters.
Returns
true on success

Implements yarp::dev::IDepthVisualParams.

Implemented in depthCameraDriver, yarp::dev::RGBDSensorClient, realsense2Driver, and fakeDepthCameraDriver.

◆ setDepthClipPlanes()

bool yarp::dev::IRGBDSensor::setDepthClipPlanes ( double  nearPlane,
double  farPlane 
)
overridepure virtual

Set the clipping planes of the sensor.

Parameters
nearPlaneminimum distance at which the sensor start measuring. Object closer than this distance will not be detected.
farPlanemaximum distance beyond which the sensor stop measuring. Object farther than this distance will not be detected.
Returns
true if success

Implements yarp::dev::IDepthVisualParams.

Implemented in depthCameraDriver, yarp::dev::RGBDSensorClient, realsense2Driver, and fakeDepthCameraDriver.

◆ setDepthFOV()

bool yarp::dev::IRGBDSensor::setDepthFOV ( double  horizontalFov,
double  verticalFov 
)
overridepure virtual

Set the field of view (FOV) of the depth camera.

Parameters
horizontalFovwill set the value of the horizontal fov in degrees
verticalFovwill set the value of the vertical fov in degrees
Returns
true on success

Implements yarp::dev::IDepthVisualParams.

Implemented in depthCameraDriver, yarp::dev::RGBDSensorClient, realsense2Driver, and fakeDepthCameraDriver.

◆ setDepthResolution()

bool yarp::dev::IRGBDSensor::setDepthResolution ( int  width,
int  height 
)
overridepure virtual

Set the resolution of the depth image from the camera.

Parameters
widthimage width
heightimage height
Returns
true on success

Implements yarp::dev::IDepthVisualParams.

Implemented in depthCameraDriver, yarp::dev::RGBDSensorClient, realsense2Driver, and fakeDepthCameraDriver.

◆ setRgbFOV()

bool yarp::dev::IRGBDSensor::setRgbFOV ( double  horizontalFov,
double  verticalFov 
)
overridepure virtual

Set the field of view (FOV) of the rgb camera.

Parameters
horizontalFovwill set the value of the horizontal fov in degrees
verticalFovwill set the value of the vertical fov in degrees
Returns
true on success

Implements yarp::dev::IRgbVisualParams.

Implemented in depthCameraDriver, yarp::dev::RGBDSensorClient, realsense2Driver, and fakeDepthCameraDriver.

◆ setRgbResolution()

bool yarp::dev::IRGBDSensor::setRgbResolution ( int  width,
int  height 
)
overridepure virtual

Set the resolution of the rgb image from the camera.

Parameters
widthimage width
heightimage height
Returns
true on success

Implements yarp::dev::IRgbVisualParams.

Implemented in depthCameraDriver, yarp::dev::RGBDSensorClient, realsense2Driver, and fakeDepthCameraDriver.


The documentation for this class was generated from the following file: