NITE 1.5.1 - API Reference

XnVSwipeDetector Class Reference

#include <XnVSwipeDetector.h>

Inheritance diagram for XnVSwipeDetector:
Collaboration diagram for XnVSwipeDetector:

List of all members.

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

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_pSwipeDownCBs
XnVFloatFloatSpecificEvent * m_pSwipeUpCBs
XnVFloatFloatSpecificEvent * m_pSwipeLeftCBs
XnVFloatFloatSpecificEvent * m_pSwipeRightCBs
XnVGeneralSwipeSpecificEvent * m_pSwipeCBs
XnBool m_bUseSteady
XnBool m_bInSteady
XnVSteadyDetector m_Steady

Static Protected Attributes

static const XnFloat ms_fDefaultMotionDetectionVelocity
static const XnUInt32 ms_nDefaultMotionDetectionDuration

Detailed Description

A control that identifies swipes - moves on the x and y axes. The XnVSwipeDetector defines 4 events for specific direction swipes:

  • A swipe up identified
  • A swipe down identified
  • A swipe left identified
  • A swipe right identified

Additionally, a general swipe event is defined, and is called (with a XnVDirection parameter) for any swipe.

Definition at line 31 of file XnVSwipeDetector.h.


Member Typedef Documentation

typedef void(XN_CALLBACK_TYPE * XnVSwipeDetector::GeneralSwipeCB)(XnVDirection eDir, XnFloat fVelocity, XnFloat fAngle, void *pUserCxt)

Definition at line 39 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 38 of file XnVSwipeDetector.h.


Constructor & Destructor Documentation

XnVSwipeDetector::XnVSwipeDetector ( XnBool  bUseSteadyBeforeSwipe = true,
const XnChar *  strName = "XnVSwipeDetector" 
)

Creation

Parameters:
[in]bUseSteadyBeforeSwipeWait for steady before looking for swipes
[in]strNameName of the control, for log purposes.
XnVSwipeDetector::~XnVSwipeDetector ( )

Member Function Documentation

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.

Parameters:
[in]pContextThe hand context of the newly created primary point
[in]ptFocusThe point in which the session has started.

Reimplemented from XnVPointControl.

void XnVSwipeDetector::OnPrimaryPointDestroy ( XnUInt32  nID) [virtual]

Called when the primary point is destroyed.

Parameters:
[in]nIDThe 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

Parameters:
[in]nOldIdThe ID of the hand that was the primary until now
[in]pContextThe 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.

Parameters:
[in]pContextThe hand context of the updated primary point

Reimplemented from XnVPointControl.

XnCallbackHandle XnVSwipeDetector::RegisterSwipe ( void *  cxt,
GeneralSwipeCB  pCB 
)

Register for the general swipe event

Parameters:
[in]cxtUser's context
[in]pCBThe Callback to call when the event is invoked.
Returns:
A handle, to allow unregistration.
XnCallbackHandle XnVSwipeDetector::RegisterSwipeDown ( void *  cxt,
SwipeCB  pCB 
)

Register for the swipe down event

Parameters:
[in]cxtUser's context
[in]pCBThe Callback to call when the event is invoked.
Returns:
A handle, to allow unregistration.
XnCallbackHandle XnVSwipeDetector::RegisterSwipeLeft ( void *  cxt,
SwipeCB  pCB 
)

Register for the swipe left event

Parameters:
[in]cxtUser's context
[in]pCBThe Callback to call when the event is invoked.
Returns:
A handle, to allow unregistration.
XnCallbackHandle XnVSwipeDetector::RegisterSwipeRight ( void *  cxt,
SwipeCB  pCB 
)

Register for the swipe right event

Parameters:
[in]cxtUser's context
[in]pCBThe Callback to call when the event is invoked.
Returns:
A handle, to allow unregistration.
XnCallbackHandle XnVSwipeDetector::RegisterSwipeUp ( void *  cxt,
SwipeCB  pCB 
)

Register for the swipe up event

Parameters:
[in]cxtUser's context
[in]pCBThe Callback to call when the event is invoked.
Returns:
A handle, to allow unregistration.
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

Parameters:
[in]fThresholdThe minimal speed to be considered a swipe
void XnVSwipeDetector::SetMotionTime ( XnUInt32  nThreshold)

Change the minimal duration to recognize as swipe. Default is 350 ms

