void UserDetected(NewUserEventArgs e)
	{
		Vector3 com = UserTracker.GetUserCenterOfMass(e.ID);
		GameObject clone = (GameObject)Instantiate(userObject,Vector3.Scale(scale,com),Quaternion.identity);		
		clone.transform.parent = transform;
		clone.transform.localPosition = Vector3.Scale(scale,com);
		userObjMap.Add(e.ID,clone);
	}
 /// <summary>
 /// Function that is called whenever a new user enters the range of the Kinect.
 /// This function requests calibration for the new user after 3 seconds.
 /// </summary>
 /// <param name="sender">The object that called this function</param>
 /// <param name="e">The events associated with this call; used to retrieve the users id</param>
 private void OnNewUser(object sender, NewUserEventArgs e)
 {
     Logger.Log("New user: " + e.ID);
     System.Timers.Timer calibrationTimer = new System.Timers.Timer();
     calibrationTimer.Interval = 3000;
     calibrationTimer.Elapsed += (src, a) => RequestCalibrationForUser(src, a, e.ID);
     calibrationTimer.Start();
 }
		void FUserGenerator_NewUser(object sender, NewUserEventArgs e)
		{
			lock (FLockUserData)
				FUserData.Add(e.ID, new UserData());
		}
 // ユーザーの検出通知
 void user_NewUser( object sender, NewUserEventArgs e )
 {
     // キャリブレーションポーズが必要な場合は、ポーズの検出を開始する
     if ( user.SkeletonCapability.DoesNeedPoseForCalibration ) {
         user.PoseDetectionCapability.StartPoseDetection( user.SkeletonCapability.CalibrationPose, e.ID );
     }
     // キャリブレーションポーズが不要な場合は、キャリブレーションを開始する
     else {
         user.SkeletonCapability.RequestCalibration( e.ID, true );
     }
 }
Exemple #5
0
 void userGenerator_NewUser(object sender, NewUserEventArgs e)
 {
     this.poseDetectionCapability.StartPoseDetection(this.calibPose, e.ID);
 }
 void userGenerator_NewUser(object sender, NewUserEventArgs e)
 {
     int id = e.ID;
     try
     {
         if (File.Exists(skeletonFile))
         {
             OnUserFound(id);
             this.skeletonCapability.LoadCalibrationDataFromFile(id, "skeleton.data");
             //this.skeletonCapability.LoadCalibrationData(id, 0);
             this.skeletonCapability.StartTracking(id);
             this.joints.Add(id, new Dictionary<SkeletonJoint, SkeletonJointPosition>());
             OnSkeletonReady(id);
         }
         else
         {
             this.poseDetectionCapability.StartPoseDetection(this.calibPose, id);
             OnUserFound(id);
         }
     }
     catch (StatusException)
     {
         this.poseDetectionCapability.StartPoseDetection(this.calibPose, id);
         OnUserFound(id);
     }
 }
Exemple #7
0
 void HandleUserGeneratorNewUser(object sender, NewUserEventArgs nu)
 {
     HUD.text =  (HUD.text + "\nNew User Found: " + nu.ID);
     this.poseDetectionCapability.StartPoseDetection(calibPose, nu.ID);
 }
