本文整理汇总了C++中xn::UserGenerator类的典型用法代码示例。如果您正苦于以下问题:C++ UserGenerator类的具体用法?C++ UserGenerator怎么用?C++ UserGenerator使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了UserGenerator类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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);
ROS_INFO("%d New User %d\n", epochTime, nId);
// New user found
if (g_bNeedPose)
{
g_UserGenerator.GetPoseDetectionCap().StartPoseDetection(g_strPose, nId);
}
else
{
g_UserGenerator.GetSkeletonCap().RequestCalibration(nId, TRUE);
}
publishUserDetected(nId);
}
示例2: SaveCalibration
// Save calibration to file
void SaveCalibration()
{
XnUserID aUserIDs[20] = {0};
XnUInt16 nUsers = 20;
g_UserGenerator.GetUsers(aUserIDs, nUsers);
for (int i = 0; i < nUsers; ++i)
{
// Find a user who is already calibrated
if (g_UserGenerator.GetSkeletonCap().IsCalibrated(aUserIDs[i]))
{
// Save user's calibration to file
g_UserGenerator.GetSkeletonCap().SaveCalibrationDataToFile(aUserIDs[i], XN_CALIBRATION_FILE_NAME);
break;
}
}
}
示例3: User_NewUser
void XN_CALLBACK_TYPE
User_NewUser(xn::UserGenerator& generator, XnUserID nId, void* pCookie)
{
printf("New User: %d\n", nId);
g_UserGenerator.GetPoseDetectionCap().StartPoseDetection(POSE_TO_USE,
nId);
}
示例4: getAnklePitch
float RLeg::getAnklePitch(XnUserID user, xn::UserGenerator guser)
{
XnSkeletonJointTransformation knee, ankle, foot;
RLeg finalAngle;
guser.GetSkeletonCap().GetSkeletonJoint(user,XN_SKEL_RIGHT_KNEE,knee);
guser.GetSkeletonCap().GetSkeletonJoint(user,XN_SKEL_RIGHT_ANKLE,ankle);
guser.GetSkeletonCap().GetSkeletonJoint(user,XN_SKEL_RIGHT_FOOT,foot);
return (finalAngle.getAngle(knee.position.position, ankle.position.position, foot.position.position));
}
示例5: 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);
}
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);
}
}
示例6: getKneePitch
float RLeg::getKneePitch(XnUserID user, xn::UserGenerator guser)
{
XnSkeletonJointTransformation hip, knee, ankle;
RLeg finalAngle;
guser.GetSkeletonCap().GetSkeletonJoint(user,XN_SKEL_RIGHT_HIP,hip);
guser.GetSkeletonCap().GetSkeletonJoint(user,XN_SKEL_RIGHT_KNEE,knee);
guser.GetSkeletonCap().GetSkeletonJoint(user,XN_SKEL_RIGHT_FOOT,ankle);
return (finalAngle.getAngle(knee.position.position, hip.position.position, ankle.position.position));
}
示例7: getHipRoll
///Obtiene el angulo real dado por el kinect del movimiento de la cadera
float RLeg::getHipRoll(XnUserID user, xn::UserGenerator guser)
{
XnSkeletonJointTransformation lhip, rhip, knee;
RLeg finalAngle;
guser.GetSkeletonCap().GetSkeletonJoint(user,XN_SKEL_LEFT_HIP,lhip);
guser.GetSkeletonCap().GetSkeletonJoint(user,XN_SKEL_RIGHT_HIP,rhip);
guser.GetSkeletonCap().GetSkeletonJoint(user,XN_SKEL_RIGHT_KNEE,knee);
return (finalAngle.getAngle(lhip.position.position, rhip.position.position, knee.position.position));
}
示例8: processUsers
void processUsers(uint32_t frameId)
{
// Process users
XnUserID aUsers[20];
XnUInt16 nUsers = 20;
g_UserGenerator.GetUsers(aUsers, nUsers);
std::vector<XnUserID> users;
for (int i = 0; i < nUsers; ++i)
{
if (g_bDrawSkeleton && g_UserGenerator.GetSkeletonCap().IsTracking(aUsers[i]))
{
users.push_back(aUsers[i]);
}
}
processAndPublish(users, frameId);
}
示例9: glutDisplay
// this function is called each frame
void glutDisplay (void)
{
glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
// Setup the OpenGL viewpoint
glMatrixMode(GL_PROJECTION);
glPushMatrix();
glLoadIdentity();
xn::SceneMetaData sceneMD;
xn::DepthMetaData depthMD;
g_DepthGenerator.GetMetaData(depthMD);
glOrtho(0, depthMD.XRes(), depthMD.YRes(), 0, -1.0, 1.0);
glDisable(GL_TEXTURE_2D);
if (!g_bPause)
{
// Read next available data
g_Context.WaitAndUpdateAll();
}
// Process the data
g_DepthGenerator.GetMetaData(depthMD);
g_UserGenerator.GetUserPixels(0, sceneMD);
DrawDepthMap(depthMD, sceneMD);
glutSwapBuffers();
}
示例10: publishTransforms
void publishTransforms(const std::string& frame_id)
{
XnUserID users[15];
XnUInt16 users_count = 15;
XnUserID user = 0;
g_UserGenerator.GetUsers(users, users_count);
for (int i = 0; i <= users_count; ++i)
{
user = users[i];
if (!g_UserGenerator.GetSkeletonCap().IsTracking(user))
{
continue;
}
publishTransform(user, XN_SKEL_HEAD, frame_id, "head");
publishTransform(user, XN_SKEL_NECK, frame_id, "neck");
publishTransform(user, XN_SKEL_TORSO, frame_id, "torso");
// publishTransform(user, XN_SKEL_LEFT_SHOULDER, frame_id, "left_shoulder");
// publishTransform(user, XN_SKEL_LEFT_ELBOW, frame_id, "left_elbow");
// publishTransform(user, XN_SKEL_LEFT_HAND, frame_id, "left_hand");
publishTransform(user, XN_SKEL_LEFT_SHOULDER, frame_id, "right_shoulder");
publishTransform(user, XN_SKEL_LEFT_ELBOW, frame_id, "right_elbow");
publishTransform(user, XN_SKEL_LEFT_HAND, frame_id, "right_hand");
// publishTransform(user, XN_SKEL_RIGHT_SHOULDER, frame_id, "right_shoulder");
// publishTransform(user, XN_SKEL_RIGHT_ELBOW, frame_id, "right_elbow");
// publishTransform(user, XN_SKEL_RIGHT_HAND, frame_id, "right_hand");
publishTransform(user, XN_SKEL_RIGHT_SHOULDER, frame_id, "left_shoulder");
publishTransform(user, XN_SKEL_RIGHT_ELBOW, frame_id, "left_elbow");
publishTransform(user, XN_SKEL_RIGHT_HAND, frame_id, "left_hand");
// publishTransform(user, XN_SKEL_LEFT_HIP, frame_id, "left_hip");
// publishTransform(user, XN_SKEL_LEFT_KNEE, frame_id, "left_knee");
// publishTransform(user, XN_SKEL_LEFT_FOOT, frame_id, "left_foot");
publishTransform(user, XN_SKEL_LEFT_HIP, frame_id, "right_hip");
publishTransform(user, XN_SKEL_LEFT_KNEE, frame_id, "right_knee");
publishTransform(user, XN_SKEL_LEFT_FOOT, frame_id, "right_foot");
// publishTransform(user, XN_SKEL_RIGHT_HIP, frame_id, "right_hip");
// publishTransform(user, XN_SKEL_RIGHT_KNEE, frame_id, "right_knee");
// publishTransform(user, XN_SKEL_RIGHT_FOOT, frame_id, "right_foot");
publishTransform(user, XN_SKEL_RIGHT_HIP, frame_id, "left_hip");
publishTransform(user, XN_SKEL_RIGHT_KNEE, frame_id, "left_knee");
publishTransform(user, XN_SKEL_RIGHT_FOOT, frame_id, "left_foot");
}
}
示例11: getHeadPitch
///Obtiene el angulo real dado por el kinect del movimiento frontal de la cabeza
float Head::getHeadPitch(XnUserID user, xn::UserGenerator guser)
{
XnSkeletonJointTransformation head, neck, torso;
Head finalAngle;
guser.GetSkeletonCap().GetSkeletonJoint(user,XN_SKEL_HEAD,head);
guser.GetSkeletonCap().GetSkeletonJoint(user,XN_SKEL_NECK,neck);
guser.GetSkeletonCap().GetSkeletonJoint(user,XN_SKEL_TORSO,torso);
return (finalAngle.getAngle(head.position.position, neck.position.position, torso.position.position));
}
示例12: User_LostUser
//----------------------------------------
void XN_CALLBACK_TYPE ofxOpenNITracker::User_LostUser(xn::UserGenerator& userGenerator, XnUserID nID, void* pCookie){
ofLogVerbose(LOG_NAME) << "Lost user" << nID;
ofxOpenNITracker* tracker = static_cast<ofxOpenNITracker*>(pCookie);
userGenerator.GetSkeletonCap().Reset(nID);
tracker->users[nID];
tracker->setUserState(nID, ofxOpenNIUser::Lost);
}
示例13: CheckPosture
// track two users
// take down users' joint positions
// calculate joint angles and etc.
void CheckPosture(const xn::DepthMetaData& dmd, const xn::SceneMetaData& smd, FILE *fp)
{
XnUserID aUsers[2];
XnUInt16 nUsers = 2;
g_UserGenerator.GetUsers(aUsers, nUsers);
for(int i = 0; i < nUsers; ++i)
{
// if the user is being tracked
// take down his/her joint positions
if (g_UserGenerator.GetSkeletonCap().IsTracking(aUsers[i]))
{
// check user posture
RecordAngle(aUsers[i], fp);
}
}
}
示例14: new_user
// Callback: New user was detected
void XN_CALLBACK_TYPE new_user(xn::UserGenerator& generator, XnUserID nId, void* pCookie) {
printf("New User %d\n", nId);
userGenerator.GetSkeletonCap().RequestCalibration(nId, TRUE);
if (kitchenMode) return;
lo_send(addr, "/new_user","i",(int)nId);
}
示例15: 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);//做出[ 。]姿势以开始用户认证//
}