当前位置: 首页>>代码示例>>C++>>正文


C++ UserGenerator::GetNumberOfUsers方法代码示例

本文整理汇总了C++中xn::UserGenerator::GetNumberOfUsers方法的典型用法代码示例。如果您正苦于以下问题:C++ UserGenerator::GetNumberOfUsers方法的具体用法?C++ UserGenerator::GetNumberOfUsers怎么用?C++ UserGenerator::GetNumberOfUsers使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在xn::UserGenerator的用法示例。


在下文中一共展示了UserGenerator::GetNumberOfUsers方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: getTrackedUserID

XnUserID hiKinect::getTrackedUserID(){
  XnUInt16 nUsers = g_UserGenerator.GetNumberOfUsers();
  XnUserID aUsers[nUsers];
  g_UserGenerator.GetUsers(aUsers, nUsers);
  xn::SkeletonCapability cap = g_UserGenerator.GetSkeletonCap();
  for (int i = 0; i < nUsers; ++i) {
    if (cap.IsTracking(aUsers[i])) {
      return aUsers[i];
    }
  }
  return 0;
}
开发者ID:xiaohanzhang,项目名称:HiKinect,代码行数:12,代码来源:hiKinect.cpp

示例2: UserDetected

// ユーザー検出
void XN_CALLBACK_TYPE UserDetected(xn::UserGenerator& generator,
    XnUserID nId, void* pCookie)
{
    std::cout << "ユーザー検出:" << nId << " " << generator.GetNumberOfUsers() << "人目" << std::endl;

    XnChar* pose = (XnChar*)pCookie;
    if (pose[0] != '¥0') {
        generator.GetPoseDetectionCap().StartPoseDetection(pose, nId);
    }
    else {
        generator.GetSkeletonCap().RequestCalibration(nId, TRUE);
    }
}
开发者ID:DaikiMaekawa,项目名称:openni_sandbox,代码行数:14,代码来源:main.cpp

示例3: printf

void XN_CALLBACK_TYPE
User_NewUser(xn::UserGenerator& generator, XnUserID nId, void* pCookie) {
  printf("New User: %d\n", nId);
  FBLOG_INFO("User_NewUser", nId);
  XnUInt16 nUsers = g_UserGenerator.GetNumberOfUsers();
  XnUserID aUsers[nUsers];
  g_UserGenerator.GetUsers(aUsers, nUsers);
  for (int i = 0; i < nUsers; ++i) {
    if (g_UserGenerator.GetSkeletonCap().IsTracking(aUsers[i])) {
      return;
    }
  }
  g_UserGenerator.GetPoseDetectionCap().StartPoseDetection(POSE_TO_USE, nId);
  (*((hiKinect *)pCookie)->callbackPtr)->InvokeAsync("", FB::variant_list_of("NEW_USER"));
}
开发者ID:xiaohanzhang,项目名称:HiKinect,代码行数:15,代码来源:hiKinect.cpp

示例4: UserDetected

// ユーザー検出
void XN_CALLBACK_TYPE UserDetected(xn::UserGenerator& generator, XnUserID nId, void* pCookie)
{
    std::cout << "ユーザー検出:" << nId << " " << generator.GetNumberOfUsers() << "人目" << std::endl;
    
    // キャリブレーションデータをロードする
    if ( !LoadCalibration( generator ) ) {
        // ファイルからトラッキングできなければ、ポーズからキャリブレーションを行う
        XnChar* pose = (XnChar*)pCookie;
        if (pose[0] != '¥0') {
            generator.GetPoseDetectionCap().StartPoseDetection(pose, nId);
        }
        else {
            generator.GetSkeletonCap().RequestCalibration(nId, TRUE);
        }
    }
}
开发者ID:takanori,项目名称:openni_sandbox,代码行数:17,代码来源:main.cpp

示例5: xnGetStatusString

reader_result kinect_reader2::get_next() {
	XnUserID aUsers[15];
	XnUInt16 nUsers = 15;
	XnSkeletonJointPosition joint;

	while(true) {
		// Read next available data
		nRetVal = g_Context.WaitOneUpdateAll(g_DepthGenerator);
		if(nRetVal != XN_STATUS_OK) {
			printf("Failed updating data: %s\n", xnGetStatusString(nRetVal));
			continue;
		}

		if(g_UserGenerator.GetNumberOfUsers() > 0) {

			g_UserGenerator.GetUsers(aUsers, nUsers);
			for(int i=0; i< nUsers; i++)
			{
				if(g_UserGenerator.GetSkeletonCap().IsTracking(aUsers[i]))
				{
					reader_result new_tuple;

					// player
					new_tuple.push_back(boost::any((int)aUsers[i]));

					// 1 = XN_SKEL_HEAD, ..., 24 = XN_SKEL_RIGHT_FOOD
					for(short j = 1; j <= 24; j++) {
						g_UserGenerator.GetSkeletonCap().GetSkeletonJointPosition(aUsers[i], (XnSkeletonJoint)j, joint);
						new_tuple.push_back(boost::any(boost::lexical_cast<std::string>((float)joint.position.X)));
						new_tuple.push_back(boost::any(boost::lexical_cast<std::string>((float)joint.position.Y)));
						new_tuple.push_back(boost::any(boost::lexical_cast<std::string>((float)joint.position.Z)));
						new_tuple.push_back(boost::any(boost::lexical_cast<std::string>((float)joint.fConfidence)));
					}

					return new_tuple;
				}
			}
		}
	}
}
开发者ID:CCJY,项目名称:engine-1,代码行数:40,代码来源:kinect_reader2.cpp

