本文整理汇总了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);
}
示例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);
}
}
}
示例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);
}
}
示例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);
}
示例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();
}
示例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);
}
示例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;
}
示例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);
}
}
}
示例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);
}
}
}
示例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;
}
示例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);//做出[ 。]姿势以开始用户认证//
}
示例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);
}
示例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"));
}
示例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);
}
示例15: UserFoundCB
void XN_CALLBACK_TYPE UserFoundCB(
xn::UserGenerator& gen,
XnUserID id,
void* /*cookie*/
)
{
LOG(logDEBUG) << "UserFoundCB()";
gen.GetPoseDetectionCap().StartPoseDetection("Psi", id);
}