#include <XnVSessionManager.h>
Classes | |
struct | GestureDescription |
Public Member Functions | |
XnVSessionManager (const XnChar *strName="XnVSessionManager") | |
~XnVSessionManager () | |
XnStatus | Initialize (xn::Context *pContext, const XnChar *strUseAsFocus, const XnChar *strUseAsQuickRefocus, xn::HandsGenerator *pTracker=NULL, xn::GestureGenerator *pFocusGenerator=NULL, xn::GestureGenerator *pQuickRefocusGenerator=NULL) |
void | Update (XnVMessage *pMessage) |
void | Update (const xn::Context *pContext) |
void | ProcessPoints (XnVMultipleHands *pHands) |
void | SetTracker (XnVPointTracker *pTracker) |
void | SetTracker (xn::HandsGenerator generator) |
void | SetQuickRefocusTimeout (XnUInt32 nMilliseconds) |
XnUInt32 | GetQuickRefocusTimeout () const |
XnStatus | LosePoint (XnUInt32 nID) |
XnStatus | LosePoints () |
XnStatus | EndSession () |
XnStatus | ForceSession (const XnPoint3D &ptFocus) |
XnStatus | TrackPoint (const XnPoint3D &pt) |
void | ClearQueue () |
XnStatus | SetQuickRefocusArea (const XnBoundingBox3D &bbQuickRefocusArea) |
XnStatus | SetQuickRefocusArea (XnFloat fLengthX, XnFloat fLengthY, XnFloat fLengthZ) |
void | GetQuickRefocusArea (XnFloat &fLengthX, XnFloat &fLengthY, XnFloat &fLengthZ) |
void | ForceQuickRefocus (XnBoundingBox3D *pbbForcedArea, XnUInt32 nForcedTimeout) |
XnUInt32 | AddGesture (XnVGesture *pGesture) |
XnUInt32 | AddGesture (xn::GestureGenerator &generator, const XnChar *strName) |
XnUInt32 | AddGesture (xn::Context &context, const XnChar *strName) |
void | RemoveGesture (XnUInt32 nId) |
XnUInt32 | AddQuickRefocus (XnVGesture *pGesture) |
XnUInt32 | AddQuickRefocus (xn::GestureGenerator &generator, const XnChar *strName) |
XnUInt32 | AddQuickRefocus (xn::Context &context, const XnChar *strName) |
void | RemoveQuickRefocus (XnUInt32 nId) |
void | StartPrimaryStatic () |
void | StopPrimaryStatic () |
void | SetPrimaryStaticTimeout (XnFloat fTimeout) |
XnFloat | GetPrimarySteadyTimeout () const |
void | SetPrimaryStaticBoundingBox (XnFloat fX, XnFloat fY, XnFloat fZ) |
void | GetPrimaryStaticBoundingBox (XnFloat &fX, XnFloat &fY, XnFloat &fZ) |
XnStatus | XN_API_DEPRECATED ("Please use Initialize() instead.") Initialize(XnVGesture *pFocusGesture |
void | XN_API_DEPRECATED ("Please use AddGesture() instead.") SetGesture(XnVGesture *pGesture) |
Public Attributes | |
XnStatus XnVGesture * | pQuickRefocusGesture |
XnStatus XnVGesture XnVPointTracker * | pTracker |
Protected Types | |
enum | { SMGR_ILLEGAL = 0x0000, SMGR_NOT_IN_SESSION = 0x0001, SMGR_IN_SESSION = 0x0002, SMGR_QUICK_REFOCUS = SMGR_IN_SESSION | SMGR_NOT_IN_SESSION, SMGR_START_SESSION = 0x0004 } |
Protected Member Functions | |
void | SessionStop () |
void | StartQuickRefocus (XnBoundingBox3D *pbbROI, XnUInt32 nTimeout) |
XnStatus | FindTracker (xn::Context *pContext, xn::HandsGenerator *pTracker, xn::HandsGenerator &tracker) |
void | GestureRecognized (const XnChar *strGesture, const XnPoint3D &ptIDPosition, const XnPoint3D &ptEndPosition) |
void | GestureStartRecognized (const XnChar *strGesture, const XnPoint3D &pos, XnFloat fProgress) |
XnUInt64 | GetTime () |
void | EnableGestures (XnBoundingBox3D *pROI=NULL) |
void | EnableQuickRefocusGestures (XnBoundingBox3D *pROI=NULL) |
void | DisableGestures () |
void | DisableQuickRefocusGestures () |
void | UpdateGestures (const xn::Context *pContext) |
void | UpdateQuickRefocusGestures (const xn::Context *pContext) |
XN_DECLARE_DEFAULT_HASH (XnUInt32, GestureDescription *, GestureHash) | |
void | ClearGestureHash (GestureHash &hash) |
XnUInt32 | AddGesture (XnVGesture *pGesture, XnBool bAuto, XnUInt32 nHintID, XnBool bFocus) |
XnUInt32 | AddGesture (xn::Context &context, const XnChar *strName, const XnStringsHash &hash, XnBool bFocus) |
XnUInt32 | AddGesture (xn::GestureGenerator &generator, const XnChar *strName, const XnStringsHash &hash, XnBool bFocus) |
void | RemoveGesture (XnUInt32 nId, GestureHash &hash) |
XnBool | IsInSession () const |
XnBool | IsNotInSession () const |
XnBool | IsQuickRefocus () const |
void | InitializeStatic () |
void | FinalizeStatic () |
Static Protected Member Functions | |
static void XN_CALLBACK_TYPE | Gesture_Recognized (const XnChar *strGesture, const XnPoint3D &ptIDPosition, const XnPoint3D &ptEndPosition, void *cxt) |
static void XN_CALLBACK_TYPE | Gesture_StartRecognized (const XnChar *strGesture, const XnPoint3D &pos, XnFloat fProgress, void *cxt) |
static void XN_CALLBACK_TYPE | PrimaryIsSteady (XnUInt32 id, XnFloat dummy, void *cxt) |
static void XN_CALLBACK_TYPE | PrimaryIsNotSteady (XnUInt32 id, XnFloat dummy, void *cxt) |
Protected Attributes | |
XnBool | m_bGesturesEnabled |
XnBool | m_bQuickRefocusEnabled |
GestureHash | m_MainGestures |
GestureHash | m_QuickRefocusGestures |
XnUInt32 | m_nNextGestureID |
XnVPointTracker * | m_pTracker |
XnBool | m_bAutoTracker |
enum XnVSessionManager:: { ... } | m_eSessionState |
XnBool | m_bQuickRefocusAllowed |
XnCallbackHandle | m_hGesture |
XnCallbackHandle | m_hGestureMid |
XnCallbackHandle | m_hQRGesture |
XnUInt32 | m_nQuickRefocusTimeout |
XnUInt64 | m_nQuickRefocusExpire |
XnV3DVector | m_ptLastPrimaryPosition |
XnBoundingBox3D | m_bbQuickRefocusArea |
const xn::Context * | m_pContext |
XnBool | m_bCheckPrimaryForStatic |
XnBool | m_bPrimaryIsStatic |
XnVSteadyDetector * | m_pSteadyDetector |
XnFloat | m_fLastSteadyTime |
XnFloat | m_fLastPrimaryTime |
XnFloat | m_fSteadyTimeout |
XnUInt32 | m_nLastPrimaryID |
XnPoint3D | m_GestureWhileTrackingThreshold |
Static Protected Attributes | |
static const XnUInt32 | ms_nQuickRefocusDefaultTimeout |
A XnVSessionManager manages the session state Possible states are: Not In Session - Looking for the main gesture. Changing to this state is a "SessionStop" event. In Session - Tracking hand points. Changing to this state is a "SessionStart" event. Quick refocus - lost last point, looking for it where it disappeared, and for main gesture
Initial mode is "Not in session"
Definition at line 31 of file XnVSessionManager.h.
anonymous enum [protected] |
Definition at line 321 of file XnVSessionManager.h.
XnVSessionManager::XnVSessionManager | ( | const XnChar * | strName = "XnVSessionManager" |
) |
Constructor. Create a new Session Manager
[in] | strName | A name, for Log use |
XnVSessionManager::~XnVSessionManager | ( | ) |
XnUInt32 XnVSessionManager::AddGesture | ( | XnVGesture * | pGesture | ) |
Add user-defined gesture to be used as a focus gesture
[in] | pGesture | User-defined gesture |
XnUInt32 XnVSessionManager::AddGesture | ( | xn::GestureGenerator & | generator, | |
const XnChar * | strName | |||
) |
Add gesture to be used as a focus gesture, by gesture generator (OpenNI) and name
[in] | generator | Generator with the wanted gesture |
[in] | strName | Name of the wanted gesture in the generator |
XnUInt32 XnVSessionManager::AddGesture | ( | xn::Context & | context, | |
const XnChar * | strName | |||
) |
Add user-defined gesture to be used as a focus gesture, by OpenNI context and name
[in] | context | OpenNI context |
[in] | strName | Name of gesture, to be searched in all gesture generators |
XnUInt32 XnVSessionManager::AddGesture | ( | XnVGesture * | pGesture, | |
XnBool | bAuto, | |||
XnUInt32 | nHintID, | |||
XnBool | bFocus | |||
) | [protected] |
XnUInt32 XnVSessionManager::AddGesture | ( | xn::Context & | context, | |
const XnChar * | strName, | |||
const XnStringsHash & | hash, | |||
XnBool | bFocus | |||
) | [protected] |
XnUInt32 XnVSessionManager::AddGesture | ( | xn::GestureGenerator & | generator, | |
const XnChar * | strName, | |||
const XnStringsHash & | hash, | |||
XnBool | bFocus | |||
) | [protected] |
XnUInt32 XnVSessionManager::AddQuickRefocus | ( | XnVGesture * | pGesture | ) |
Add user-defined gesture to be used as a quick refocus gesture
[in] | pGesture | User-defined gesture |
XnUInt32 XnVSessionManager::AddQuickRefocus | ( | xn::Context & | context, | |
const XnChar * | strName | |||
) |
Add user-defined gesture to be used as a quick refocus gesture, by OpenNI context and name
[in] | context | OpenNI context |
[in] | strName | Name of gesture, to be searched in all gesture generators |
XnUInt32 XnVSessionManager::AddQuickRefocus | ( | xn::GestureGenerator & | generator, | |
const XnChar * | strName | |||
) |
Add gesture to be used as a quick refocus gesture, by gesture generator (OpenNI) and name
[in] | generator | Generator with the wanted gesture |
[in] | strName | Name of the wanted gesture in the generator |
void XnVSessionManager::ClearGestureHash | ( | GestureHash & | hash | ) | [protected] |
void XnVSessionManager::ClearQueue | ( | ) |
Clear the multi-thread queue
void XnVSessionManager::DisableGestures | ( | ) | [protected] |
void XnVSessionManager::DisableQuickRefocusGestures | ( | ) | [protected] |
void XnVSessionManager::EnableGestures | ( | XnBoundingBox3D * | pROI = NULL |
) | [protected] |
void XnVSessionManager::EnableQuickRefocusGestures | ( | XnBoundingBox3D * | pROI = NULL |
) | [protected] |
XnStatus XnVSessionManager::EndSession | ( | ) | [virtual] |
Stop the current session. All points will be lost.
Implements XnVSessionGenerator.
void XnVSessionManager::FinalizeStatic | ( | ) | [protected] |
XnStatus XnVSessionManager::FindTracker | ( | xn::Context * | pContext, | |
xn::HandsGenerator * | pTracker, | |||
xn::HandsGenerator & | tracker | |||
) | [protected] |
void XnVSessionManager::ForceQuickRefocus | ( | XnBoundingBox3D * | pbbForcedArea, | |
XnUInt32 | nForcedTimeout | |||
) |
Force the system into quick refocus state, if not already in a session.
[in] | pbbForcedArea | A fixed area in which to look for the quick refocus. This overrides but doesn't overwrite the regular Quick Refocus area. |
[in] | nForcedTimeout | Timeout in ms in which to look for quick refocus. This overrides but doesn't overwrite the regular Quick refocus timeout. |
XnStatus XnVSessionManager::ForceSession | ( | const XnPoint3D & | ptFocus | ) | [virtual] |
Force a session to start, with a specific focus position.
[in] | ptFocus | The position to consider as focus point |
Implements XnVSessionGenerator.
static void XN_CALLBACK_TYPE XnVSessionManager::Gesture_Recognized | ( | const XnChar * | strGesture, | |
const XnPoint3D & | ptIDPosition, | |||
const XnPoint3D & | ptEndPosition, | |||
void * | cxt | |||
) | [static, protected] |
static void XN_CALLBACK_TYPE XnVSessionManager::Gesture_StartRecognized | ( | const XnChar * | strGesture, | |
const XnPoint3D & | pos, | |||
XnFloat | fProgress, | |||
void * | cxt | |||
) | [static, protected] |
void XnVSessionManager::GestureRecognized | ( | const XnChar * | strGesture, | |
const XnPoint3D & | ptIDPosition, | |||
const XnPoint3D & | ptEndPosition | |||
) | [protected] |
void XnVSessionManager::GestureStartRecognized | ( | const XnChar * | strGesture, | |
const XnPoint3D & | pos, | |||
XnFloat | fProgress | |||
) | [protected] |
void XnVSessionManager::GetPrimaryStaticBoundingBox | ( | XnFloat & | fX, | |
XnFloat & | fY, | |||
XnFloat & | fZ | |||
) |
Get the box dimensions in which a gesture is looked for when the primary hand is static
[out] | fX | Length (in mm) in the X-axis |
[out] | fY | Length (in mm) in the Y-axis |
[out] | fZ | Length (in mm) in the Z-axis |
XnFloat XnVSessionManager::GetPrimarySteadyTimeout | ( | ) | const |
Get the timeout of the primary hand being static to allow gestures
void XnVSessionManager::GetQuickRefocusArea | ( | XnFloat & | fLengthX, | |
XnFloat & | fLengthY, | |||
XnFloat & | fLengthZ | |||
) |
XnUInt32 XnVSessionManager::GetQuickRefocusTimeout | ( | ) | const |
XnUInt64 XnVSessionManager::GetTime | ( | ) | [protected] |
XnStatus XnVSessionManager::Initialize | ( | xn::Context * | pContext, | |
const XnChar * | strUseAsFocus, | |||
const XnChar * | strUseAsQuickRefocus, | |||
xn::HandsGenerator * | pTracker = NULL , |
|||
xn::GestureGenerator * | pFocusGenerator = NULL , |
|||
xn::GestureGenerator * | pQuickRefocusGenerator = NULL | |||
) |
Initialize the Session. Set the gestures to use for focus and for quick refocus, as two comma-separated lists.
[in] | pContext | The OpenNI context from which to take some values |
[in] | strUseAsFocus | A comma-separated list of gestures to use as the main focus gesture |
[in] | strUseAsQuickRefocus | A comma-separated list of gesture to use as the quick focus gesture |
[in] | pTracker | The HandsGenerator to use for tracking |
[in] | pFocusGenerator | The GestureGenerator from which to take the focus gesture |
[in] | pQuickRefocusGenerator | The GestureGenerator from which to take the quick refocus gesture |
void XnVSessionManager::InitializeStatic | ( | ) | [protected] |
XnBool XnVSessionManager::IsInSession | ( | ) | const [inline, protected] |
Tells if currently in Session
Reimplemented from XnVSessionGenerator.
Definition at line 330 of file XnVSessionManager.h.
XnBool XnVSessionManager::IsNotInSession | ( | ) | const [inline, protected] |
Definition at line 331 of file XnVSessionManager.h.
XnBool XnVSessionManager::IsQuickRefocus | ( | ) | const [inline, protected] |
Definition at line 332 of file XnVSessionManager.h.
XnStatus XnVSessionManager::LosePoint | ( | XnUInt32 | nID | ) | [virtual] |
Stop tracking a specific point
[in] | nID | The ID of the point to stop track |
Implements XnVSessionGenerator.
XnStatus XnVSessionManager::LosePoints | ( | ) | [virtual] |
Stop tracking all points
Implements XnVSessionGenerator.
static void XN_CALLBACK_TYPE XnVSessionManager::PrimaryIsNotSteady | ( | XnUInt32 | id, | |
XnFloat | dummy, | |||
void * | cxt | |||
) | [static, protected] |
static void XN_CALLBACK_TYPE XnVSessionManager::PrimaryIsSteady | ( | XnUInt32 | id, | |
XnFloat | dummy, | |||
void * | cxt | |||
) | [static, protected] |
void XnVSessionManager::ProcessPoints | ( | XnVMultipleHands * | pHands | ) |
Handle Hand Points. Manage session state.
[in] | pHands | Points summary |
void XnVSessionManager::RemoveGesture | ( | XnUInt32 | nId | ) |
Remove a gesture from being a focus gesture
[in] | nId | ID of the gesture to be removed, as received when adding it. |
void XnVSessionManager::RemoveGesture | ( | XnUInt32 | nId, | |
GestureHash & | hash | |||
) | [protected] |
void XnVSessionManager::RemoveQuickRefocus | ( | XnUInt32 | nId | ) |
Remove a gesture from being a quick refocus gesture
[in] | nId | ID of the gesture to be removed, as received when adding it. |
void XnVSessionManager::SessionStop | ( | ) | [protected, virtual] |
Reimplemented from XnVSessionGenerator.
void XnVSessionManager::SetPrimaryStaticBoundingBox | ( | XnFloat | fX, | |
XnFloat | fY, | |||
XnFloat | fZ | |||
) |
Set the box in which to look for the gesture as a result of the primary hand being static. The box will be around the last focus point, with the focus point being its center.
[in] | fX | Length (in mm) on the X-axis |
[in] | fY | Length (in mm) on the Y-axis |
[in] | fZ | Length (in mm) on the Z-axis |
void XnVSessionManager::SetPrimaryStaticTimeout | ( | XnFloat | fTimeout | ) |
Set the timeout of the primary hand being static to allow gestures
[in] | fTimeout | Time in seconds |
XnStatus XnVSessionManager::SetQuickRefocusArea | ( | XnFloat | fLengthX, | |
XnFloat | fLengthY, | |||
XnFloat | fLengthZ | |||
) |
Set the area in which Quick Refocus is expected, where all lengths are symmetric relative to the last known point
[in] | fLengthX | Length in the X coordinate, half of which will be in either direction |
[in] | fLengthY | Length in the Y coordinate, half of which will be in either direction |
[in] | fLengthZ | Length in the z coordinate, half of which will be in either direction |
XnStatus XnVSessionManager::SetQuickRefocusArea | ( | const XnBoundingBox3D & | bbQuickRefocusArea | ) |
Set the area in which Quick Refocus is expected
[in] | bbQuickRefocusArea | Area relative to the last known hand (treated as 0,0,0) to expect quick refocus |
void XnVSessionManager::SetQuickRefocusTimeout | ( | XnUInt32 | nMilliseconds | ) |
Change the timeout for the quick refocus gesture. Default is 15000 (15 seconds)
[in] | nMilliseconds | The new timeout |
void XnVSessionManager::SetTracker | ( | XnVPointTracker * | pTracker | ) |
Replace Tracker used
[in] | pTracker | new Tracker |
void XnVSessionManager::SetTracker | ( | xn::HandsGenerator | generator | ) |
void XnVSessionManager::StartPrimaryStatic | ( | ) |
Turn on looking for gestures when the primary hand is static
void XnVSessionManager::StartQuickRefocus | ( | XnBoundingBox3D * | pbbROI, | |
XnUInt32 | nTimeout | |||
) | [protected] |
void XnVSessionManager::StopPrimaryStatic | ( | ) |
Turn off looking for gestures when the primary hand is static
XnStatus XnVSessionManager::TrackPoint | ( | const XnPoint3D & | pt | ) | [virtual] |
Start tracking a new hand from a specific position
[in] | pt | The position from which to start tracking |
Implements XnVSessionGenerator.
void XnVSessionManager::Update | ( | XnVMessage * | pMessage | ) |
Handle incoming Messages. Depth Messages are dealt with by the other Update method Point Messages (from Point Tracker) are dealt with by ProcessPoints
[in] | pMessage | incoming Message |
void XnVSessionManager::Update | ( | const xn::Context * | pContext | ) |
Handle a context. Calls the Gesture and the Tracker
[in] | pContext | The context to process |
void XnVSessionManager::UpdateGestures | ( | const xn::Context * | pContext | ) | [protected] |
void XnVSessionManager::UpdateQuickRefocusGestures | ( | const xn::Context * | pContext | ) | [protected] |
XnStatus XnVSessionManager::XN_API_DEPRECATED | ( | "Please use Initialize() instead." | ) |
void XnVSessionManager::XN_API_DEPRECATED | ( | "Please use AddGesture() instead." | ) |
XnVSessionManager::XN_DECLARE_DEFAULT_HASH | ( | XnUInt32 | , | |
GestureDescription * | , | |||
GestureHash | ||||
) | [protected] |
XnBool XnVSessionManager::m_bAutoTracker [protected] |
Definition at line 319 of file XnVSessionManager.h.
XnBoundingBox3D XnVSessionManager::m_bbQuickRefocusArea [protected] |
Definition at line 347 of file XnVSessionManager.h.
XnBool XnVSessionManager::m_bCheckPrimaryForStatic [protected] |
Definition at line 350 of file XnVSessionManager.h.
XnBool XnVSessionManager::m_bGesturesEnabled [protected] |
Definition at line 294 of file XnVSessionManager.h.
XnBool XnVSessionManager::m_bPrimaryIsStatic [protected] |
Definition at line 351 of file XnVSessionManager.h.
XnBool XnVSessionManager::m_bQuickRefocusAllowed [protected] |
Definition at line 334 of file XnVSessionManager.h.
XnBool XnVSessionManager::m_bQuickRefocusEnabled [protected] |
Definition at line 295 of file XnVSessionManager.h.
enum { ... } XnVSessionManager::m_eSessionState [protected] |
XnFloat XnVSessionManager::m_fLastPrimaryTime [protected] |
Definition at line 358 of file XnVSessionManager.h.
XnFloat XnVSessionManager::m_fLastSteadyTime [protected] |
Definition at line 357 of file XnVSessionManager.h.
XnFloat XnVSessionManager::m_fSteadyTimeout [protected] |
Definition at line 359 of file XnVSessionManager.h.
XnPoint3D XnVSessionManager::m_GestureWhileTrackingThreshold [protected] |
Definition at line 362 of file XnVSessionManager.h.
XnCallbackHandle XnVSessionManager::m_hGesture [protected] |
Definition at line 336 of file XnVSessionManager.h.
XnCallbackHandle XnVSessionManager::m_hGestureMid [protected] |
Definition at line 337 of file XnVSessionManager.h.
XnCallbackHandle XnVSessionManager::m_hQRGesture [protected] |
Definition at line 338 of file XnVSessionManager.h.
GestureHash XnVSessionManager::m_MainGestures [protected] |
Definition at line 307 of file XnVSessionManager.h.
XnUInt32 XnVSessionManager::m_nLastPrimaryID [protected] |
Definition at line 361 of file XnVSessionManager.h.
XnUInt32 XnVSessionManager::m_nNextGestureID [protected] |
Definition at line 309 of file XnVSessionManager.h.
XnUInt64 XnVSessionManager::m_nQuickRefocusExpire [protected] |
Definition at line 341 of file XnVSessionManager.h.
XnUInt32 XnVSessionManager::m_nQuickRefocusTimeout [protected] |
Definition at line 340 of file XnVSessionManager.h.
const xn::Context* XnVSessionManager::m_pContext [protected] |
Definition at line 348 of file XnVSessionManager.h.
XnVSteadyDetector* XnVSessionManager::m_pSteadyDetector [protected] |
Definition at line 352 of file XnVSessionManager.h.
Definition at line 345 of file XnVSessionManager.h.
XnVPointTracker* XnVSessionManager::m_pTracker [protected] |
Definition at line 318 of file XnVSessionManager.h.
GestureHash XnVSessionManager::m_QuickRefocusGestures [protected] |
Definition at line 308 of file XnVSessionManager.h.
const XnUInt32 XnVSessionManager::ms_nQuickRefocusDefaultTimeout [static, protected] |
Definition at line 343 of file XnVSessionManager.h.
Definition at line 261 of file XnVSessionManager.h.
Definition at line 261 of file XnVSessionManager.h.