/// <summary>
 /// if the user press ok
 /// </summary>
 private void ChangeFeedbacks()
 {
     DrawingSheetAvatarViewModel.Get().displayAgitationFeedback   = choiceFeedbackView.AgitationChoiceFeedback.IsChecked.Value;
     DrawingSheetAvatarViewModel.Get().displayArmsCrossedFeedback = choiceFeedbackView.ArmsCrossedChoiceFeedback.IsChecked.Value;
     DrawingSheetAvatarViewModel.Get().displayHandsJoinedFeedback = choiceFeedbackView.HandsJoinedChoiceFeedback.IsChecked.Value;
     if (TrackingSideTool.Get().ActivateFaceTrackingCheckBox.IsChecked.Value)
     {
         DrawingSheetAvatarViewModel.Get().displayEmotionFeedback = choiceFeedbackView.EmotionChoiceFeedback.IsChecked.Value;
         DrawingSheetAvatarViewModel.Get().displayLookDirFeedback = choiceFeedbackView.LookDirecChoiceFeedback.IsChecked.Value;
     }
     choiceFeedbackView.Close();
 }
Exemplo n.º 2
0
        /// <summary>
        /// Updates the AudienceMember current's face(2D) or color(3D) according to their interest level.
        /// </summary>
        /// <author> Oummar Mayaki </author>
        private void updateFace()
        {
            // With view direction
            if (TrackingSideTool.Get().LookRightCheckBox.IsChecked == true)
            {
                // Face
                if (GlobalInterest + interest <= this.thresholds[0] * 2)
                {
                    currentFace = "Audience_Bore";
                }
                else if (GlobalInterest + interest > this.thresholds[1] * 2)
                {
                    currentFace = "Audience_Interest";
                }
                else
                {
                    currentFace = "Audience_SlightBore";
                }

                // Color
                float totalInterest = (GlobalInterest + interest) / 2;
                float red           = Math.Min(2 - (2 * totalInterest), 1) * 150 / 255f;
                float green         = Math.Min(totalInterest * 2, 1) * 150 / 255f;
                faceColor = new OpenTK.Vector4(red, green, 0, 1);
            }

            // Without view direction
            else
            {
                // Face
                if (GlobalInterest <= this.thresholds[0])
                {
                    currentFace = "Audience_Bore";
                }
                else if (GlobalInterest > this.thresholds[1])
                {
                    currentFace = "Audience_Interest";
                }
                else
                {
                    currentFace = "Audience_SlightBore";
                }

                // Color
                float red   = Math.Min(2 - (2 * GlobalInterest), 1) * 150 / 255f;
                float green = Math.Min(GlobalInterest * 2, 1) * 150 / 255f;
                faceColor = new OpenTK.Vector4(red, green, 0, 1);
            }
        }
Exemplo n.º 3
0
 void FaceTrackingDisable_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
 {
     TrackingSideTool.Get().ActivateFaceTrackingCheckBox.IsChecked = true;
     initializeVideosMap();
 }
Exemplo n.º 4
0
        public void Update(Skeleton sk)
        {
            if (!AudioProvider.detectionActive)
            {
                TrackingSideTool.Get().SpeedRateDetectionCheckBox.IsChecked = true;
            }

            _up         = false;
            _complete   = false;
            _lookingDir = false;

            frame++;

            if (frame > NB_FRAME_MAX)
            {
                frame = 0;
                start = false;
                right = false;
                left  = false;
                _up   = true;

                DrawingSheetAvatarViewModel.displayCustomText = String.Empty;
                GestureRecognized?.Invoke(this, new EventArgs());
            }

            if (TrainingWithAvatarViewModel.Get().SkeletonList != null && TrainingWithAvatarViewModel.canBeInterrupted && !start)
            {
                DrawingSheetAvatarViewModel.displayCustomText = "Look at the direction of your raised arm then speak";
            }

            try
            {
                var face = KinectDevice.skeletonFaceTracker.facePoints3D;

                Vector3DF rightEye = face.ElementAt(20);
                Vector3DF leftEye  = face.ElementAt(53);

                Point3D handRight  = new Point3D(sk.Joints[JointType.HandRight].Position);
                Point3D handLeft   = new Point3D(sk.Joints[JointType.HandLeft].Position);
                Point3D elbowRight = new Point3D(sk.Joints[JointType.ElbowRight].Position);
                Point3D elbowLeft  = new Point3D(sk.Joints[JointType.ElbowLeft].Position);
                Point3D shoulder   = new Point3D(sk.Joints[JointType.ShoulderCenter].Position);

                if (verbose)
                {
                    Console.WriteLine("~~~~~~~~~~~~~~~~~~~~~~~~~");
                    Console.WriteLine("frame: " + frame);
                    Console.WriteLine("direction: " + (rightEye.Z - leftEye.Z));
                    Console.WriteLine("right: " + right);
                    Console.WriteLine("left: " + left);
                }

                if (Math.Abs(handRight.X - elbowRight.X) > 0.05 && handRight.Y > shoulder.Y)
                {
                    if (rightEye.Z - leftEye.Z < -0.015)
                    {
                        if (AudioProvider.currentIntensity > AUDIO_LOUDNESS)
                        {
                            start = true;
                            right = true;
                            DrawingSheetAvatarViewModel.displayCustomText = "Do the same with the other arm";

                            if (left)
                            {
                                frame     = 0;
                                start     = false;
                                right     = false;
                                left      = false;
                                _complete = true;

                                DrawingSheetAvatarViewModel.displayCustomText = String.Empty;
                                GestureRecognized?.Invoke(this, new EventArgs());
                            }
                        }
                    }
                    else if (!right)
                    {
                        frame       = 0;
                        start       = false;
                        right       = false;
                        left        = false;
                        _lookingDir = true;

                        DrawingSheetAvatarViewModel.displayCustomText = String.Empty;
                        GestureRecognized?.Invoke(this, new EventArgs());
                    }
                }

                if (Math.Abs(handLeft.X - elbowLeft.X) > 0.05 && handLeft.Y > shoulder.Y)
                {
                    if (rightEye.Z - leftEye.Z > 0.015)
                    {
                        if (AudioProvider.currentIntensity > AUDIO_LOUDNESS)
                        {
                            start = true;
                            left  = true;
                            DrawingSheetAvatarViewModel.displayCustomText = "Do the same with the other arm";

                            if (right)
                            {
                                frame     = 0;
                                start     = false;
                                right     = false;
                                left      = false;
                                _complete = true;

                                DrawingSheetAvatarViewModel.displayCustomText = String.Empty;
                                GestureRecognized?.Invoke(this, new EventArgs());
                            }
                        }
                    }
                    else if (!left)
                    {
                        frame       = 0;
                        start       = false;
                        right       = false;
                        left        = false;
                        _lookingDir = true;

                        DrawingSheetAvatarViewModel.displayCustomText = String.Empty;
                        GestureRecognized?.Invoke(this, new EventArgs());
                    }
                }
            }
            catch (Exception e) //the kinect don't catch the face
            {
                //System.Windows.Forms.MessageBox.Show("the kinect don't catch the face !");
                Console.Error.WriteLine(e);
            }
        }