Beispiel #1
0
        //Replay the saved skeleton
        private void tcReplayClick(object sender, RoutedEventArgs e)
        {
            if (gestureList.SelectedItem != null)
            {
                if(TempReplayImage.Source != null)
                ReplayImage.Source = TempReplayImage.Source;
                _replaying = true;
                _learning = false;
                tcCapture.IsEnabled = false;
                tcStartLearning.IsEnabled = false;
                tcReplay.IsEnabled = false;
                tcPlayBack.IsEnabled = false;
                tcPlaybackMaster.IsEnabled = false;
                status.Text = "Replaying master motion " + gestureList.Text;
                string path = ".\\Records\\" + gestureList.Text + "\\";
                readLastFrame(path);

                if (_recordskeletonstream != null)
                    _recordskeletonstream.Close();
                _recordskeletonstream = File.OpenRead(@path + "skeleton");
                _replay = new KinectReplay(_recordskeletonstream);
                _replay.SkeletonFrameReady += replay_SkeletonFrameReady;
                _replay.Start(1000.0 / this.SelectedFPS);

                if (_recordcolorstream != null)
                    _recordcolorstream.Close();
                _recordcolorstream = File.OpenRead(@path + "colorStream");
                _colorreplay = new KinectReplay(_recordcolorstream);
                _colorreplay.ColorImageFrameReady += replay_ColorImageFrameReady;
                _colorreplay.Start(1000.0 / this.SelectedFPS);

                tcStopReplay.IsEnabled = true;
            }
            else
            {
                System.Windows.MessageBox.Show("Please select a motion.");
            }
        }
Beispiel #2
0
        /// <summary>
        /// 
        /// </summary>
        private void StartRegcon()
        {
            _learning = true;
            _capturing = true;

            string path = ".\\Records\\" + gestureList.Text + "\\";
            readLastFrame(path);

            if (_recordskeletonstream != null)
                _recordskeletonstream.Close();
            _recordskeletonstream = File.OpenRead(@path + "skeleton");
            _replay = new KinectReplay(_recordskeletonstream);
            _replay.SkeletonFrameReady += replay_SkeletonFrameReady;
            _replay.Start(1000.0 / this.SelectedFPS);

            if (_recordcolorstream != null)
                _recordcolorstream.Close();
            _recordcolorstream = File.OpenRead(@path + "colorStream");
            _colorreplay = new KinectReplay(_recordcolorstream);
            _colorreplay.ColorImageFrameReady += replay_ColorImageFrameReady;
            _colorreplay.Start(1000.0 / this.SelectedFPS);

            _captureCountdownTimer.Dispose();

            status.Text = "Learning " + gestureList.Text;
        }
Beispiel #3
0
        private void tcPlayBack_Click(object sender, RoutedEventArgs e)
        {
            if (gestureList.SelectedItem != null)
            {
                string path = ".\\Learnings\\" + gestureList.Text + "\\";
                if (!File.Exists(@path+"skeleton"))
                {
                    System.Windows.MessageBox.Show("You have not recorded your learning of " + gestureList.SelectedItem);
                    return;
                }

                if (TempReplayImage.Source != null)
                    ReplayImage.Source = TempReplayImage.Source;
                _learning = false;
                _capturing = false;
                _playingback = true;
                _playingbackmaster = false;

                tcCapture.IsEnabled = false;
                tcStartLearning.IsEnabled = false;
                tcReplay.IsEnabled = false;
                tcStopLearning.IsEnabled = false;
                tcStopPlayBack.IsEnabled = true;
                tcPlayBack.IsEnabled = false;
                tcPlaybackMaster.IsEnabled = false;

                RealTimeImage.DataContext = PlayBackColorManager;
                readLastFrame(path);

                if (_recordskeletonstream != null)
                    _recordskeletonstream.Close();
                _recordskeletonstream = File.OpenRead(@path + "skeleton");
                _replay = new KinectReplay(_recordskeletonstream);
                _replay.SkeletonFrameReady += replay_SkeletonFrameReady;

                if (_recordcolorstream != null)
                    _recordcolorstream.Close();
                _recordcolorstream = File.OpenRead(@path + "colorStream");
                _colorreplay = new KinectReplay(_recordcolorstream);
                _colorreplay.ColorImageFrameReady += replay_ColorImageFrameReady;

                if (_learnerskeletonstream != null)
                    _learnerskeletonstream.Close();
                _learnerskeletonstream = File.OpenRead(@path + "LearnerSelected");
                _playback = new KinectReplay(_learnerskeletonstream);
                _playback.SkeletonFrameReady += playback_SkeletonFrameReady;

                if (_learnercolorstream != null)
                    _learnercolorstream.Close();
                _learnercolorstream = File.OpenRead(@path + "LearnerSelectedColor");
                _colorplayback = new KinectReplay(_learnercolorstream);
                _colorplayback.ColorImageFrameReady += playback_ColorImageFrameReady;

                _playback.Start(1000.0 / this.SelectedFPS);
                _colorplayback.Start(1000.0 / this.SelectedFPS);
                _colorreplay.Start(1000.0 / this.SelectedFPS);
                _replay.Start(1000.0 / this.SelectedFPS);

                status.Text = "Playing back " + gestureList.Text;
            }
            else
            {
                System.Windows.MessageBox.Show("Please select a motion.");
            }
        }