Ejemplo n.º 1
0
        /// <summary>
        /// Switches the window to Face Recognition activity window
        /// </summary>
        public static void SwitchToFaceRecognitionActivityWindow()
        {
            Window faceRecogWindow = new FaceRecognitionActivityWindow();

            App.Current.MainWindow = faceRecogWindow;
            faceRecogWindow.Show();
        }
Ejemplo n.º 2
0
            /// <summary>
            /// Updates the face tracking information for this skeleton
            /// </summary>
            internal void OnFrameReady(KinectSensor kinectSensor, ColorImageFormat colorImageFormat, byte[] colorImage, DepthImageFormat depthImageFormat, short[] depthImage, Skeleton skeletonOfInterest, FaceRecognitionActivityWindow win)
            {
                if (CheckFace(kinectSensor, colorImageFormat, colorImage, depthImageFormat, depthImage, skeletonOfInterest))
                {
                    count++;
                }
                else count = 0;
                if (count == 1)
                {
                    count = 0;
                    currentState = (currentState + 1) % 3;
                    // highlight the next exercise


                    if (currentState == 0)
                    {
                        Color tileFill = Color.FromRgb(76, 76, 76);
                        SolidColorBrush brush1 = new SolidColorBrush(tileFill);
                        win.SadTile.Fill = brush1;


                        Color focusTileFill = Color.FromRgb(96, 96, 96);
                        SolidColorBrush brush2 = new SolidColorBrush(focusTileFill);
                        win.HappyTile.Fill = brush2;

                        Color secTileFill = Color.FromRgb(76, 76, 76);
                        SolidColorBrush brush3 = new SolidColorBrush(tileFill);
                        win.AngryTile.Fill = brush3;

                        // display the large icon
                        win.ActivityImage.Source = new BitmapImage(new Uri(@"happy_big.png"));
                        win.ActivityLabel.Content = "Happy";
                    }
                    else if (currentState == 1)
                    {
                        Color tileFill = Color.FromRgb(96, 96, 96);
                        SolidColorBrush brush1 = new SolidColorBrush(tileFill);
                        win.SadTile.Fill = brush1;

                        Color focusTileFill = Color.FromRgb(76, 76, 76);
                        SolidColorBrush brush2 = new SolidColorBrush(focusTileFill);
                        win.HappyTile.Fill = brush2;

                        Color secTileFill = Color.FromRgb(76, 76, 76);
                        SolidColorBrush brush3 = new SolidColorBrush(tileFill);
                        win.AngryTile.Fill = brush3;

                        // display the large icon
                        win.ActivityImage.Source = new BitmapImage(new Uri(@"sad_big.png"));
                        win.ActivityLabel.Content = "Sad";
                    }
                    else if (currentState == 2)
                    {
                        Color tileFill = Color.FromRgb(76, 76, 76);
                        SolidColorBrush brush1 = new SolidColorBrush(tileFill);
                        win.SadTile.Fill = brush1;

                        Color focusTileFill = Color.FromRgb(76, 76, 76);
                        SolidColorBrush brush2 = new SolidColorBrush(focusTileFill);
                        win.HappyTile.Fill = brush2;

                        Color secTileFill = Color.FromRgb(96, 96, 96);
                        SolidColorBrush brush3 = new SolidColorBrush(tileFill);
                        win.AngryTile.Fill = brush3;

                        // display the large icon
                        win.ActivityImage.Source = new BitmapImage(new Uri(@"angry_big.png"));
                        win.ActivityLabel.Content = "Angry";
                    }


                    this.speech.SpeakAsync("Moving to next level");
                    // Notify to change face
                    Trace.WriteLine("Change state to: " + states[currentState]);
                }
            }
Ejemplo n.º 3
0
 public FaceTrackingViewer(FaceRecognitionActivityWindow win)
 {
     this.activityWindow = win;
     //this.InitializeComponent();
 }