示例6: UserDetected

//----------------------------------------------------
// ユーザー検出
//----------------------------------------------------
void XN_CALLBACK_TYPE UserDetected(xn::UserGenerator& generator, XnUserID nId, void* pCookie){
	cout << "ユーザー検出:" << nId << " " << generator.GetNumberOfUsers() << "人目" << endl;
}
开发者ID:Yusuke-Shimizu,项目名称:depthkey,代码行数:6,代码来源:main.cpp

示例7: main

int main() {
	printf("main() START\n");
	signal(SIGINT, onSignalReceived); // hit CTRL-C keys in terminal (2)
	signal(SIGTERM, onSignalReceived); // hit stop button in eclipse CDT (15)

	mapMode.nXRes = XN_VGA_X_RES;
	mapMode.nYRes = XN_VGA_Y_RES;
	mapMode.nFPS = 30;

	CHECK_RC(ctx.Init(), "init");
	CHECK_RC(depthGenerator.Create(ctx), "create depth");
	depthGenerator.SetMapOutputMode(mapMode);

	XnStatus userAvailable = ctx.FindExistingNode(XN_NODE_TYPE_USER, userGenerator);
	if(userAvailable != XN_STATUS_OK) {
		CHECK_RC(userGenerator.Create(ctx), "create user");
	}

	XnCallbackHandle hUserCallbacks, hCalibrationCallbacks, hPoseCallbacks;
	xn::SkeletonCapability skel = userGenerator.GetSkeletonCap();
	CHECK_RC(userGenerator.RegisterUserCallbacks(onUserNew, onUserLost, NULL, hUserCallbacks), "register user");
	CHECK_RC(skel.RegisterCalibrationCallbacks(onCalibrationStart, onCalibrationEnd, NULL, hCalibrationCallbacks), "register calib");
	CHECK_RC(userGenerator.GetPoseDetectionCap().RegisterToPoseCallbacks(onPoseDetected, NULL, NULL, hPoseCallbacks), "register pose");

	XnChar poseName[20] = "";
	CHECK_RC(skel.GetCalibrationPose(poseName), "get posename");
	printf("poseName: %s\n", poseName);
	CHECK_RC(skel.SetSkeletonProfile(XN_SKEL_PROFILE_ALL), "set skel profile");
	CHECK_RC(skel.SetSmoothing(0.8), "set smoothing");
//	xnSetMirror(depth, !mirrorMode);

	CHECK_RC(ctx.StartGeneratingAll(), "start generating");

	printf("waitAnyUpdateAll ...\n");
	while(!shouldTerminate) {
		ctx.WaitAnyUpdateAll();
//		depthGenerator.GetMetaData(tempDepthMetaData);

		const XnUInt16 userCount = userGenerator.GetNumberOfUsers();
//		printf("userCount: %i\n", userCount);
		XnUserID aUsers[userCount];
		XnUInt16 nUsers = userCount;
		userGenerator.GetUsers(aUsers, nUsers);
		for (int i = 0; i < nUsers; ++i) {
			XnUserID currentUserId = aUsers[i];
			if (skel.IsTracking(aUsers[i])) {
				XnSkeletonJointPosition joint;
				skel.GetSkeletonJointPosition(currentUserId, XN_SKEL_HEAD, joint);
				XnFloat x = joint.position.X;
				XnFloat y = joint.position.Y;
				XnFloat z = joint.position.Z;
				printf("joint position: %.2f x %.2f x %.2f\n", x, y, z);
				printf("joint.fConfidence: %.2f\n", joint.fConfidence);
			}
		}
	}
	printf("STOP\n");
	CHECK_RC(ctx.StopGeneratingAll(), "stop generating");
	ctx.Shutdown();

	printf("main() END\n");
}
开发者ID:christophpickl,项目名称:ponyo-svn,代码行数:62,代码来源:AppUserTracker.cpp


注:本文中的xn::UserGenerator::GetNumberOfUsers方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。