diff main.cc @ 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
line wrap: on
line diff
--- a/main.cc	Tue Feb 01 03:01:22 2011 +0900
+++ b/main.cc	Tue Feb 01 06:37:06 2011 +0900
@@ -24,7 +24,7 @@
 SessionState NIState::gSessionState = NOT_IN_SESSION;
 XnBool NIState::gBDrawDepthMap = true;
 void NIState::XN_CALLBACK_TYPE sessionStarting(const XnPoint3D &ptPosition, void *userCxt) {
-	printf("Session start: (%f, %f, %f)\n)", ptPosition.X,  ptPosition.Y,  ptPosition.Z);
+	printf("Session start: (%f, %f, %f)\n", ptPosition.X,  ptPosition.Y,  ptPosition.Z);
 	gSessionState = IN_SESSION;
 }
 void NIState::XN_CALLBACK_TYPE sessionEnding(void *userCxt) {
@@ -33,7 +33,7 @@
 }
 void NIState::XN_CALLBACK_TYPE focusProgress(const XnChar *strFocus, const XnPoint3D &ptPosition,
 										   XnFloat fProgress, void *userCxt) {
-	//printf("Focus progress: %s @(%f, %f, %f): %f\n)", strFocus, ptPosition.X,  ptPosition.Y,  ptPosition.Z, fProgress);
+	printf("Focus progress: %s @(%f, %f, %f): %f\n", strFocus, ptPosition.X,  ptPosition.Y,  ptPosition.Z, fProgress);
 }
 void NIState::XN_CALLBACK_TYPE noHands(void *UserCxt) {
 	if (gSessionState != NOT_IN_SESSION) {
@@ -75,7 +75,15 @@
 	checkRC(rc, "StartGenerating");
 
 	while (true) {
-		usleep(100);
+		gContext.WaitAndUpdateAll();
+		gPSessionManager->Update(&gContext);
+		float x, y, z;
+		int error = gPDrawer->getPosition(x, y, z);
+		if (error > 0) {
+			printf("%f, %f, %f\n", x, y, z);
+		}
+		
+		//usleep(10);
 	}
 
 	return 0;