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


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

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


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

示例1:

void XN_CALLBACK_TYPE
Pose_Detected(xn::PoseDetectionCapability& pose, const XnChar* strPose, XnUserID nId, void* pCookie)
{
	printf("Pose %s for user %d\n", strPose, nId);
	g_UserGenerator.GetPoseDetectionCap().StopPoseDetection(nId);
	g_UserGenerator.GetSkeletonCap().RequestCalibration(nId, TRUE);
}
开发者ID:techmc,项目名称:MoPred,代码行数:7,代码来源:MetricDisplay.cpp

示例2: UserCalibration_CalibrationEnd

// Callback: Finished calibration
void XN_CALLBACK_TYPE UserCalibration_CalibrationEnd(xn::SkeletonCapability& capability, XnUserID nId, XnBool bSuccess, void* pCookie)
{
	if (bSuccess)
	{
		// Calibration succeeded
		printf("Calibration complete, start tracking user %d\n", nId);
		g_UserGenerator.GetSkeletonCap().StartTracking(nId);
		
		prlite_kinematics::some_status_thing status;
		status.lulz = 1;	//calibration ok
		yourmom.publish(status);
	}
	else
	{
		// Calibration failed
		printf("Calibration failed for user %d\n", nId);
		if (g_bNeedPose)
		{
			g_UserGenerator.GetPoseDetectionCap().StartPoseDetection(g_strPose, nId);
		}
		else
		{
			g_UserGenerator.GetSkeletonCap().RequestCalibration(nId, TRUE);
		}
	}
}
开发者ID:rqou,项目名称:prlite-pc,代码行数:27,代码来源:kinect_joints.cpp

示例3: User_NewUser

// Callback: New user was detected
void XN_CALLBACK_TYPE User_NewUser(xn::UserGenerator& generator, XnUserID nId, void* pCookie)
{
    XnUInt32 epochTime = 0;
    xnOSGetEpochTime(&epochTime);
    XnUserID aUsers[MAX_NUM_USERS];
    XnUInt16 nUsers;
	g_UserGenerator.GetUsers(aUsers, nUsers);
    printf("%d New User %d\n", epochTime, nId);
    // New user found
    //validate the number of users
    XnUInt16 usersTracked=0;
    for(XnUInt16 i=0; i<nUsers; i++)
    {
    	if(g_UserGenerator.GetSkeletonCap().IsTracking(aUsers[i])==TRUE)
    		usersTracked++;
    }
    if(usersTracked >= numOfUser)
    {
    	printf("%d users are currently being tracked, no more users allowed\n",numOfUser);
    	return;
    }
    if (g_bNeedPose)
    {
        g_UserGenerator.GetPoseDetectionCap().StartPoseDetection(g_strPose, nId);
    }
    else
    {
        g_UserGenerator.GetSkeletonCap().RequestCalibration(nId, TRUE);
    }
}
开发者ID:stozpark,项目名称:openni,代码行数:31,代码来源:NiSkeletonBenchmark.cpp

示例4: fprintf

void XN_CALLBACK_TYPE xn_onPoseDetected
(xn::PoseDetectionCapability &cap, const XnChar* pose, XnUserID id, void *cookie)
{
  fprintf(stderr, "%s detected. strat calibration\n", pose);
  gUserGenerator.GetPoseDetectionCap().StopPoseDetection(id);
  gUserGenerator.GetSkeletonCap().RequestCalibration(id, TRUE);
}
开发者ID:phelrine,项目名称:kica,代码行数:7,代码来源:kica.cpp

示例5: main

