Example #1
0
        public void UpdateGestureResult(string gestureName, DiscreteGestureResult result, float progress)
        {
            ////Checking for start geture
            //if (!CurrentExercise.IsStart)
            //{
            //    VTGesture startGesture = CurrentExercise.StartGesutre;

            //    //checking if the gesture is the start
            //    if (gestureName.Equals(startGesture.GestureName))
            //    {
            //        //checking if it detected
            //        // todo - add confidace threshold
            //        if (result.Detected ) //&& result.Confidence >= startGesture.ConfidanceTrshold)
            //        {
            //            startGesture.IsSuccess = result.Detected;
            //            //startGesture.ConfidenceValue = result.Confidence;
            //            CurrentExercise.IsStart = true;

            //            //throw event to UI
            //            startGestureDeteced();
            //        }
            //    }
            //}
            //else
            //{

            //}

            if (!CurrentExercise.IsFinish)
            {
                if (result.Detected)
                {
                    CurrentExercise.IsStart = true;
                    startGestureDeteced();
                }

                if (progress <= 0.02f && result.Confidence <= 0.001f && !result.Detected)
                {
                    CheckIfRoundSucces();
                }
                else
                {
                    CurrentExercise.CurrentRound.UpdateGestureDetection(gestureName, result, progress);

                }
            }
        }
 public void UpdateStartGestureResult(bool isBodyTrackIdValid, string gestureName, DiscreteGestureResult result)
 {
 }
        public void UpdateGestureResult(bool isBodyTrackingIdValid, string gestureName, DiscreteGestureResult result, float progress)
        {
            this.isTracked = isBodyTrackingIdValid;

            if (!this.isTracked)
            {
                // throw error the UC-Exercise

            }
            else
            {
                //if it start condition
                if (!this.currentExercise.IsStarted)
                {
                    if (gestureName.Equals(this.currentExercise.StartGesture.Name))
                    {
                        if (result.Detected /*&& result.Confidence > 0.3f*/)
                        {
                            this.currentExercise.StartGesture.SuccesStatus = result.Detected;
                            this.currentExercise.StartGesture.ConfidenceValue = result.Confidence;
                            this.currentExercise.IsStarted = true;

                            Console.WriteLine("Test: > Start gesture recognized");
                            //todo Start UI - countdown
                            StartEvent();
                        }

                        else
                        {
                            //Console.WriteLine("Please be in start position");
                        }
                    }
                }

                else
                {
                    // check other gesture
                    this.currentExercise.CurrentRound.UpdateCompeleteGesture(gestureName, result, progress);

                    // check if round finshed
                    if (progress <= 0.01f && this.currentExercise.CurrentRound.CheckRoundSuccess() && !this.currentExercise.ExerciseComplete)
                    {

                        //Console.WriteLine("Round #{0} Finished! Status: {1}", this.currentExercise.currentRound, this.currentExercise.CurrentRound.RoundSuccess);
                        this.currentExercise.NextRound();
                        roundSuccessEvent();

                    }

                    if (this.currentExercise.ExerciseComplete)
                    {
                        Switcher.Switcher.Switch(new UC_ExerciseResult(this.currentExercise));
                    }
                }
            }
        }
Example #4
0
        public void UpdateGestureDetection(string _gestureName, DiscreteGestureResult _gestureResult, float _gestureProgress)
        {
            if (GestureList.ContainsKey(_gestureName))
            {
                VTGesture _gesture = null;
                GestureList.TryGetValue(_gestureName, out _gesture);

                _gesture.ConfidenceValue = _gestureResult.Confidence;

                if (_gestureResult.Detected)
                {
                    _gesture.ProgressValue = _gestureProgress;
                }

                if (_gestureResult.Detected && _gesture.IsPassConfidanceTrshold() && _gesture.IsPassProgressTrshold() && !_gesture.IsSuccess && _gestureProgress > 0.1)
                {
                    Console.WriteLine("Round {0}, G: {1}, prog: {2}, conf: {3}, Time: {4}, Detected {5}", RoundNumber, _gesture.GestureName, _gestureProgress, _gestureResult.Confidence
                                      ,DateTime.Now.ToString("mm:ss:ffff"), _gestureResult.Detected);

                    _gesture.IsSuccess = true;
                    CheckProgress();
                }
            }
        }
Example #5
0
        public void UpdateCompeleteGesture(string gestureName, DiscreteGestureResult result, float progress)
        {
            if (GestureList.ContainsKey(gestureName))
            {
                ExerciseGesture gesture = null;
                GestureList.TryGetValue(gestureName, out gesture);

                gesture.ConfidenceValue = result.Confidence;

                if (result.Detected)
                {
                    gesture.ProgressValue = progress;
                }

                if (result.Detected && gesture.ConfidenceValue > 0.3f)
                {
                    //Console.WriteLine("{0}: Conf: {1}, Detected: {2}, Progress: {3}", gestureName, gesture.ConfidenceValue.ToString(), result.Detected.ToString(), gesture.ProgressValue.ToString());
                    gesture.SuccesStatus = true;
                }
            }
        }