1 #ifndef NUITRACK_SKELETONTRACKER_H_
2 #define NUITRACK_SKELETONTRACKER_H_
6 #include "nuitrack/modules/HeaderOnlyAPI_Module.h"
7 #include "nuitrack/types/Export.h"
8 #include "nuitrack/types/SkeletonData.h"
9 #include "nuitrack/capi/SkeletonTracker_CAPI.h"
10 #include "nuitrack/utils/ExceptionTranslator.h"
11 #include "nuitrack/utils/CallbackStruct.h"
39 typedef std::shared_ptr<SkeletonTracker>
Ptr;
49 typedef std::function<void (SkeletonData::Ptr)>
OnUpdate;
59 typedef std::function<void (SkeletonTracker::Ptr, int)>
OnNewUser;
69 typedef std::function<void (SkeletonTracker::Ptr, int)>
OnLostUser;
81 NuitrackModule* pimpl = NULL;
82 ExceptionType errorCode = nuitrack_CreateSkeletonTracker(&pimpl);
83 ExceptionTranslator::generateExceptionByErrorCode(errorCode);
105 SkeletonTracker(NuitrackModule* pimpl, CallbackStruct<SkeletonData::Ptr>* onUpdateCallbackStruct,
106 CallbackStruct2p<SkeletonTracker::Ptr, int>* onNewUserCallbackStruct,
107 CallbackStruct2p<SkeletonTracker::Ptr, int>* onLostUserCallbackStruct)
121 nuitrack_DestroySkeletonTracker(
_pimpl);
207 nuitrack_SetNumActiveUsers(
_pimpl, numUsers);
217 return nuitrack_IsAutoTracking(
_pimpl);
237 nuitrack_SetAutoTracking(
_pimpl, tracking);
249 nuitrack_StartTracking(
_pimpl, userID);
261 nuitrack_StopTracking(
_pimpl, userID);
273 return nuitrack_IsTracking(
_pimpl, userID);
281 SkeletonTrackerDataPtr data = nuitrack_GetSkeletonTrackerData(
_pimpl);
291 return nuitrack_GetSkeletonTrackerProcessingTime(
_pimpl);
294 bool canUpdate()
const
296 return nuitrack_GetNuitrackModuleCanUpdate(
_pimpl);
307 return nuitrack_GetNuitrackModuleTimestamp(
_pimpl);
SkeletonData::Ptr getSkeletons()
Returns smart pointer to the last avilable SkeletonData.
Definition: SkeletonTracker.h:279
float getProcessingTime() const
Returns last skeleton data processing time in milliseconds.
Definition: SkeletonTracker.h:289
void setNumActiveUsers(int numUsers)
Set maximum number of users for tracking.
Definition: SkeletonTracker.h:205
std::shared_ptr< SkeletonTracker > Ptr
Smart pointer to access the SkeletonTracker instance.
Definition: SkeletonTracker.h:39
ExceptionType
Possible error codes for Nuitrack internal functions.
Definition: Error.h:20
static void onNewUserCallback(SkeletonTracker *tracker, int usedID)
Definition: SkeletonTracker.h:320
void stopTracking(int userID)
Stop tracking of a user.
Definition: SkeletonTracker.h:259
Stores the data of all available skeletons at a certain point in time.
Definition: SkeletonData.h:19
SkeletonTracker(NuitrackModule *pimpl)
Definition: SkeletonTracker.h:88
void setAutoTracking(bool tracking)
Set user skeleton auto tracking state.
Definition: SkeletonTracker.h:235
static void onUpdateCallback(SkeletonTrackerData *frame, SkeletonTracker *tracker)
Definition: SkeletonTracker.h:312
CallbackStruct2p< SkeletonTracker::Ptr, int > * _onNewUserCallbackStruct
Definition: SkeletonTracker.h:356
SkeletonTracker(NuitrackModule *pimpl, CallbackStruct< SkeletonData::Ptr > *onUpdateCallbackStruct, CallbackStruct2p< SkeletonTracker::Ptr, int > *onNewUserCallbackStruct, CallbackStruct2p< SkeletonTracker::Ptr, int > *onLostUserCallbackStruct)
Definition: SkeletonTracker.h:105
uint64_t connectOnUpdate(const OnUpdate &callback)
Add a callback for the skeleton data update request.
Definition: SkeletonTracker.h:133
NuitrackModule * _pimpl
Definition: SkeletonTracker.h:352
virtual uint64_t getTimestamp()
Returns the last processed data timestamp in microseconds.
Definition: SkeletonTracker.h:305
Represents the interface to the capabilities of the Nuitrack Skeleton Tracker module.
Definition: SkeletonTracker.h:32
uint64_t connectOnLostUser(const OnLostUser &callback)
Add a callback for the active user disappearance event.
Definition: SkeletonTracker.h:181
void startTracking(int userID)
Start tracking of a user.
Definition: SkeletonTracker.h:247
void disconnectOnUpdate(uint64_t handler)
Remove a callback of the skeleton data update request.
Definition: SkeletonTracker.h:144
bool isTracking(int userID)
Get user tracking state.
Definition: SkeletonTracker.h:271
std::function< void(SkeletonTracker::Ptr, int)> OnNewUser
The callback type of the new active user apearance event.
Definition: SkeletonTracker.h:59
static void onLostUserCallback(SkeletonTracker *tracker, int usedID)
Definition: SkeletonTracker.h:331
void disconnectOnLostUser(uint64_t handler)
Remove a callback of the active user disappearance event.
Definition: SkeletonTracker.h:192
CallbackStruct2p< SkeletonTracker::Ptr, int > * _onLostUserCallbackStruct
Definition: SkeletonTracker.h:357
CallbackStruct< SkeletonData::Ptr > * _onUpdateCallbackStruct
Definition: SkeletonTracker.h:355
uint64_t connectOnNewUser(const OnNewUser &callback)
Add a callback for the new active user appearance event.
Definition: SkeletonTracker.h:157
bool isAutoTracking() const
Returns true if auto tracking is enabled, false otherwise.
Definition: SkeletonTracker.h:215
std::function< void(SkeletonData::Ptr)> OnUpdate
The callback type of the skeleton data update request.
Definition: SkeletonTracker.h:49
void disconnectOnNewUser(uint64_t handler)
Remove a callback of the new active user appearance event.
Definition: SkeletonTracker.h:168
SkeletonTrackerCallbackWrapper _callbackWrapper
Definition: SkeletonTracker.h:359
std::function< void(SkeletonTracker::Ptr, int)> OnLostUser
The callback type of the active user disapearance event.
Definition: SkeletonTracker.h:69
int8_t _isCopy
Definition: SkeletonTracker.h:353
static SkeletonTracker::Ptr create()
Create the SkeletonTracker module object.
Definition: SkeletonTracker.h:79
void destroySkeletonTracker()
Definition: SkeletonTracker.h:342