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

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

#include <UserTracker.h>

Inherits HeaderOnlyAPI_Module.

Public Types

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

Public Member Functions

 UserTracker (NuitrackModule *pimpl)
 
uint64_t connectOnUpdate (const OnUpdate &callback)
 Add a callback for the user frame update request. More...
 
void disconnectOnUpdate (uint64_t handler)
 Remove a callback of the user frame update request. More...
 
uint64_t connectOnNewUser (const OnNewUser &callback)
 Add a callback for the new user appearance event. More...
 
void disconnectOnNewUser (uint64_t handler)
 Remove a callback of the new user appearance event. More...
 
uint64_t connectOnLostUser (const OnLostUser &callback)
 Add a callback for the user disappearance event. More...
 
void disconnectOnLostUser (uint64_t handler)
 Remove a callback of the user disappearance event. More...
 
UserFrame::Ptr getUserFrame ()
 Returns smart pointer to the last avilable UserFrame.
 
float getProcessingTime () const
 Returns last frame 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 UserTracker::Ptr create ()
 Create the UserTracker module object. More...
 

Detailed Description

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

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

Member Typedef Documentation

typedef std::function<void (int)> tdv::nuitrack::UserTracker::OnLostUser

The callback type of the user disapearance event.

This callback will be called if a user disapears from the frame. This callback receive the ID of the lost user.

See Also
connectOnLostUser
typedef std::function<void (int)> tdv::nuitrack::UserTracker::OnNewUser

The callback type of the new user apearance event.

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

See Also
connectOnNewUser
typedef std::function<void (UserFrame::Ptr)> tdv::nuitrack::UserTracker::OnUpdate

The callback type of the user frame update request.

See Also
tdv::nuitrack::UserFrame
tdv::nuitrack::User
connectOnUpdate
typedef std::shared_ptr<UserTracker> tdv::nuitrack::UserTracker::Ptr

Smart pointer to access the UserTracker instance.

See Also
create

Constructor & Destructor Documentation

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

Member Function Documentation

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

Add a callback for the user disappearance event.

Parameters
[in]callbackCallback to be invoked after the user frame update request, if a 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::UserTracker::connectOnNewUser ( const OnNewUser callback)
inline

Add a callback for the new user appearance event.

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

Add a callback for the user frame update request.

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

Create the UserTracker module object.

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

Remove a callback of the user disappearance event.

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

Remove a callback of the new user appearance event.

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

Remove a callback of the user frame update request.

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

Returns the last processed data timestamp in microseconds.

Returns timestamp corresponding to the depth data used in the last user detection.

Note
The exact meaning of this value depends on the depth provider.