int main(int argc, char **argv)
{
	XnStatus nRetVal = XN_STATUS_OK;

	if (argc > 1)
	{
		nRetVal = g_Context.Init();
		CHECK_RC(nRetVal, "Init");
		nRetVal = g_Context.OpenFileRecording(argv[1]);
		if (nRetVal != XN_STATUS_OK)
		{
			printf("Can't open recording %s: %s\n", argv[1], xnGetStatusString(nRetVal));
			return 1;
		}
	}
	else
	{
		nRetVal = g_Context.InitFromXmlFile(SAMPLE_XML_PATH);
		CHECK_RC(nRetVal, "InitFromXml");
	}
	g_tunnel = new Tunnel();

	nRetVal = g_Context.FindExistingNode(XN_NODE_TYPE_DEPTH, g_DepthGenerator);
	CHECK_RC(nRetVal, "Find depth generator");
	nRetVal = g_Context.FindExistingNode(XN_NODE_TYPE_USER, g_UserGenerator);
	if (nRetVal != XN_STATUS_OK)
	{
		nRetVal = g_UserGenerator.Create(g_Context);
		CHECK_RC(nRetVal, "Find user generator");
	}

	XnCallbackHandle hUserCallbacks, hCalibrationCallbacks, hPoseCallbacks;
	if (!g_UserGenerator.IsCapabilitySupported(XN_CAPABILITY_SKELETON))
	{
		printf("Supplied user generator doesn't support skeleton\n");
		return 1;
	}
	g_UserGenerator.RegisterUserCallbacks(User_NewUser, User_LostUser, NULL, hUserCallbacks);
	g_UserGenerator.GetSkeletonCap().RegisterCalibrationCallbacks(UserCalibration_CalibrationStart, UserCalibration_CalibrationEnd, NULL, hCalibrationCallbacks);

	if (g_UserGenerator.GetSkeletonCap().NeedPoseForCalibration())
	{
		g_bNeedPose = TRUE;
		if (!g_UserGenerator.IsCapabilitySupported(XN_CAPABILITY_POSE_DETECTION))
		{
			printf("Pose required, but not supported\n");
			return 1;
		}
		g_UserGenerator.GetPoseDetectionCap().RegisterToPoseCallbacks(UserPose_PoseDetected, NULL, NULL, hPoseCallbacks);
		g_UserGenerator.GetSkeletonCap().GetCalibrationPose(g_strPose);
	}

	g_UserGenerator.GetSkeletonCap().SetSkeletonProfile(XN_SKEL_PROFILE_ALL);

	nRetVal = g_Context.StartGeneratingAll();
	CHECK_RC(nRetVal, "StartGenerating");

	glInit(&argc, argv);
	glutMainLoop();
}
开发者ID:ndruger,项目名称:kinect-modeling-tool,代码行数:60,代码来源:main.cpp

示例6: UserPose_PoseDetected

// Callback: Detected a pose
void XN_CALLBACK_TYPE UserPose_PoseDetected(xn::PoseDetectionCapability& capability, const XnChar* strPose, XnUserID nId, void* pCookie){
    XnUInt32 epochTime = 0;
    xnOSGetEpochTime(&epochTime);
    LOG_D("%d Pose %s detected for user %d", epochTime, strPose, nId);
    g_UserGenerator.GetPoseDetectionCap().StopPoseDetection(nId);
    g_SkeletonCap.RequestCalibration(nId, TRUE);
}
开发者ID:sparkgene,项目名称:recorder_test,代码行数:8,代码来源:main.cpp

示例7: init

XnStatus hiKinect::init(const FB::JSObjectPtr &cb){
  XnStatus nRetVal = XN_STATUS_OK;
  callbackPtr = &cb;
  nRetVal = context.Init();
  (*callbackPtr)->InvokeAsync("", FB::variant_list_of("CONTEXT_INIT")
                        (nRetVal)(xnGetStatusString(nRetVal)));
  if (nRetVal != XN_STATUS_OK) return nRetVal;

  // Create the user generator
  nRetVal = g_UserGenerator.Create(context);
  (*callbackPtr)->InvokeAsync("", FB::variant_list_of("USERGENERATOR_CREATE")
                        (nRetVal)(xnGetStatusString(nRetVal)));
  if (nRetVal != XN_STATUS_OK) return nRetVal;
  XnCallbackHandle h1, h2, h3;
  g_UserGenerator.RegisterUserCallbacks(User_NewUser, User_LostUser, this, h1);
  g_UserGenerator.GetPoseDetectionCap()
      .RegisterToPoseCallbacks(Pose_Detected, NULL, this, h2);
  g_UserGenerator.GetSkeletonCap()
      .RegisterCalibrationCallbacks(Calibration_Start, Calibration_End,
                                    this, h3);
  // Set the profile
  g_UserGenerator.GetSkeletonCap().SetSkeletonProfile(XN_SKEL_PROFILE_ALL);
  FBLOG_INFO("contextInit", "Init finish");
  // Start generating
  nRetVal = context.StartGeneratingAll();
  (*callbackPtr)->InvokeAsync("", FB::variant_list_of("START_GENERATING")
                        (nRetVal)(xnGetStatusString(nRetVal)));
  if (nRetVal != XN_STATUS_OK) return nRetVal;
  while (getTrackedUserID() == 0){
    contextWaitAndUpdateAll();
  }
  return nRetVal;
}
开发者ID:xiaohanzhang,项目名称:HiKinect,代码行数:33,代码来源:hiKinect.cpp