Ejemplo n.º 4
0
            /// <summary>
            /// Updates the face tracking information for this skeleton
            /// </summary>
            internal void OnFrameReady(KinectSensor kinectSensor, ColorImageFormat colorImageFormat, byte[] colorImage, DepthImageFormat depthImageFormat, short[] depthImage, Skeleton skeletonOfInterest, FaceRecognitionActivityWindow win)
            {
                if (CheckFace(kinectSensor, colorImageFormat, colorImage, depthImageFormat, depthImage, skeletonOfInterest))
                {
                    count++;
                }
                else
                {
                    count = 0;
                }
                if (count == 1)
                {
                    count        = 0;
                    currentState = (currentState + 1) % 3;
                    // highlight the next exercise


                    if (currentState == 0)
                    {
                        Color           tileFill = Color.FromRgb(76, 76, 76);
                        SolidColorBrush brush1   = new SolidColorBrush(tileFill);
                        win.SadTile.Fill = brush1;


                        Color           focusTileFill = Color.FromRgb(96, 96, 96);
                        SolidColorBrush brush2        = new SolidColorBrush(focusTileFill);
                        win.HappyTile.Fill = brush2;

                        Color           secTileFill = Color.FromRgb(76, 76, 76);
                        SolidColorBrush brush3      = new SolidColorBrush(tileFill);
                        win.AngryTile.Fill = brush3;

                        // display the large icon
                        win.ActivityImage.Source  = new BitmapImage(new Uri(@"happy_big.png"));
                        win.ActivityLabel.Content = "Happy";
                    }
                    else if (currentState == 1)
                    {
                        Color           tileFill = Color.FromRgb(96, 96, 96);
                        SolidColorBrush brush1   = new SolidColorBrush(tileFill);
                        win.SadTile.Fill = brush1;

                        Color           focusTileFill = Color.FromRgb(76, 76, 76);
                        SolidColorBrush brush2        = new SolidColorBrush(focusTileFill);
                        win.HappyTile.Fill = brush2;

                        Color           secTileFill = Color.FromRgb(76, 76, 76);
                        SolidColorBrush brush3      = new SolidColorBrush(tileFill);
                        win.AngryTile.Fill = brush3;

                        // display the large icon
                        win.ActivityImage.Source  = new BitmapImage(new Uri(@"sad_big.png"));
                        win.ActivityLabel.Content = "Sad";
                    }
                    else if (currentState == 2)
                    {
                        Color           tileFill = Color.FromRgb(76, 76, 76);
                        SolidColorBrush brush1   = new SolidColorBrush(tileFill);
                        win.SadTile.Fill = brush1;

                        Color           focusTileFill = Color.FromRgb(76, 76, 76);
                        SolidColorBrush brush2        = new SolidColorBrush(focusTileFill);
                        win.HappyTile.Fill = brush2;

                        Color           secTileFill = Color.FromRgb(96, 96, 96);
                        SolidColorBrush brush3      = new SolidColorBrush(tileFill);
                        win.AngryTile.Fill = brush3;

                        // display the large icon
                        win.ActivityImage.Source  = new BitmapImage(new Uri(@"angry_big.png"));
                        win.ActivityLabel.Content = "Angry";
                    }


                    this.speech.SpeakAsync("Moving to next level");
                    // Notify to change face
                    Trace.WriteLine("Change state to: " + states[currentState]);
                }
            }
Ejemplo n.º 5
0
 /// <summary>
 /// Switches the window to Face Recognition activity window
 /// </summary>
 public static void SwitchToFaceRecognitionActivityWindow()
 {
     Window faceRecogWindow = new FaceRecognitionActivityWindow();
     App.Current.MainWindow = faceRecogWindow;
     faceRecogWindow.Show();
 }
Ejemplo n.º 6
0
 public FaceTrackingViewer(FaceRecognitionActivityWindow win)
 {
     this.activityWindow = win;
     //this.InitializeComponent();
 }