Nuitrack  1.4.0
3D Skeleton Tracking Middleware
tdv::nuitrack::SkeletonTracker Class Reference

Represents the interface to the capabilities of the Nuitrack Skeleton Tracker module. More...

#include <SkeletonTracker.h>

Inheritance diagram for tdv::nuitrack::SkeletonTracker:
Inheritance graph

Public Types

typedef std::shared_ptr< SkeletonTrackerPtr
 Smart pointer to access the SkeletonTracker instance. More...
 
typedef std::function< void(SkeletonData::Ptr)> OnUpdate
 The callback type of the skeleton data update request. More...
 
typedef void(* OnUpdateRawFunctionPtr) (SkeletonData *, SkeletonTracker *)
 
typedef std::function< void(SkeletonTracker::Ptr, int)> OnNewUser
 The callback type of the new active user apearance event. More...
 
typedef void(* OnNewUserRawFunctionPtr) (SkeletonTracker *, int)
 
typedef std::function< void(SkeletonTracker::Ptr, int)> OnLostUser
 The callback type of the active user disapearance event. More...
 
typedef void(* OnLostUserRawFunctionPtr) (SkeletonTracker *, int)
 

Public Member Functions

 SkeletonTracker (NuitrackModule *pimpl)
 
 SkeletonTracker (NuitrackModule *pimpl, CallbackStruct< SkeletonData::Ptr > *onUpdateCallbackStruct, CallbackStruct2p< SkeletonTracker::Ptr, int > *onNewUserCallbackStruct, CallbackStruct2p< SkeletonTracker::Ptr, int > *onLostUserCallbackStruct)
 
uint64_t connectOnUpdate (const OnUpdate &callback)
 Add a callback for the skeleton data update request. More...
 
void disconnectOnUpdate (uint64_t handler)
 Remove a callback of the skeleton data update request. More...
 
uint64_t connectOnNewUser (const OnNewUser &callback)
 Add a callback for the new active user appearance event. More...
 
void disconnectOnNewUser (uint64_t handler)
 Remove a callback of the new active user appearance event. More...
 
uint64_t connectOnLostUser (const OnLostUser &callback)
 Add a callback for the active user disappearance event. More...
 
void disconnectOnLostUser (uint64_t handler)
 Remove a callback of the active user disappearance event. More...
 
void setNumActiveUsers (int numUsers)
 Set maximum number of users for tracking. More...
 
bool isAutoTracking () const
 Returns true if auto tracking is enabled, false otherwise. More...
 
void setAutoTracking (bool tracking)
 Set user skeleton auto tracking state. More...
 
void startTracking (int userID)
 Start tracking of a user. More...
 
void stopTracking (int userID)
 Stop tracking of a user. More...
 
bool isTracking (int userID)
 Get user tracking state. More...
 
SkeletonData::Ptr getSkeletons ()
 Returns smart pointer to the last avilable SkeletonData.
 
float getProcessingTime () const
 Returns last skeleton data processing time in milliseconds.
 
bool canUpdate () const
 
virtual uint64_t getTimestamp ()
 Returns the last processed data timestamp in microseconds. More...
 

Static Public Member Functions

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

Protected Member Functions

void destroySkeletonTracker ()
 

Static Protected Member Functions

static void onUpdateCallback (SkeletonTrackerData *frame, SkeletonTracker *tracker)
 
static void onNewUserCallback (SkeletonTracker *tracker, int usedID)
 
static void onLostUserCallback (SkeletonTracker *tracker, int usedID)
 

Protected Attributes

NuitrackModule * _pimpl
 
int8_t _isCopy
 
CallbackStruct< SkeletonData::Ptr > * _onUpdateCallbackStruct
 
CallbackStruct2p< SkeletonTracker::Ptr, int > * _onNewUserCallbackStruct
 
CallbackStruct2p< SkeletonTracker::Ptr, int > * _onLostUserCallbackStruct
 
SkeletonTrackerCallbackWrapper _callbackWrapper
 

Detailed Description

Represents the interface to the capabilities of the Nuitrack Skeleton Tracker module.

To enable the module, you must create an instance of this class. To create the instance, use a special named constructor SkeletonTracker::create. This instance is called SkeletonTracker module object. To receive the skeleton tracking data, add an SkeletonTracker::OnUpdate callback to the module object with SkeletonTracker::connectOnUpdate method. To handle events of appearance and disappearance of an active user, add SkeletonTracker::OnNewUser and SkeletonTracker::OnLostUser callbacks with SkeletonTracker::connectOnNewUser and SkeletonTracker::connectOnLostUser methods respectively.

Member Typedef Documentation

The callback type of the active user disapearance event.

This callback will be called if an active user disapears. This callback receive the ID of the lost active user.

See also
connectOnLostUser

The callback type of the new active user apearance event.

This callback will be called if a new active user appears. This callback receive the ID of the new active user.

See also
connectOnNewUser
typedef std::function<void (SkeletonData::Ptr)> tdv::nuitrack::SkeletonTracker::OnUpdate

The callback type of the skeleton data update request.

This callback receive a smart pointer to SkeletonData, which contains Skeleton array.

See also
tdv::nuitrack::SkeletonData
tdv::nuitrack::Skeleton
connectOnUpdate

Smart pointer to access the SkeletonTracker instance.

See also
create

Constructor & Destructor Documentation

tdv::nuitrack::SkeletonTracker::SkeletonTracker ( NuitrackModule *  pimpl)
inline
Warning
For internal use only.
tdv::nuitrack::SkeletonTracker::SkeletonTracker ( NuitrackModule *  pimpl,
CallbackStruct< SkeletonData::Ptr > *  onUpdateCallbackStruct,
CallbackStruct2p< SkeletonTracker::Ptr, int > *  onNewUserCallbackStruct,
CallbackStruct2p< SkeletonTracker::Ptr, int > *  onLostUserCallbackStruct 
)
inline
Warning
For internal use only.

