view test/KinectTrack.h @ 4:edf80c055589 default tip

kinect run on Cerium
author kazz <kazz@cr.ie.u-ryukyu.ac.jp>
date Tue, 01 Feb 2011 14:44:56 +0900
parents KinectTrack.h@7e112b536f0a
children
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);
	int getPosition(float &x, float &y, float &z) const;
protected:
	XnUInt32 mNHistorySize;
	std::map<XnUInt32, std::list<XnPoint3D> > mHistory;
	xn::DepthGenerator mDepthGenerator;
	XnFloat *mPFPositionBuffer;
	XnBool mBDrawDM;
	XnBool mBFrameID;
};