RecFusion SDK
 All Classes Functions Variables Enumerations Enumerator
RecFusion::Sensor Class Reference

Provides access to OpenNI-based RGB-D sensors. More...

Public Member Functions

 Sensor ()
 Create Sensor object. To open the sensor, enumerate the available devices and open a sensor by its URI.
 
 ~Sensor ()
 Destroy Sensor object.
 
int deviceCount () const
 Get number of available sensors. More...
 
int deviceName (int id, char *name, int len) const
 Get sensor name. More...
 
bool open (int id=0, 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. More...
 
bool close ()
 Close sensor.
 
bool start ()
 Start callback-based capture.
 
void stop ()
 Stop callback-based capture.
 
bool readImage (DepthImage &imgDepth, ColorImage &imgColor, int timeOut=2000)
 Read image from sensor. The images passed in need to be allocated by the caller. More...
 
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 false when no depth intrinsics are available.
 
Mat3 colorIntrinsics () const
 Return color sensor intrinsics as 3x3 matrix. Returns false when no color intrinsics are 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.
 
void addListener (SensorListener *listener)
 Register sensor listener. More...
 
void removeListener (const SensorListener *listener)
 Remove previously registered sensor listener. More...
 

Detailed Description

Provides access to OpenNI-based RGB-D sensors.

Member Function Documentation

void RecFusion::Sensor::addListener ( SensorListener listener)

Register sensor listener.

Parameters
listenerSensor listener
int RecFusion::Sensor::deviceCount ( ) const

Get number of available sensors.

Returns
Number of available sensors.
int RecFusion::Sensor::deviceName ( int  id,
char *  name,
int  len 
) const

Get sensor name.

Parameters
idSensor ID in the range 0 to deviceCount-1
[out]nameOutput char buffer for sensor name.
[in]lenOutput buffer length.
Returns
Return codes: >= 0 sensor name length, < 0 error (-1 invalid sensor number, -2 output name buffer too small).
bool RecFusion::Sensor::open ( int  id = 0,
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
idSensor number (0 to deviceCount-1).
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.
bool RecFusion::Sensor::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.
void RecFusion::Sensor::removeListener ( const SensorListener listener)

Remove previously registered sensor listener.

Parameters
listenerSensor listener
bool RecFusion::Sensor::setAutoExposureEnabled ( bool  enable)

Set auto exposure state.

Parameters
enableTrue to enable, false to disable auto exposure
bool RecFusion::Sensor::setAutoWhiteBalanceEnabled ( bool  enable)

Set auto white-balance state.

Parameters
enableTrue to enable, false to disable auto white-balance
bool RecFusion::Sensor::setLaserState ( bool  enable)

Turn laser on or off.

Parameters
enableTrue to enable, false to disable laser

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