public PreposeGesturesFrameSource(KinectSensor sensor, ulong initialTrackingId) { KinectSensor = sensor; TrackingId = initialTrackingId; Gestures = new List <Gesture>(); myMatcher = new BodyMatcher(Gestures); myReader = new PreposeGesturesFrameReader(this); }
/// <summary> /// Matches a Kinect body to a set of gestures within the app. /// </summary> /// <param name="kinectJoints">Body representation</param> /// <param name="jumpToNextPose">synthesizes a new body in correct position if true</param> /// <returns></returns> public static List<GestureStatus> TestBody(BodyMatcher matcher, IReadOnlyDictionary<Microsoft.Kinect.JointType, Microsoft.Kinect.Joint> kinectJoints, bool jumpToNextPose = false) { // convert Kinect.Body to Z3Body var body = new Z3Body(); if (!jumpToNextPose) { body = Z3KinectConverter.CreateZ3Body(kinectJoints); } else { //body = GetCopiedBodyValues(this.Gestures[this.GetMostAdvancedGesturesIDs()[0]].GetTarget().Body); var firstGestureBody = matcher.GetLastGestureTarget().Body; body = new Z3Body(firstGestureBody); } return matcher.TestBody(body); }
/// <summary> /// Matches a Kinect body to a set of gestures within the app. /// </summary> /// <param name="kinectJoints">Body representation</param> /// <param name="jumpToNextPose">synthesizes a new body in correct position if true</param> /// <returns></returns> public static List <GestureStatus> TestBody(BodyMatcher matcher, IReadOnlyDictionary <Microsoft.Kinect.JointType, Microsoft.Kinect.Joint> kinectJoints, bool jumpToNextPose = false) { // convert Kinect.Body to Z3Body var body = new Z3Body(); if (!jumpToNextPose) { body = Z3KinectConverter.CreateZ3Body(kinectJoints); } else { //body = GetCopiedBodyValues(this.Gestures[this.GetMostAdvancedGesturesIDs()[0]].GetTarget().Body); var firstGestureBody = matcher.GetLastGestureTarget().Body; body = new Z3Body(firstGestureBody); } return(matcher.TestBody(body)); }
private void StartButton_Click(object sender, RoutedEventArgs e) { if(!playingGesture) { parsedText = this.ScriptTextBox.Text; try { var app = PreposeGestures.App.ReadAppText(parsedText); matcher = new BodyMatcher(app, (int)PrecisionSlider.Value); Debug.WriteLine(app); // get the last gesture this.MainGestureAndPoseNameTextBlock.Text = app.Gestures[app.Gestures.Count - 1].Name; this.StartMainProgressBars(app.Gestures[app.Gestures.Count - 1].Steps); this.CompletedGrid.Visibility = System.Windows.Visibility.Visible; this.MainGestureAndPoseNameTextBlock.Visibility = System.Windows.Visibility.Visible; this.ScriptTextBox.IsReadOnly = true; this.ScriptTextBox.Background = Brushes.WhiteSmoke; this.ScriptTextBox.Foreground = Brushes.DarkGray; this.StartButton.Content = "ll"; this.compileStatus.Text = "OK"; playingGesture = true; } catch { this.compileStatus.Text = "Script compilation error"; } } else { this.StopMainProgressBars(); this.CompletedGrid.Visibility = System.Windows.Visibility.Hidden; this.MainGestureAndPoseNameTextBlock.Text = ""; this.MainGestureAndPoseNameTextBlock.Visibility = System.Windows.Visibility.Hidden; this.ScriptTextBox.Visibility = System.Windows.Visibility.Visible; this.ScriptTextBox.IsReadOnly = false; this.ScriptTextBox.Background = Brushes.White; this.ScriptTextBox.Foreground = Brushes.Black; this.ScriptTextBox.Text = parsedText; this.StartButton.Content = " ► "; this.compileStatus.Text = ""; playingGesture = false; } }
public PreposeGesturesFrameSource(KinectSensor sensor, ulong initialTrackingId) { KinectSensor = sensor; TrackingId = initialTrackingId; Gestures = new List<Gesture>(); myMatcher = new BodyMatcher(Gestures); myReader = new PreposeGesturesFrameReader(this); }
private void StartPauseButton_Click(object sender, RoutedEventArgs e) { if (!playingGesture) { parsedText = this.ScriptTextBox.Text; try { var app = PreposeGestures.App.ReadAppText(parsedText); matcher = new BodyMatcher(app, (int)PrecisionSlider.Value); Debug.WriteLine(app); ShowGesturesFeedback(app); this.ScriptTextBox.Visibility = System.Windows.Visibility.Hidden; this.CaretStatus.Visibility = System.Windows.Visibility.Hidden; this.StartButton.Content = "ll"; this.OpenGesturesButton.Visibility = System.Windows.Visibility.Hidden; this.SaveGesturesButton.Visibility = System.Windows.Visibility.Hidden; this.OpenEventsButton.Visibility = System.Windows.Visibility.Visible; this.SaveEventsButton.Visibility = System.Windows.Visibility.Visible; this.CompileStatus.Text = "Compilation succeeded!"; this.CompileStatus.Foreground = Brushes.DarkGreen; playingGesture = true; } catch(Exception exception) { this.CompileStatus.Text = "ERROR: " + exception.Message; this.CompileStatus.Foreground = Brushes.DarkRed; } } else { this.GesturesFeedbackPanel.Children.Clear(); this.GesturesFeedbackViewer.Visibility = System.Windows.Visibility.Hidden; this.ScriptTextBox.Visibility = System.Windows.Visibility.Visible; this.CaretStatus.Visibility = System.Windows.Visibility.Visible; this.StartButton.Content = " ► "; this.OpenGesturesButton.Visibility = System.Windows.Visibility.Visible; this.SaveGesturesButton.Visibility = System.Windows.Visibility.Visible; this.OpenEventsButton.Visibility = System.Windows.Visibility.Hidden; this.SaveEventsButton.Visibility = System.Windows.Visibility.Hidden; this.CompileStatus.Text = "Compile result will show here..."; this.CompileStatus.Foreground = Brushes.Gray; playingGesture = false; } }