view KinectTrack.h @ 2:3b5465899da9

add KinectTrack.cc
author kazz <kazz@cr.ie.u-ryukyu.ac.jp>
date Tue, 01 Feb 2011 03:01:22 +0900
parents 2afd5c6cc8d2
children 7e112b536f0a
line wrap: on
line source

#include <map>
#include <list>
#include <XnCppWrapper.h>
#include <XnVPointControl.h>

typedef enum {
	IN_SESSION,
	NOT_IN_SESSION,
	QUICK_REFOCUS
} SessionState;

class NIState {
public:
	static SessionState gSessionState;
	static XnBool gBDrawDepthMap;
	static void XN_CALLBACK_TYPE sessionStarting(const XnPoint3D &ptPosition, void *userCxt);
	static void XN_CALLBACK_TYPE sessionEnding(void *userCxt);
	static void XN_CALLBACK_TYPE focusProgress(const XnChar *strFocus, const XnPoint3D &ptPosition,
											   XnFloat fProgress, void *userCxt);
	static void XN_CALLBACK_TYPE noHands(void *UserCxt);
};

class XnVPointDrawer : public XnVPointControl {
public:
	XnVPointDrawer(XnUInt32 nHistorySize, xn::DepthGenerator depthGenerator);
	virtual ~XnVPointDrawer();
	void update(XnVMessage *pMessage);
	void onPointCreate(const XnVHandPointContext *cxt);
	void onPointUpdate(const XnVHandPointContext *cxt);
	void onPointDestroy(XnUInt32 nID);
	void draw() const;
	void setDepthMap(XnBool bDrawDM);
	void setFrameID(XnBool bFrameID);
protected:
	XnUInt32 mNHistorySize;
	std::map<XnUInt32, std::list<XnPoint3D> > mHistory;
	xn::DepthGenerator mDepthGenerator;
	XnFloat *mPFPositionBuffer;
	XnBool mBDrawDM;
	XnBool mBFrameID;
};