Public Types | Public Member Functions | Protected Member Functions | Static Protected Member Functions | Protected Attributes | Static Protected Attributes

XnVSwipeDetector Class Reference

#include <XnVSwipeDetector.h>

Inheritance diagram for XnVSwipeDetector:
Inheritance graph
[legend]
Collaboration diagram for XnVSwipeDetector:
Collaboration graph
[legend]

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

 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

Detailed Description

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.


Member Typedef Documentation

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.


Constructor & Destructor Documentation

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

Creation

Parameters:
[in] bUseSteadyBeforeSwipe Wait for steady before looking for swipes
[in] strName Name 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] 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.

Parameters:
[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

Parameters:
[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.

Parameters:
[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

Parameters:
[in] cxt User's context
[in] pCB The 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] cxt User's context
[in] pCB The 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] cxt User's context
[in] pCB The 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] cxt User's context
[in] pCB The 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] cxt User's context
[in] pCB The 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] 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

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

Change internal Steady Detector's steady detection duration

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

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

Parameters:
[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

Parameters:
[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

Parameters:
[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

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

Unregister from the swipe down event

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

Unregister from the swipe left event

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

Unregister from the swipe right event

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

Unregister from the swipe up event

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

Member Data Documentation

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.

Definition at line 231 of file XnVSwipeDetector.h.

Definition at line 237 of file XnVSwipeDetector.h.

Definition at line 233 of file XnVSwipeDetector.h.

Definition at line 234 of file XnVSwipeDetector.h.

Definition at line 230 of file XnVSwipeDetector.h.

Definition at line 227 of file XnVSwipeDetector.h.

XnFloat XnVSwipeDetector::m_fPendingAngle [protected]

Definition at line 239 of file XnVSwipeDetector.h.

Definition at line 238 of file XnVSwipeDetector.h.

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.

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.


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