示例8: UserCalibration_CalibrationEnd

void XN_CALLBACK_TYPE UserCalibration_CalibrationEnd(xn::SkeletonCapability& capability, XnUserID nId, XnBool bSuccess, void* pCookie)
{
  if (bSuccess)
  {
    ROS_INFO("Calibration complete, start tracking user %d", nId);
    g_UserGenerator.GetSkeletonCap().StartTracking(nId);

    if (default_user == 0) // set default user if still unset
    {
      default_user = nId;
      ROS_INFO_STREAM("OpenNI tracker: Default user has been initialised with user " << default_user << ".");
    }
    std_msgs::UInt16MultiArray tracked_users;
    XnUserID users[15];
    XnUInt16 users_count = 15;
    g_UserGenerator.GetUsers(users, users_count);
    for (unsigned int user = 0; user < users_count; ++user)
    {
      tracked_users.data.push_back(users[user]);
    }
    available_tracked_users_pub.publish(tracked_users);
  }
  else
  {
    ROS_INFO("Calibration failed for user %d", nId);
    if (g_bNeedPose)
    {
      g_UserGenerator.GetPoseDetectionCap().StartPoseDetection(g_strPose, nId);
    }
    else
    {
      g_UserGenerator.GetSkeletonCap().RequestCalibration(nId, TRUE);
    }
  }
}
开发者ID:bit-pirate,项目名称:openni_tracker_rosmake,代码行数:35,代码来源:openni_tracker.cpp

示例9: UserCalibration_CalibrationComplete

void XN_CALLBACK_TYPE UserCalibration_CalibrationComplete(xn::SkeletonCapability& capability, XnUserID nId, XnCalibrationStatus eStatus, void* pCookie)
{
    XnUInt32 epochTime = 0;
    xnOSGetEpochTime(&epochTime);
    if (eStatus == XN_CALIBRATION_STATUS_OK)
    {
        // Calibration succeeded
        printf("%d Calibration complete, start tracking user %d\n", epochTime, nId);		
        g_UserGenerator.GetSkeletonCap().StartTracking(nId);
    }
    else
    {
        // Calibration failed
        printf("%d Calibration failed for user %d\n", epochTime, nId);
        if(eStatus==XN_CALIBRATION_STATUS_MANUAL_ABORT)
        {
            printf("Manual abort occured, stop attempting to calibrate!");
            return;
        }
        if (g_bNeedPose)
        {
            g_UserGenerator.GetPoseDetectionCap().StartPoseDetection(g_strPose, nId);
        }
        else
        {
            g_UserGenerator.GetSkeletonCap().RequestCalibration(nId, TRUE);
        }
    }
}
开发者ID:stozpark,项目名称:openni,代码行数:29,代码来源:NiSkeletonBenchmark.cpp

示例10: LoadCalibration