Parameters:
[in]nThresholdThe minimal duration to be considered a swipe
void XnVSwipeDetector::SetSteadyDuration ( XnUInt32  nDuration)

Change internal Steady Detector's steady detection duration

Parameters:
[in]nDurationDuration of steady state
void XnVSwipeDetector::SetSteadyMaxStdDev ( XnFloat  fStdDev)

Change internal Steady Detector's maximum standard deviation to consider steady

Parameters:
[in]fStdDevMaximum 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

Parameters:
[in]fThresholdThe angle difference
void XnVSwipeDetector::SetYAngleThreshold ( XnFloat  fThreshold)

Change the angle difference from the Y-Axis to consider Up/Down movement. Default is 20 degrees

Parameters:
[in]fThresholdThe 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

Parameters:
[in]handleThe handle provided on registration.
void XnVSwipeDetector::UnregisterSwipeDown ( XnCallbackHandle  handle)

Unregister from the swipe down event

Parameters:
[in]handleThe handle provided on registration.
void XnVSwipeDetector::UnregisterSwipeLeft ( XnCallbackHandle  handle)

Unregister from the swipe left event

Parameters:
[in]handleThe handle provided on registration.
void XnVSwipeDetector::UnregisterSwipeRight ( XnCallbackHandle  handle)

Unregister from the swipe right event

Parameters:
[in]handleThe handle provided on registration.
void XnVSwipeDetector::UnregisterSwipeUp ( XnCallbackHandle  handle)

Unregister from the swipe up event

Parameters:
[in]handleThe handle provided on registration.
void XnVSwipeDetector::XN_API_DEPRECATED ( "Use SetSteadyMaxStdDev() instead"  )
XnFloat XnVSwipeDetector::XN_API_DEPRECATED ( "Use GetSteadyMaxStdDev() instead"  ) const

Member Data Documentation

XnBool XnVSwipeDetector::m_bInSteady [protected]

Definition at line 248 of file XnVSwipeDetector.h.

XnBool XnVSwipeDetector::m_bUseSteady [protected]

Definition at line 247 of file XnVSwipeDetector.h.

Definition at line 230 of file XnVSwipeDetector.h.

Definition at line 232 of file XnVSwipeDetector.h.

Definition at line 233 of file XnVSwipeDetector.h.

Definition at line 229 of file XnVSwipeDetector.h.

Definition at line 226 of file XnVSwipeDetector.h.

XnFloat XnVSwipeDetector::m_fPendingAngle [protected]

Definition at line 238 of file XnVSwipeDetector.h.

Definition at line 237 of file XnVSwipeDetector.h.

Definition at line 227 of file XnVSwipeDetector.h.

XnVPointBuffer* XnVSwipeDetector::m_pMovementDetectionBuffer [protected]

Definition at line 221 of file XnVSwipeDetector.h.

XnVFloatFloatSpecificEvent* XnVSwipeDetector::m_pPendingEvent [protected]

Definition at line 235 of file XnVSwipeDetector.h.

XnVGeneralSwipeSpecificEvent* XnVSwipeDetector::m_pSwipeCBs [protected]

Definition at line 245 of file XnVSwipeDetector.h.

XnVFloatFloatSpecificEvent* XnVSwipeDetector::m_pSwipeDownCBs [protected]

Definition at line 240 of file XnVSwipeDetector.h.

XnVFloatFloatSpecificEvent* XnVSwipeDetector::m_pSwipeLeftCBs [protected]

Definition at line 242 of file XnVSwipeDetector.h.

XnVFloatFloatSpecificEvent* XnVSwipeDetector::m_pSwipeRightCBs [protected]

Definition at line 243 of file XnVSwipeDetector.h.

XnVFloatFloatSpecificEvent* XnVSwipeDetector::m_pSwipeUpCBs [protected]

Definition at line 241 of file XnVSwipeDetector.h.

Definition at line 249 of file XnVSwipeDetector.h.

const XnFloat XnVSwipeDetector::ms_fDefaultMotionDetectionVelocity [static, protected]

Definition at line 223 of file XnVSwipeDetector.h.

const XnUInt32 XnVSwipeDetector::ms_nDefaultMotionDetectionDuration [static, protected]

Definition at line 224 of file XnVSwipeDetector.h.


The documentation for this class was generated from the following file: