#include <XnVSwipeDetector.h>
Public Types | |
typedef void(XN_CALLBACK_TYPE * | SwipeCB )(XnFloat fVelocity, XnFloat fAngle, void *pUserCxt) |
typedef void(XN_CALLBACK_TYPE * | GeneralSwipeCB )(XnVDirection eDir, XnFloat fVelocity, XnFloat fAngle, void *pUserCxt) |
Public Member Functions | |
XnVSwipeDetector (XnBool bUseSteadyBeforeSwipe=true, const XnChar *strName="XnVSwipeDetector") | |
~XnVSwipeDetector () | |
void | OnPrimaryPointCreate (const XnVHandPointContext *pContext, const XnPoint3D &ptFocus) |
void | OnPrimaryPointUpdate (const XnVHandPointContext *pContext) |
void | OnPrimaryPointReplace (XnUInt32 nOldId, const XnVHandPointContext *pContext) |
void | OnPrimaryPointDestroy (XnUInt32 nID) |
void | Reset () |
XnCallbackHandle | RegisterSwipeUp (void *cxt, SwipeCB pCB) |
XnCallbackHandle | RegisterSwipeDown (void *cxt, SwipeCB pCB) |
XnCallbackHandle | RegisterSwipeLeft (void *cxt, SwipeCB pCB) |
XnCallbackHandle | RegisterSwipeRight (void *cxt, SwipeCB pCB) |
XnCallbackHandle | RegisterSwipe (void *cxt, GeneralSwipeCB pCB) |
void | UnregisterSwipeUp (XnCallbackHandle handle) |
void | UnregisterSwipeDown (XnCallbackHandle handle) |
void | UnregisterSwipeLeft (XnCallbackHandle handle) |
void | UnregisterSwipeRight (XnCallbackHandle handle) |
void | UnregisterSwipe (XnCallbackHandle handle) |
void | SetMotionSpeedThreshold (XnFloat fThreshold) |
XnFloat | GetMotionSpeedThreshold () const |
void | SetMotionTime (XnUInt32 nThreshold) |
XnUInt32 | GetMotionTime () const |
void | SetXAngleThreshold (XnFloat fThreshold) |
XnFloat | GetXAngleThreshold () const |
void | SetYAngleThreshold (XnFloat fThreshold) |
XnFloat | GetYAngleThreshold () const |
void | SetSteadyMaxStdDev (XnFloat fStdDev) |
XnFloat | GetSteadyMaxStdDev () const |
XnFloat | XN_API_DEPRECATED ("Use GetSteadyMaxStdDev() instead") GetSteadyMaxVelocity() const |
void | XN_API_DEPRECATED ("Use SetSteadyMaxStdDev() instead") SetSteadyMaxVelocity(XnFloat fVelocity) |
void | SetSteadyDuration (XnUInt32 nDuration) |
XnUInt32 | GetSteadyDuration () const |
void | SetUseSteady (XnBool bUse) |
XnBool | GetUseSteady () const |
Protected Member Functions | |
XN_DECLARE_EVENT_3ARG (XnVGeneralSwipeSpecificEvent, XnVGeneralSwipeEvent, XnVDirection, eDir, XnFloat, fVelocity, XnFloat, fAngle) | |
XnStatus | AddPoint (const XnPoint3D &pt, XnFloat fTime) |
Static Protected Member Functions | |
static void XN_CALLBACK_TYPE | Steady_Steady (XnUInt32 nId, XnFloat fVelocity, void *cxt) |
Protected Attributes | |
XnVPointBuffer * | m_pMovementDetectionBuffer |
XnFloat | m_fMotionDetectionSpeed |
XnUInt32 | m_nMotionDetectionTime |
XnFloat | m_fLowestVelocity |
XnBool | m_bWaitingForSlowdown |
XnFloat | m_fAngleXThreshold |
XnFloat | m_fAngleYThreshold |
XnVFloatFloatSpecificEvent * | m_pPendingEvent |
XnVDirection | m_ePendingDirection |
XnFloat | m_fPendingVelocity |
XnFloat | m_fPendingAngle |
XnVFloatFloatSpecificEvent | m_SwipeDownCBs |
XnVFloatFloatSpecificEvent | m_SwipeUpCBs |
XnVFloatFloatSpecificEvent | m_SwipeLeftCBs |
XnVFloatFloatSpecificEvent | m_SwipeRightCBs |
XnVGeneralSwipeSpecificEvent | m_SwipeCBs |
XnBool | m_bUseSteady |
XnBool | m_bInSteady |
XnVSteadyDetector | m_Steady |
Static Protected Attributes | |
static const XnFloat | ms_fDefaultMotionDetectionVelocity |
static const XnUInt32 | ms_nDefaultMotionDetectionDuration |
A control that identifies swipes - moves on the x and y axes. The XnVSwipeDetector defines 4 events for specific direction swipes:
Additionally, a general swipe event is defined, and is called (with a XnVDirection parameter) for any swipe.
Definition at line 30 of file XnVSwipeDetector.h.
typedef void(XN_CALLBACK_TYPE * XnVSwipeDetector::GeneralSwipeCB)(XnVDirection eDir, XnFloat fVelocity, XnFloat fAngle, void *pUserCxt) |
Definition at line 38 of file XnVSwipeDetector.h.
typedef void(XN_CALLBACK_TYPE * XnVSwipeDetector::SwipeCB)(XnFloat fVelocity, XnFloat fAngle, void *pUserCxt) |
Type for all swipe events callbacks
Definition at line 37 of file XnVSwipeDetector.h.
XnVSwipeDetector::XnVSwipeDetector | ( | XnBool | bUseSteadyBeforeSwipe = true , |
|
const XnChar * | strName = "XnVSwipeDetector" | |||
) |
Creation
[in] | bUseSteadyBeforeSwipe | Wait for steady before looking for swipes |
[in] | strName | Name of the control, for log purposes. |
XnVSwipeDetector::~XnVSwipeDetector | ( | ) |
XnStatus XnVSwipeDetector::AddPoint | ( | const XnPoint3D & | pt, | |
XnFloat | fTime | |||
) | [protected] |
XnFloat XnVSwipeDetector::GetMotionSpeedThreshold | ( | ) | const |
XnUInt32 XnVSwipeDetector::GetMotionTime | ( | ) | const |
XnUInt32 XnVSwipeDetector::GetSteadyDuration | ( | ) | const |
XnFloat XnVSwipeDetector::GetSteadyMaxStdDev | ( | ) | const |
XnBool XnVSwipeDetector::GetUseSteady | ( | ) | const |
XnFloat XnVSwipeDetector::GetXAngleThreshold | ( | ) | const |
XnFloat XnVSwipeDetector::GetYAngleThreshold | ( | ) | const |
void XnVSwipeDetector::OnPrimaryPointCreate | ( | const XnVHandPointContext * | pContext, | |
const XnPoint3D & | ptFocus | |||
) | [virtual] |
Called when the primary point is created.
[in] | pContext | The hand context of the newly created primary point |
[in] | ptFocus | The point in which the session has started. |
Reimplemented from XnVPointControl.
void XnVSwipeDetector::OnPrimaryPointDestroy | ( | XnUInt32 | nID | ) | [virtual] |
Called when the primary point is destroyed.
[in] | nID | The ID of the destroyed hand |
Reimplemented from XnVPointControl.
void XnVSwipeDetector::OnPrimaryPointReplace | ( | XnUInt32 | nOldId, | |
const XnVHandPointContext * | pContext | |||
) | [virtual] |
Called when the primary point is replaced. This will cause the algorithm to look for swipes on a different hand - the new primary
[in] | nOldId | The ID of the hand that was the primary until now |
[in] | pContext | The hand context of the new primary point |
Reimplemented from XnVPointControl.
void XnVSwipeDetector::OnPrimaryPointUpdate | ( | const XnVHandPointContext * | pContext | ) | [virtual] |
Called when the primary point is updated. This will cause the algorithm to look for swipes.
[in] | pContext | The hand context of the updated primary point |
Reimplemented from XnVPointControl.
XnCallbackHandle XnVSwipeDetector::RegisterSwipe | ( | void * | cxt, | |
GeneralSwipeCB | pCB | |||
) |
Register for the general swipe event
[in] | cxt | User's context |
[in] | pCB | The Callback to call when the event is invoked. |
XnCallbackHandle XnVSwipeDetector::RegisterSwipeDown | ( | void * | cxt, | |
SwipeCB | pCB | |||
) |
Register for the swipe down event
[in] | cxt | User's context |
[in] | pCB | The Callback to call when the event is invoked. |
XnCallbackHandle XnVSwipeDetector::RegisterSwipeLeft | ( | void * | cxt, | |
SwipeCB | pCB | |||
) |
Register for the swipe left event
[in] | cxt | User's context |
[in] | pCB | The Callback to call when the event is invoked. |
XnCallbackHandle XnVSwipeDetector::RegisterSwipeRight | ( | void * | cxt, | |
SwipeCB | pCB | |||
) |
Register for the swipe right event
[in] | cxt | User's context |
[in] | pCB | The Callback to call when the event is invoked. |
XnCallbackHandle XnVSwipeDetector::RegisterSwipeUp | ( | void * | cxt, | |
SwipeCB | pCB | |||
) |
Register for the swipe up event
[in] | cxt | User's context |
[in] | pCB | The Callback to call when the event is invoked. |
void XnVSwipeDetector::Reset | ( | ) |
Start looking for swipes, forgetting the preexisting state.
void XnVSwipeDetector::SetMotionSpeedThreshold | ( | XnFloat | fThreshold | ) |
Change the minimal speed to recognize as a swipe. Default is 0.25m/s
[in] | fThreshold | The minimal speed to be considered a swipe |
void XnVSwipeDetector::SetMotionTime | ( | XnUInt32 | nThreshold | ) |
Change the minimal duration to recognize as swipe. Default is 350 ms
[in] | nThreshold | The minimal duration to be considered a swipe |
void XnVSwipeDetector::SetSteadyDuration | ( | XnUInt32 | nDuration | ) |
Change internal Steady Detector's steady detection duration
[in] | nDuration | Duration of steady state |
void XnVSwipeDetector::SetSteadyMaxStdDev | ( | XnFloat | fStdDev | ) |
Change internal Steady Detector's maximum standard deviation to consider steady
[in] | fStdDev | Maximum standard deviation to consider steady state |
void XnVSwipeDetector::SetUseSteady | ( | XnBool | bUse | ) |
void XnVSwipeDetector::SetXAngleThreshold | ( | XnFloat | fThreshold | ) |
Change the angle difference from the X-Axis to consider Left/Right movement. Default is 25 degrees
[in] | fThreshold | The angle difference |
void XnVSwipeDetector::SetYAngleThreshold | ( | XnFloat | fThreshold | ) |
Change the angle difference from the Y-Axis to consider Up/Down movement. Default is 20 degrees
[in] | fThreshold | The angle difference |
static void XN_CALLBACK_TYPE XnVSwipeDetector::Steady_Steady | ( | XnUInt32 | nId, | |
XnFloat | fVelocity, | |||
void * | cxt | |||
) | [static, protected] |
void XnVSwipeDetector::UnregisterSwipe | ( | XnCallbackHandle | handle | ) |
Unregister from the general swipe event
[in] | handle | The handle provided on registration. |
void XnVSwipeDetector::UnregisterSwipeDown | ( | XnCallbackHandle | handle | ) |
Unregister from the swipe down event
[in] | handle | The handle provided on registration. |
void XnVSwipeDetector::UnregisterSwipeLeft | ( | XnCallbackHandle | handle | ) |
Unregister from the swipe left event
[in] | handle | The handle provided on registration. |
void XnVSwipeDetector::UnregisterSwipeRight | ( | XnCallbackHandle | handle | ) |
Unregister from the swipe right event
[in] | handle | The handle provided on registration. |
void XnVSwipeDetector::UnregisterSwipeUp | ( | XnCallbackHandle | handle | ) |
Unregister from the swipe up event
[in] | handle | The handle provided on registration. |
XnFloat XnVSwipeDetector::XN_API_DEPRECATED | ( | "Use GetSteadyMaxStdDev() instead" | ) | const |
void XnVSwipeDetector::XN_API_DEPRECATED | ( | "Use SetSteadyMaxStdDev() instead" | ) |
XnVSwipeDetector::XN_DECLARE_EVENT_3ARG | ( | XnVGeneralSwipeSpecificEvent | , | |
XnVGeneralSwipeEvent | , | |||
XnVDirection | , | |||
eDir | , | |||
XnFloat | , | |||
fVelocity | , | |||
XnFloat | , | |||
fAngle | ||||
) | [protected] |
XnBool XnVSwipeDetector::m_bInSteady [protected] |
Definition at line 246 of file XnVSwipeDetector.h.
XnBool XnVSwipeDetector::m_bUseSteady [protected] |
Definition at line 245 of file XnVSwipeDetector.h.
XnBool XnVSwipeDetector::m_bWaitingForSlowdown [protected] |
Definition at line 231 of file XnVSwipeDetector.h.
XnVDirection XnVSwipeDetector::m_ePendingDirection [protected] |
Definition at line 237 of file XnVSwipeDetector.h.
XnFloat XnVSwipeDetector::m_fAngleXThreshold [protected] |
Definition at line 233 of file XnVSwipeDetector.h.
XnFloat XnVSwipeDetector::m_fAngleYThreshold [protected] |
Definition at line 234 of file XnVSwipeDetector.h.
XnFloat XnVSwipeDetector::m_fLowestVelocity [protected] |
Definition at line 230 of file XnVSwipeDetector.h.
XnFloat XnVSwipeDetector::m_fMotionDetectionSpeed [protected] |
Definition at line 227 of file XnVSwipeDetector.h.
XnFloat XnVSwipeDetector::m_fPendingAngle [protected] |
Definition at line 239 of file XnVSwipeDetector.h.
XnFloat XnVSwipeDetector::m_fPendingVelocity [protected] |
Definition at line 238 of file XnVSwipeDetector.h.
XnUInt32 XnVSwipeDetector::m_nMotionDetectionTime [protected] |
Definition at line 228 of file XnVSwipeDetector.h.
XnVPointBuffer* XnVSwipeDetector::m_pMovementDetectionBuffer [protected] |
Definition at line 222 of file XnVSwipeDetector.h.
XnVFloatFloatSpecificEvent* XnVSwipeDetector::m_pPendingEvent [protected] |
Definition at line 236 of file XnVSwipeDetector.h.
XnVSteadyDetector XnVSwipeDetector::m_Steady [protected] |
Definition at line 247 of file XnVSwipeDetector.h.
XnVGeneralSwipeSpecificEvent XnVSwipeDetector::m_SwipeCBs [protected] |
Definition at line 243 of file XnVSwipeDetector.h.
XnVFloatFloatSpecificEvent XnVSwipeDetector::m_SwipeDownCBs [protected] |
Definition at line 241 of file XnVSwipeDetector.h.
XnVFloatFloatSpecificEvent XnVSwipeDetector::m_SwipeLeftCBs [protected] |
Definition at line 241 of file XnVSwipeDetector.h.
XnVFloatFloatSpecificEvent XnVSwipeDetector::m_SwipeRightCBs [protected] |
Definition at line 241 of file XnVSwipeDetector.h.
XnVFloatFloatSpecificEvent XnVSwipeDetector::m_SwipeUpCBs [protected] |
Definition at line 241 of file XnVSwipeDetector.h.
const XnFloat XnVSwipeDetector::ms_fDefaultMotionDetectionVelocity [static, protected] |
Definition at line 224 of file XnVSwipeDetector.h.
const XnUInt32 XnVSwipeDetector::ms_nDefaultMotionDetectionDuration [static, protected] |
Definition at line 225 of file XnVSwipeDetector.h.