// Load calibration from file
bool LoadCalibration( xn::UserGenerator& userGenerator )
{
    printf("LoadCalibration\n");

    XnUserID aUserIDs[20] = {0};
    XnUInt16 nUsers = 20;
    userGenerator.GetUsers(aUserIDs, nUsers);
    for (int i = 0; i < nUsers; ++i) {
        // ユーザーがキャリブレーションされているときは何もしない
        if (userGenerator.GetSkeletonCap().IsCalibrated(aUserIDs[i]))
            continue;

        if (userGenerator.GetSkeletonCap().IsCalibrating(aUserIDs[i]))
            continue;

        // ファイルから、キャリブレーション情報を取得し、骨格の追跡を開始する
        printf("Load user's calibration from file: user %d\n", aUserIDs[i]);
        XnStatus rc = userGenerator.GetSkeletonCap().LoadCalibrationDataFromFile(aUserIDs[i], XN_CALIBRATION_FILE_NAME);
        if (rc == XN_STATUS_OK) {
            printf("Make sure state is coherent: user %d\n", aUserIDs[i]);
            userGenerator.GetPoseDetectionCap().StopPoseDetection(aUserIDs[i]);
            userGenerator.GetSkeletonCap().StartTracking(aUserIDs[i]);
            return true;
        }

        break;
    }

    return false;
}
开发者ID:takanori,项目名称:openni_sandbox,代码行数:31,代码来源:main.cpp

示例11: whu_NewUser

void XN_CALLBACK_TYPE whu_NewUser(xn::UserGenerator &generator,
	XnUserID user,
	void* pCookie)
{
	cout<<"New User Identified:"<<user<<endl;
	//generator.GetSkeletonCap().RequestCalibration(user,true);//假如不需要做出投降姿势才开始的话,把此句解注释
	generator.GetPoseDetectionCap().StartPoseDetection("Psi", user);//做出[ 。]姿势以开始用户认证//
}
开发者ID:ShelmyLin,项目名称:Powerful_Atom_Hand,代码行数:8,代码来源:whu_MyHand.cpp

示例12: User_NewUser

void XN_CALLBACK_TYPE User_NewUser(xn::UserGenerator& generator, XnUserID nId, void* pCookie) {
    ROS_INFO("New User %d", nId);

    if (g_bNeedPose)
        g_UserGenerator.GetPoseDetectionCap().StartPoseDetection(g_strPose, nId);
    else
        g_UserGenerator.GetSkeletonCap().RequestCalibration(nId, TRUE);
}
开发者ID:flair2005,项目名称:openni_tracker_multi,代码行数:8,代码来源:openni_tracker_modified2.cpp

示例13: printf

void XN_CALLBACK_TYPE
Pose_Detected(xn::PoseDetectionCapability& pose, const XnChar* strPose,
              XnUserID nId, void* pCookie) {
  printf("Pose %s for user %d\n", strPose, nId);
  FBLOG_INFO("Pose_Detected()", "Pose_Detected");
  g_UserGenerator.GetPoseDetectionCap().StopPoseDetection(nId);
  g_UserGenerator.GetSkeletonCap().RequestCalibration(nId, TRUE);
  (*((hiKinect *)pCookie)->callbackPtr)->InvokeAsync("", FB::variant_list_of("POSE_DETECTED"));
}
开发者ID:xiaohanzhang,项目名称:HiKinect,代码行数:9,代码来源:hiKinect.cpp

示例14: poseDetectedCB

static void XN_CALLBACK_TYPE poseDetectedCB(xn::PoseDetectionCapability &,
					    const XnChar* strPose,
					    XnUserID nId, void* /*pCookie*/)
{
  XnUInt32 epochTime = 0;
  xnOSGetEpochTime(&epochTime);
  printf("%d Pose %s detected for user %d\n", epochTime, strPose, nId);
  userGen.GetPoseDetectionCap().StopPoseDetection(nId);
  userGen.GetSkeletonCap().RequestCalibration(nId, TRUE);
}
开发者ID:Rajesh-Ru,项目名称:act-rec-proj-2013,代码行数:10,代码来源:KinectDataPub.cpp

示例15: UserFoundCB

void XN_CALLBACK_TYPE UserFoundCB(
   xn::UserGenerator& gen,
   XnUserID id,
   void* /*cookie*/
)
{
   LOG(logDEBUG) << "UserFoundCB()";

   gen.GetPoseDetectionCap().StartPoseDetection("Psi", id);
}
开发者ID:vobject,项目名称:kinect-experiments,代码行数:10,代码来源:UserTracking.cpp


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