Member Function Documentation

uint64_t tdv::nuitrack::SkeletonTracker::connectOnLostUser ( const OnLostUser callback)
inline

Add a callback for the active user disappearance event.

Parameters
[in]callbackCallback to be invoked after the skeleton data update request, if an active user is found to be missing.
Returns
Registered callback ID. You can use it to remove the callback.
See also
disconnectOnLostUser
uint64_t tdv::nuitrack::SkeletonTracker::connectOnNewUser ( const OnNewUser callback)
inline

Add a callback for the new active user appearance event.

Parameters
[in]callbackCallback to be invoked after the skeleton data update request, if a new active user is appeared.
Returns
Callback ID. You can use it to remove the callback.
See also
disconnectOnNewUser
uint64_t tdv::nuitrack::SkeletonTracker::connectOnUpdate ( const OnUpdate callback)
inline

Add a callback for the skeleton data update request.

Parameters
[in]callbackCallback to be invoked after the skeleton data update request.
Returns
Callback ID. You can use it to remove the callback.
See also
disconnectOnUpdate
static SkeletonTracker::Ptr tdv::nuitrack::SkeletonTracker::create ( )
inlinestatic

Create the SkeletonTracker module object.

Returns
Smart pointer to a new SkeletonTracker instance.
Note
Do not call this method twice. Instead, use the previously received SkeletonTracker::Ptr.
void tdv::nuitrack::SkeletonTracker::destroySkeletonTracker ( )
inlineprotected
Warning
For internal use only.
void tdv::nuitrack::SkeletonTracker::disconnectOnLostUser ( uint64_t  handler)
inline

Remove a callback of the active user disappearance event.

Parameters
[in]handlerID of the previously added callback.
See also
connectOnLostUser
void tdv::nuitrack::SkeletonTracker::disconnectOnNewUser ( uint64_t  handler)
inline

Remove a callback of the new active user appearance event.

Parameters
[in]handlerID of the previously added callback.
See also
connectOnNewUser
void tdv::nuitrack::SkeletonTracker::disconnectOnUpdate ( uint64_t  handler)
inline

Remove a callback of the skeleton data update request.

Parameters
[in]handlerID of the previously added callback.
See also
connectOnUpdate
virtual uint64_t tdv::nuitrack::SkeletonTracker::getTimestamp ( )
inlinevirtual

Returns the last processed data timestamp in microseconds.

Returns timestamp corresponding to the last estimation of the skeletal pose.

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

Returns true if auto tracking is enabled, false otherwise.

Note
The default value is determined by the Nuitrack config file.
See also
setAutoTracking
bool tdv::nuitrack::SkeletonTracker::isTracking ( int  userID)
inline

Get user tracking state.

Returns
True if user is being tracked, false otherwise.
See also
startTracking
stopTracking
static void tdv::nuitrack::SkeletonTracker::onLostUserCallback ( SkeletonTracker tracker,
int  usedID 
)
inlinestaticprotected
Warning
For internal use only.
static void tdv::nuitrack::SkeletonTracker::onNewUserCallback ( SkeletonTracker tracker,
int  usedID 
)
inlinestaticprotected
Warning
For internal use only.
static void tdv::nuitrack::SkeletonTracker::onUpdateCallback ( SkeletonTrackerData *  frame,
SkeletonTracker tracker 
)
inlinestaticprotected
Warning
For internal use only.
void tdv::nuitrack::SkeletonTracker::setAutoTracking ( bool  tracking)
inline

Set user skeleton auto tracking state.

Call setAutoTracking(true) to enable auto tracking. Call setAutoTracking(false) to disable auto tracking.

When auto tracking is enabled, tracking of the skeleton of a user begins immediately when the user appears in the frame. Otherwise, you must manually start tracking of the user's skeleton.

Parameters
[in]trackingAuto tracking state to be set.
See also
startTracking
connectOnNewUser
isAutoTracking
void tdv::nuitrack::SkeletonTracker::setNumActiveUsers ( int  numUsers)
inline

Set maximum number of users for tracking.

Note
The function supports tracking from 0 to 6 users. By default, the skeleton of 2 users is tracked. Tracking of more than 2 users may lead to performance loss.
Parameters
[in]numUsersMaximum active user number to be set.
void tdv::nuitrack::SkeletonTracker::startTracking ( int  userID)
inline

Start tracking of a user.

Parameters
[in]userIDID of user which tracking should be started.
See also
stopTracking
isTracking
void tdv::nuitrack::SkeletonTracker::stopTracking ( int  userID)
inline

Stop tracking of a user.

Parameters
[in]userIDID of user which tracking should be stopped.
See also
startTracking
isTracking

Member Data Documentation

SkeletonTrackerCallbackWrapper tdv::nuitrack::SkeletonTracker::_callbackWrapper
protected
Warning
For internal use only.
int8_t tdv::nuitrack::SkeletonTracker::_isCopy
protected
Warning
For internal use only.
CallbackStruct2p<SkeletonTracker::Ptr, int>* tdv::nuitrack::SkeletonTracker::_onLostUserCallbackStruct
protected
Warning
For internal use only.
CallbackStruct2p<SkeletonTracker::Ptr, int>* tdv::nuitrack::SkeletonTracker::_onNewUserCallbackStruct
protected
Warning
For internal use only.
CallbackStruct<SkeletonData::Ptr>* tdv::nuitrack::SkeletonTracker::_onUpdateCallbackStruct
protected
Warning
For internal use only.
NuitrackModule* tdv::nuitrack::SkeletonTracker::_pimpl
protected
Warning
For internal use only.