NITE 1.5.1 - API Reference

XnVSteadyDetector.h

Go to the documentation of this file.
00001 /*******************************************************************************
00002 *                                                                              *
00003 *   PrimeSense NITE 1.3                                                        *
00004 *   Copyright (C) 2010 PrimeSense Ltd.                                         *
00005 *                                                                              *
00006 *******************************************************************************/
00007 
00008 
00009 #ifndef _XNV_STEADY_DETECTOR_H_
00010 #define _XNV_STEADY_DETECTOR_H_
00011 
00012 #include "XnVNiteDefs.h"
00013 #include "XnVPointControl.h"
00014 class XnVPointBuffer;
00015 class XnVSteadyStates;
00016 class XnVUintFloatSpecificEvent;
00022 class XNV_NITE_API XnVSteadyDetector :
00023     public XnVPointControl
00024 {
00025 public:
00029     typedef void (XN_CALLBACK_TYPE *SteadyCB)(XnUInt32 nId, XnFloat fStdDev, void* pUserCxt);
00030     typedef void (XN_CALLBACK_TYPE *NotSteadyCB)(XnUInt32 nId, XnFloat fStdDev, void* pUserCxt);
00031 
00040     XnVSteadyDetector(XnUInt32 nCooldownFrames = ms_nDefaultInitialCooldown,
00041         XnUInt32 nDetectionDuration = ms_nDefaultDetectionDuration,
00042         XnFloat fMaximumStdDevForSteady = ms_fDefaultMaximumStdDevForSteady,
00043         const XnChar* strName = "XnVSteadyDetector");
00044 
00045     ~XnVSteadyDetector();
00054     XnCallbackHandle RegisterSteady(void* cxt, SteadyCB CB);
00060     void UnregisterSteady(XnCallbackHandle hCB);
00061 
00070     XnCallbackHandle RegisterNotSteady(void* cxt, NotSteadyCB CB);
00076     void UnregisterNotSteady(XnCallbackHandle hCB);
00080     void Reset();
00081 
00087     XnUInt32 GetDetectionDuration() const;
00093     XnFloat GetMaximumStdDevForSteady() const;
00099     XnFloat GetMinimumStdDevForNotSteady() const;
00100 
00106     void SetDetectionDuration(XnUInt32 nDuration);
00112     void SetMaximumStdDevForSteady(XnFloat fStdDev);
00118     void SetMinimumStdDevForNotSteady(XnFloat fStdDev);
00119 
00120     static const XnUInt32 ms_nDefaultDetectionDuration;     // = 200 ms
00121     static const XnUInt32 ms_nDefaultInitialCooldown;       // = 0
00122     static const XnFloat ms_fDefaultMaximumStdDevForSteady; // 0.01 m/s
00123     static const XnFloat ms_fDefaultMinimumStdDevForNotSteady;  // 0.02 m/s
00124 
00130     void OnPointCreate(const XnVHandPointContext* cxt);
00137     void OnPointUpdate(const XnVHandPointContext* cxt);
00138 
00139     XnFloat XN_API_DEPRECATED("Please use GetMaximumStdDevForSteady() instead.")
00140         GetMaximumVelocity() const;
00141     void XN_API_DEPRECATED("Please use SetMaximumStdDevForSteady() instead.")
00142         SetMaximumVelocity(XnFloat fVelocity);
00143 protected:
00144     void Reset(XnUInt32 id);
00145     // called whenever we have a new point
00146     XnStatus DetectSteady(XnUInt32 nId, const XnPoint3D& pt, XnFloat fTime);
00147 
00148     // broadcasts the event to all listeners
00149     virtual void OnSteadyDetected(XnUInt32 nId, XnFloat fStdDev);
00150     virtual void OnNotSteadyDetected(XnUInt32 nId, XnFloat fStdDev);
00151 
00152     XnUInt32 m_nDetectionDuration;
00153     XnFloat m_fMaximumStdDevForSteady;
00154     XnFloat m_fMaximumVarianceForSteady;
00155     XnFloat m_fMinimumStdDevForNotSteady;
00156     XnFloat m_fMinimumVarianceForNotSteady;
00157 
00158     XnUInt32 m_nInitialCooldownFrames;
00159 
00160     XnVSteadyStates* m_pSteadyStates;
00161 private:
00162     XnVUintFloatSpecificEvent* m_pSteadyCBs;
00163     XnVUintFloatSpecificEvent* m_pNotSteadyCBs;
00164 }; // XnVSteadyDetector
00165 
00166 #endif // _XNV_STEADY_DETECTOR_H_