Exemple #1
0
// 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);
}
Exemple #2
0
// Callback: New user was detected
void XN_CALLBACK_TYPE User_NewUser(xn::UserGenerator& generator, XnUserID nId, void* pCookie){
    XnUInt32 epochTime = 0;
    xnOSGetEpochTime(&epochTime);
    LOG_D("%d New User %d", epochTime, nId);
    // New user found
    if (g_bNeedPose){
        g_UserGenerator.GetPoseDetectionCap().StartPoseDetection(g_strPose, nId);
    }
    else{
        g_SkeletonCap.RequestCalibration(nId, TRUE);
    }
}
Exemple #3
0
void XN_CALLBACK_TYPE Kinect::CalibrationEnd( xn::SkeletonCapability& skeleton,XnUserID user,
	XnCalibrationStatus eStatus,void* pCookie)
{  
	if( eStatus == XN_CALIBRATION_STATUS_OK )
	{
		skeleton.StartTracking(user);
	}
	else
	{
		skeleton.RequestCalibration( user, true );
	}
}
Exemple #4
0
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
        LOG_D("%d Calibration complete, start tracking user %d", epochTime, nId);		
        g_SkeletonCap.StartTracking(nId);
    }
    else{
        // Calibration failed
        LOG_D("%d Calibration failed for user %d\n", epochTime, nId);
        if(eStatus==XN_CALIBRATION_STATUS_MANUAL_ABORT){
            LOG_D("%s", "Manual abort occured, stop attempting to calibrate!");
            return;
        }
        if (g_bNeedPose){
            g_UserGenerator.GetPoseDetectionCap().StartPoseDetection(g_strPose, nId);
        }
        else{
            g_SkeletonCap.RequestCalibration(nId, TRUE);
        }
    }
}