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

Represents the interface to the capabilities of the Nuitrack Gesture Recognizer module. More...

#include <GestureRecognizer.h>

Inherits HeaderOnlyAPI_Module.

Public Types

typedef std::shared_ptr
< GestureRecognizer
Ptr
 
typedef std::function< void(GestureData::Ptr)> OnNewGestures
 The callback type of the new gesture detection event. More...
 
typedef void(* OnNewGesturesRawFunctionPtr )(GestureData *, GestureRecognizer *)
 
typedef std::function< void(UserStateData::Ptr)> OnUserStateChange
 The callback type of the user state change event. More...
 
typedef void(* OnUserStateChangeRawFunctionPtr )(UserStateData *, GestureRecognizer *)
 
typedef std::function< void(UserGesturesStateData::Ptr)> OnUpdate
 The callback type of the user gesture data update request. More...
 
typedef void(* OnUpdateRawFunctionPtr )(UserGesturesStateData *, GestureRecognizer *)
 

Public Member Functions

 GestureRecognizer (NuitrackModule *pimpl)
 
uint64_t connectOnNewGestures (const OnNewGestures &callback)
 Add a callback for the new gesture detection event. More...
 
void disconnectOnNewGestures (uint64_t handler)
 Remove a callback of the new gesture detection event. More...
 
uint64_t connectOnUserStateChange (const OnUserStateChange &callback)
 Add a callback for the user state change event. More...
 
void disconnectOnUserStateChange (uint64_t handler)
 Remove a callback of the user state change event. More...
 
uint64_t connectOnUpdate (const OnUpdate &callback)
 Add a callback for the gesture state data update request. More...
 
void disconnectOnUpdate (uint64_t handler)
 Remove a callback of the gesture state data update request. More...
 
float getProcessingTime () const
 Returns last gesture recognition time in milliseconds.
 
void setControlGesturesStatus (bool status)
 Set control gesture recognition state. More...
 
void destroyGestureRecognizer ()
 
bool canUpdate () const
 
virtual uint64_t getTimestamp ()
 Returns the last processed data timestamp in microseconds. More...
 

Static Public Member Functions

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

Static Protected Member Functions

static void onNewGesturesCallback (GestureRecognizerData *data, GestureRecognizer *tracker)
 
static void onUserStateChangeCallback (UsersStateChanges *data, GestureRecognizer *tracker)
 
static void onUpdateCallback (GestureRecognizerUserGesturesStateData *data, GestureRecognizer *tracker)
 

Protected Attributes

NuitrackModule * _pimpl
 
GestureRecognizerCallbackWrapper _callbackWrapper
 
CallbackStruct
< GestureData::Ptr > * 
_onNewGesturesCallbackStruct
 
CallbackStruct
< UserStateData::Ptr > * 
_onUserStateChangeCallbackStruct
 
CallbackStruct
< UserGesturesStateData::Ptr > * 
_onUpdateCallbackStruct
 

Detailed Description

Represents the interface to the capabilities of the Nuitrack Gesture Recognizer module.

To enable the module, you must create an instance of this class. To create the instance, use a special named constructor GestureRecognizer::create. This instance is called GestureRecognizer module object. To receive the gesture progress estimation data, add an GestureRecognizer::OnUpdate callback to the module object with GestureRecognizer::connectOnUpdate method. To handle event of user state change, add GestureRecognizer::OnUserStateChange callback with SkeletonTracker::connectOnUserStateChange method. To handle event of new gesture detection, add GestureRecognizer::OnNewGestures callback with SkeletonTracker::connectOnNewGestures method.

Member Typedef Documentation

typedef std::function<void (GestureData::Ptr)> tdv::nuitrack::GestureRecognizer::OnNewGestures

The callback type of the new gesture detection event.

This callback is called when it is detected that the user is performing a new gesture. This callback receive a smart pointer to GestureData.

See Also
connectOnNewGestures
typedef std::function<void (UserGesturesStateData::Ptr)> tdv::nuitrack::GestureRecognizer::OnUpdate

The callback type of the user gesture data update request.

This callback receive a smart pointer to UserGesturesStateData.

See Also
tdv::nuitrack::UserGesturesStateData
tdv::nuitrack::UserGesturesState
connectOnUpdate
typedef std::function<void (UserStateData::Ptr)> tdv::nuitrack::GestureRecognizer::OnUserStateChange

The callback type of the user state change event.

This callback will be called when it is detected that the user state has changed. This callback receive a smart pointer to UserStateData.

See Also
connectOnUserStateChange

Constructor & Destructor Documentation

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

Member Function Documentation

uint64_t tdv::nuitrack::GestureRecognizer::connectOnNewGestures ( const OnNewGestures callback)
inline

Add a callback for the new gesture detection event.

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

Add a callback for the gesture state data update request.

Parameters
[in]callbackCallback to be invoked after the gesture state data update request.
Returns
Callback ID. You can use it to remove the callback.
See Also
disconnectOnUpdate
uint64_t tdv::nuitrack::GestureRecognizer::connectOnUserStateChange ( const OnUserStateChange callback)
inline

Add a callback for the user state change event.

Parameters
[in]callbackCallback to be invoked after the skeleton data update request, if it is detected that the user state has changed.
Returns
Registered callback ID. You can use it to remove the callback.
See Also
disconnectOnUserStateChange
static GestureRecognizer::Ptr tdv::nuitrack::GestureRecognizer::create ( )
inlinestatic

Create the GestureRecognizer module object.

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

Remove a callback of the new gesture detection event.

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

Remove a callback of the gesture state data update request.

Parameters
[in]handlerID of the previously added callback.
See Also
connectOnUpdate
void tdv::nuitrack::GestureRecognizer::disconnectOnUserStateChange ( uint64_t  handler)
inline

Remove a callback of the user state change event.

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

Returns the last processed data timestamp in microseconds.

Returns timestamp corresponding to the last estimation of gestures.

Note
The exact meaning of this value depends on the depth provider.
static void tdv::nuitrack::GestureRecognizer::onNewGesturesCallback ( GestureRecognizerData *  data,
GestureRecognizer tracker 
)
inlinestaticprotected
Warning
For internal use only.
static void tdv::nuitrack::GestureRecognizer::onUpdateCallback ( GestureRecognizerUserGesturesStateData *  data,
GestureRecognizer tracker 
)
inlinestaticprotected
Warning
For internal use only.
static void tdv::nuitrack::GestureRecognizer::onUserStateChangeCallback ( UsersStateChanges *  data,
GestureRecognizer tracker 
)
inlinestaticprotected
Warning
For internal use only.
void tdv::nuitrack::GestureRecognizer::setControlGesturesStatus ( bool  status)
inline

Set control gesture recognition state.

Call setControlGesturesStatus(true) to enable control gestures. Call setControlGesturesStatus(false) to disable control gestures.

Parameters
[in]statusControl gesture recognition state to be set.

Member Data Documentation

GestureRecognizerCallbackWrapper tdv::nuitrack::GestureRecognizer::_callbackWrapper
protected
Warning
For internal use only.
CallbackStruct<GestureData::Ptr>* tdv::nuitrack::GestureRecognizer::_onNewGesturesCallbackStruct
protected
Warning
For internal use only.
NuitrackModule* tdv::nuitrack::GestureRecognizer::_pimpl
protected
Warning
For internal use only.