Exemple #8
0
 private void OnUserGeneratorNewUser(object sender, NewUserEventArgs e)
 {
     this.skeletonCapbility.RequestCalibration(e.ID, true);
 }
 /// @brief callback for updating structures when a user is found
 /// 
 /// This callback is called when a user is found. It adds the user to the data structures (including
 /// a new unique ID).
 /// @param sender who called the callback
 /// @param e the arguments of the event.
 private void NewUserCallback(object sender, NewUserEventArgs e)
 {
     m_contextManager.Log("found new user, userID=" + e.ID, NIEventLogger.Categories.Callbacks, NIEventLogger.Sources.Skeleton, NIEventLogger.VerboseLevel.Verbose);
     AddNewUser(e.ID);
 }
        // ユーザー検出
        void user_NewUser(object sender, NewUserEventArgs e)
        {
            message = "ユーザー検出:" + e.ID;

              // ポーズの検出が必要であれば、ポーズの検出を開始する
              if (!string.IsNullOrEmpty(pose))
              {
            user.PoseDetectionCapability.StartPoseDetection(pose, e.ID);
              }
              // ポーズの検出が不要であれば、キャリブレーションを開始する
              else
              {
            user.SkeletonCapability.RequestCalibration(e.ID, true);
              }
        }
 // 新しユーザーの検出
 void user_NewUser(object sender, NewUserEventArgs e)
 {
     message = "ユーザー検出:" + e.ID;
 }
 void user_NewUser(object sender, NewUserEventArgs e)
 {
     Trace.WriteLine("New User:" + e.ID);
     user.SkeletonCapability.RequestCalibration(e.ID, true);
 }
 void userGenerator_NewUser(object sender, NewUserEventArgs e)
 {
     allUsers.Add(e.ID);
     if (AttemptToCalibrate)
     {
         this.poseDetectionCapability.StartPoseDetection(this.calibPose, e.ID);
     }
 }
 void userGenerator_NewUser(object sender, NewUserEventArgs e)
 {
     if (FSkeletonCapability.DoesNeedPoseForCalibration)
         FPoseDetectionCapability.StartPoseDetection(FCalibPose, e.ID);
     else
         FSkeletonCapability.RequestCalibration(e.ID, true);
 }
Exemple #15
0
        void _userGenerator_NewUser(object sender, NewUserEventArgs e)
        {
            string tname = Thread.CurrentThread.Name;

            if (NewUser != null)
                NewUser(this, e);
        }
        void _UserGenerator_NewUser(object sender, NewUserEventArgs e)
        {
            if(_FindUser(e.ID) == null)
            {
                //new user
                var user = new KinectUser(e.ID);

                lock (_UserLock)
                {
                    this.Users.Add(e.ID, user);
                }

                UserFound.Raise(this, user);

                //use the first lot of calibration data loaded for all users if available
                if (System.IO.File.Exists(this.CalibrationPath))
                {
                    try
                    {
                        lock (_SkeletonLock)
                        {
                            _SkeletonCapability.LoadCalibrationDataFromFile(e.ID, this.CalibrationPath);
                            _SkeletonCapability.StartTracking(e.ID);

                            user.IsCalibrated = true;

                            SkeletonReady.Raise(this, user);
                        }
                    }
                    catch(StatusException)
                    {
                        //need to detect the pose
                        _PoseDetectionCapability.StartPoseDetection(_CalibrationPose, e.ID);
                    }
                }
                else
                {
                    //need to detect the pose
                    _PoseDetectionCapability.StartPoseDetection(_CalibrationPose, e.ID);
                }
            }
        }
 void _user_generator_NewUser(object sender, NewUserEventArgs e)
 {
     _pose_detect_caps.StartPoseDetection(_calibration_pose, e.ID);
     Console.WriteLine("Found user: "******" looking for pose now");
 }
    void userGenerator_NewUser(object sender, NewUserEventArgs e)
    {
        allUsers.Add(e.ID);
		SendMessage("UserDetected", e, SendMessageOptions.DontRequireReceiver);
        if (AttemptToCalibrate)
        {
            this.poseDetectionCapability.StartPoseDetection(this.calibPose, e.ID);
        }
    }
 void userGenerator_NewUser(object sender, NewUserEventArgs e)
 {
     if (this.skeletonCapbility.DoesNeedPoseForCalibration)
     {
         this.poseDetectionCapability.StartPoseDetection(this.calibPose, e.ID);
     }
     else
     {
         this.skeletonCapbility.RequestCalibration(e.ID, true);
     }
 }
 private void NewUser(object sender, NewUserEventArgs e)
 {
     if (File.Exists(SKELETON_CALIBRATION_FILE) && !trackingUser)
     {
         userGenerator.SkeletonCapability.LoadCalibrationDataFromFile(e.ID, SKELETON_CALIBRATION_FILE);
         userGenerator.SkeletonCapability.StartTracking(e.ID);
         trackingUser = true;
         trackingUserId = e.ID;
     }
     else
         userGenerator.PoseDetectionCapability.StartPoseDetection(userGenerator.SkeletonCapability.CalibrationPose, e.ID);
     Console.Write(e.ID + " Found new user");
 }