Nuitrack  1.4.1
3D Skeleton Tracking Middleware
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Properties Events Groups Pages
tdv::nuitrack::DepthSensor Class Reference

Represents the interface to the capabilities of the Nuitrack Depth Sensor module. More...

#include <DepthSensor.h>

Inheritance diagram for tdv::nuitrack::DepthSensor:
Inheritance graph

Public Types

typedef std::shared_ptr
< DepthSensor
Ptr
 Smart pointer to access the DepthSensor instance. More...
 
typedef std::function< void(DepthFrame::Ptr)> OnNewFrame
 The callback type of the new depth frame request. More...
 

Public Member Functions

 DepthSensor (NuitrackModule *pimpl)
 
const OutputMode getOutputMode () const
 Returns output mode of depth sensor.
 
bool isMirror () const
 Returns true if mirror mode is enabled, false otherwise. More...
 
void setMirror (bool mirror)
 Set mirror mode state. More...
 
uint64_t connectOnNewFrame (const OnNewFrame &callback)
 Add a callback for the new depth frame request. More...
 
void disconnectOnNewFrame (uint64_t handler)
 Remove a callback of the new depth frame request. More...
 
DepthFrame::Ptr getDepthFrame ()
 Returns smart pointer to the last available DepthFrame.
 
Vector3 convertProjToRealCoords (const Vector3 &p) const
 Convert projective coordinates to real world coordinates from Vector3 point. More...
 
virtual Vector3 convertProjToRealCoords (size_t x, size_t y, DepthFrame::DataType depth) const
 Convert projective coordinates to real world coordinates from x, y and depth map. More...
 
virtual Vector3 convertRealToProjCoords (const Vector3 &p) const
 Convert real world coordinates to projective coordinates from Vector3 point. More...
 
virtual Vector3 convertRealToProjCoords (float x, float y, float z) const
 Convert real world coordinates to projective coordinates from x, y, z. More...
 
bool canUpdate () const
 
virtual uint64_t getTimestamp ()
 Returns the last processed data timestamp in microseconds. More...
 

Static Public Member Functions

static DepthSensor::Ptr create ()
 Create the DepthSensor module object. More...
 

Detailed Description

Represents the interface to the capabilities of the Nuitrack Depth Sensor module.

To enable the module, you must create an instance of this class. To create the instance, use a special named constructor DepthSensor::create. This instance is called DepthSensor module object. To receive the new depth frames, add an DepthSensor::OnNewFrame callback to the module object with DepthSensor::connectOnNewFrame method. Use DepthSensor::convertProjToRealCoords to convert coordinates from the projective system to the world and DepthSensor::convertProjToRealCoords for reverse conversion.

Member Typedef Documentation

typedef std::function<void (DepthFrame::Ptr)> tdv::nuitrack::DepthSensor::OnNewFrame

The callback type of the new depth frame request.

See Also
tdv::nuitrack::DepthFrame
connectOnNewFrame
typedef std::shared_ptr<DepthSensor> tdv::nuitrack::DepthSensor::Ptr

Smart pointer to access the DepthSensor instance.

See Also
create

Constructor & Destructor Documentation

tdv::nuitrack::DepthSensor::DepthSensor ( NuitrackModule *  pimpl)
inline
Warning
For internal use only.

Member Function Documentation

uint64_t tdv::nuitrack::DepthSensor::connectOnNewFrame ( const OnNewFrame callback)
inline

Add a callback for the new depth frame request.

Parameters
[in]callbackCallback to be invoked at the new depth frame request.
Returns
Callback ID. You can use it to remove the callback.
See Also
disconnectOnNewFrame
Vector3 tdv::nuitrack::DepthSensor::convertProjToRealCoords ( const Vector3 p) const
inline

Convert projective coordinates to real world coordinates from Vector3 point.

Parameters
[in]pProjective point coordinates.
Returns
Converted real world point.
virtual Vector3 tdv::nuitrack::DepthSensor::convertProjToRealCoords ( size_t  x,
size_t  y,
DepthFrame::DataType  depth 
) const
inlinevirtual

Convert projective coordinates to real world coordinates from x, y and depth map.

Parameters
[in]x,yProjective point coordinates.
[in]depthDepth map.
Returns
Converted real world point.
virtual Vector3 tdv::nuitrack::DepthSensor::convertRealToProjCoords ( const Vector3 p) const
inlinevirtual

Convert real world coordinates to projective coordinates from Vector3 point.

Parameters
[in]pReal world point coordinates.
Returns
Converted projective point.
virtual Vector3 tdv::nuitrack::DepthSensor::convertRealToProjCoords ( float  x,
float  y,
float  z 
) const
inlinevirtual

Convert real world coordinates to projective coordinates from x, y, z.

Parameters
[in]x,y,zReal world point coordinates.
Returns
Converted projective point.
static DepthSensor::Ptr tdv::nuitrack::DepthSensor::create ( )
inlinestatic

Create the DepthSensor module object.

Returns
Smart pointer to a new DepthSensor instance.
Note
Do not call this method twice. Instead, use the previously received DepthSensor::Ptr.
void tdv::nuitrack::DepthSensor::disconnectOnNewFrame ( uint64_t  handler)
inline

Remove a callback of the new depth frame request.

Parameters
[in]handlerID of the previously added callback.
See Also
connectOnNewFrame
virtual uint64_t tdv::nuitrack::DepthSensor::getTimestamp ( )
inlinevirtual

Returns the last processed data timestamp in microseconds.

Returns timestamp corresponding to the last available depth frame.

Note
The exact meaning of this value depends on the depth provider.
bool tdv::nuitrack::DepthSensor::isMirror ( ) const
inline

Returns true if mirror mode is enabled, false otherwise.

See Also
setMirror
void tdv::nuitrack::DepthSensor::setMirror ( bool  mirror)
inline

Set mirror mode state.

Call setMirror(true) to enable mirror mode. Call setMirror(false) to disable mirror mode.

If the mirror mode is on, the depth map from the sensor will be reflected horizontally before consequent processing.

Parameters
[in]mirrorMirror mode state to be set.
See Also
isMirror