RecFusion SDK
Sensor Class Reference

#include <Sensor.h>

Provides access to RGB-D sensors supported by RecFusion, use SensorManager for instantiation. More...

Detailed Description

Provides access to RGB-D sensors supported by RecFusion, use SensorManager for instantiation.

Classes

struct  Format
 Structure representing the sensor format. More...
 

Public Member Functions

int deviceName (char *name, int len) const
 Get sensor name. More...
 
int uuid (char *name, int len) const
 Get sensor uuid. More...
 
int depthFormatCount ()
 Returns a number of depth stream formats supported by the sensor. More...
 
int colorFormatCount ()
 Returns a number of color stream formats supported by the sensor. More...
 
Format depthFormat (int id)
 Get a depth stream format. More...
 
Format colorFormat (int id)
 Get a color stream format. More...
 
bool open (int colorWidth=640, int colorHeight=480, int depthWidth=640, int depthHeight=480, double maxFps=30)
 Open sensor. More...
 
bool close ()
 Close sensor.
 
bool start ()
 Start callback-based capture.
 
void stop ()
 Stop callback-based capture.
 
bool isOpen () const
 Return true when sensor is open and ready for acquisition.
 
int depthWidth () const
 Return width of depth image returned by sensor.
 
int depthHeight () const
 Return height of depth image returned by sensor.
 
int colorWidth () const
 Return width of color image returned by sensor.
 
int colorHeight () const
 Return height of color image returned by sensor.
 
Mat3 depthIntrinsics () const
 Return depth sensor intrinsics as 3x3 matrix. Returns zero matrix when no depth intrinsics are available.
 
Mat3 colorIntrinsics () const
 Return color sensor intrinsics as 3x3 matrix. Returns zero matrix when no color intrinsics are available.
 
Mat4 depthToColorTransformation () const
 Return depth to color transformation as 4x4 matrix. Returns zero matrix when no transformation is available.
 
bool supportsColor () const
 Return true if sensor supports color.
 
bool setLaserState (bool enable)
 Turn laser on or off. More...
 
bool supportsAutoWhiteBalance () const
 Return true if sensor supports auto white-balance.
 
bool setAutoWhiteBalanceEnabled (bool enable)
 Set auto white-balance state. More...
 
bool isAutoWhiteBalanceEnabled () const
 Get auto white-balance state.
 
bool supportsAutoExposure () const
 Return true if sensor supports auto exposure.
 
bool setAutoExposureEnabled (bool enable)
 Set auto exposure state. More...
 
bool isAutoExposureEnabled () const
 Get auto exposure state.
 
bool setExposure (int exposureTimeMs)
 Set auto exposure to specified value in ms. Only works when auto exposure is disabled.
 
int exposure () const
 Get exposure time in non-auto mode in ms.
 
void addListener (SensorListener *listener)
 Register sensor listener. More...
 
void removeListener (const SensorListener *listener)
 Remove previously registered sensor listener. More...
 
bool readImage (DepthImage &imgDepth, ColorImage &imgColor, int timeOut=2000)
 Read image from sensor. More...
 

Member Function Documentation

◆ deviceName()

int deviceName ( char *  name,
int  len 
) const

Get sensor name.

Parameters
[out]nameOutput char buffer for sensor name.
[in]lenOutput buffer length.
Returns
Return codes: >= 0 sensor name length, < 0 error (-1 sensor manager was destroyed, -2 output name buffer too small).

◆ uuid()

int uuid ( char *  name,
int  len 
) const

Get sensor uuid.

Parameters
[out]nameOutput char buffer for sensor uuid.
[in]lenOutput buffer length.
Returns
Return codes: >= 0 sensor name length, < 0 error (-1 sensor manager was destroyed, -2 output name buffer too small).

◆ depthFormatCount()

int depthFormatCount ( )

Returns a number of depth stream formats supported by the sensor.

Returns 0 if available formats could not be queried. Must be called before depth formats can be queried.

◆ colorFormatCount()

int colorFormatCount ( )

Returns a number of color stream formats supported by the sensor.

Returns 0 if available formats could not be queried. Must be called before color formats can be queried.

◆ depthFormat()

Format depthFormat ( int  id)

Get a depth stream format.

depthFormatCount must be called first.

Parameters
idFormat ID in the range 0 to depthFormatCount-1
Returns
Return stream format. All values are set to 0 if invalid index is provided

◆ colorFormat()

Format colorFormat ( int  id)

Get a color stream format.

colorFormatCount must be called first.

Parameters
idFormat ID in the range 0 to colorFormatCount-1
Returns
Return stream format. All values are set to 0 if invalid index is provided

◆ open()

bool open ( int  colorWidth = 640,
int  colorHeight = 480,
int  depthWidth = 640,
int  depthHeight = 480,
double  maxFps = 30 
)

Open sensor.

Must be called before any other functions can be used.

Parameters
colorWidthDesired color image width.
colorHeightDesired color image height.
colorHeightDesired color image height.
depthWidthDesired depth image width.
depthHeightDesired depth image height.
maxFpsMaximum framerate to use.
Returns
True if sensor supports the requested resolution on both depth and color sensor and could be opened, false otherwise.

◆ setLaserState()

bool setLaserState ( bool  enable)

Turn laser on or off.

Parameters
enableTrue to enable, false to disable laser

◆ setAutoWhiteBalanceEnabled()

bool setAutoWhiteBalanceEnabled ( bool  enable)

Set auto white-balance state.

Parameters
enableTrue to enable, false to disable auto white-balance

◆ setAutoExposureEnabled()

bool setAutoExposureEnabled ( bool  enable)

Set auto exposure state.

Parameters
enableTrue to enable, false to disable auto exposure

◆ addListener()

void addListener ( SensorListener listener)

Register sensor listener.

Parameters
listenerSensor listener

◆ removeListener()

void removeListener ( const SensorListener listener)

Remove previously registered sensor listener.

Parameters
listenerSensor listener

◆ readImage()

bool readImage ( DepthImage imgDepth,
ColorImage imgColor,
int  timeOut = 2000 
)

Read image from sensor.

The images passed in need to be allocated by the caller.

Parameters
imgDepthPointer to depth image of size width() x heigt(). Will contain depth measurements in mm for valid pixels and zero for other pixels upon return.
imgColorPointer to depth image of size width() x heigt(). Will contain color image in RGB-format upon return.
timeOutTime out to wait for data in ms.
Returns
True if successful, false on error.

The documentation for this class was generated from the following file:
Search Tab / S to search, Esc to close