Mercurial > hg > Game > Kinect
annotate KinectTrack.h @ 3:7e112b536f0a
track moving of a hand
author | kazz <kazz@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Tue, 01 Feb 2011 06:37:06 +0900 |
parents | 3b5465899da9 |
children |
rev | line source |
---|---|
2 | 1 #include <map> |
2 #include <list> | |
3 #include <XnCppWrapper.h> | |
4 #include <XnVPointControl.h> | |
5 | |
1
2afd5c6cc8d2
Class definition export to KinectTrack.h
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
6 typedef enum { |
2afd5c6cc8d2
Class definition export to KinectTrack.h
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
7 IN_SESSION, |
2afd5c6cc8d2
Class definition export to KinectTrack.h
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
8 NOT_IN_SESSION, |
2afd5c6cc8d2
Class definition export to KinectTrack.h
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
9 QUICK_REFOCUS |
2afd5c6cc8d2
Class definition export to KinectTrack.h
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
10 } SessionState; |
2afd5c6cc8d2
Class definition export to KinectTrack.h
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
11 |
2afd5c6cc8d2
Class definition export to KinectTrack.h
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
12 class NIState { |
2afd5c6cc8d2
Class definition export to KinectTrack.h
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
13 public: |
2afd5c6cc8d2
Class definition export to KinectTrack.h
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
14 static SessionState gSessionState; |
2 | 15 static XnBool gBDrawDepthMap; |
1
2afd5c6cc8d2
Class definition export to KinectTrack.h
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
16 static void XN_CALLBACK_TYPE sessionStarting(const XnPoint3D &ptPosition, void *userCxt); |
2afd5c6cc8d2
Class definition export to KinectTrack.h
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
17 static void XN_CALLBACK_TYPE sessionEnding(void *userCxt); |
2afd5c6cc8d2
Class definition export to KinectTrack.h
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
18 static void XN_CALLBACK_TYPE focusProgress(const XnChar *strFocus, const XnPoint3D &ptPosition, |
2afd5c6cc8d2
Class definition export to KinectTrack.h
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
19 XnFloat fProgress, void *userCxt); |
2 | 20 static void XN_CALLBACK_TYPE noHands(void *UserCxt); |
1
2afd5c6cc8d2
Class definition export to KinectTrack.h
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
21 }; |
2 | 22 |
23 class XnVPointDrawer : public XnVPointControl { | |
24 public: | |
25 XnVPointDrawer(XnUInt32 nHistorySize, xn::DepthGenerator depthGenerator); | |
26 virtual ~XnVPointDrawer(); | |
3 | 27 void Update(XnVMessage *pMessage); |
28 void OnPointCreate(const XnVHandPointContext *cxt); | |
29 void OnPointUpdate(const XnVHandPointContext *cxt); | |
30 void OnPointDestroy(XnUInt32 nID); | |
31 void Draw() const; | |
2 | 32 void setDepthMap(XnBool bDrawDM); |
33 void setFrameID(XnBool bFrameID); | |
3 | 34 int getPosition(float &x, float &y, float &z) const; |
2 | 35 protected: |
36 XnUInt32 mNHistorySize; | |
37 std::map<XnUInt32, std::list<XnPoint3D> > mHistory; | |
38 xn::DepthGenerator mDepthGenerator; | |
39 XnFloat *mPFPositionBuffer; | |
40 XnBool mBDrawDM; | |
41 XnBool mBFrameID; | |
42 }; |