Beispiel #1
0
        private void SaveFragButton_Click(object sender, RoutedEventArgs e)
        {
            if (HendlerHolder.IsKinectPlayerWindow(this))
            {
                return;
            }
            if (SKLRecording == null)
            {
                MessageBox.Show(this, "No recording was loaded.", "Error saving recording", MessageBoxButton.OK, MessageBoxImage.Error);
                return;
            }
            if (SKLRecording.Count == 0)
            {
                MessageBox.Show(this, "No recording was loaded.", "Error saving recording", MessageBoxButton.OK, MessageBoxImage.Error);
                return;
            }
            int start = 0;
            int stop  = 0;

            try
            {
                start = int.Parse(StartTextBox.Text);
                stop  = int.Parse(StopTextBox.Text);
            }
            catch
            {
                MessageBox.Show(this, "Error in parsing range.", "Error saving recording", MessageBoxButton.OK, MessageBoxImage.Error);
                return;
            }
            if (start < 0 || start >= SKLRecording.Count ||
                stop < 0 || stop >= SKLRecording.Count ||
                start > stop)
            {
                MessageBox.Show(this, "Recording ranges out of range.", "Error saving recording", MessageBoxButton.OK, MessageBoxImage.Error);
                return;
            }

            String dirName          = System.AppDomain.CurrentDomain.BaseDirectory;
            String fileNameSkeleton = "SkeletonRecord";
            int    imageIndex       = 0;

            while (File.Exists(dirName + "/" + fileNameSkeleton + imageIndex + ".skl"))
            {
                imageIndex++;
            }
            StreamWriter sw           = new StreamWriter(dirName + "/" + fileNameSkeleton + imageIndex + ".skl");
            long         currentFrame = 0;

            for (int a = start; a <= stop; a++)
            {
                TSkeleton[] ts = (TSkeleton[])SKLRecording[a];
                for (int b = 0; b < ts.Length; b++)
                {
                    TSkeletonHelper.SaveTSkeletonToFile(ts[b], sw, currentFrame);
                }
                currentFrame++;
            }
            sw.Close();
            MessageBox.Show(this, "File saved successfully under path:\r\n" + dirName + "/" + fileNameSkeleton + imageIndex + ".skl", "Saving", MessageBoxButton.OK, MessageBoxImage.Information);
        }
Beispiel #2
0
        private void Show3D_Click(object sender, RoutedEventArgs e)
        {
            if (SKLRecording == null)
            {
                return;
            }
            if (SKLRecording.Count < 1)
            {
                return;
            }
            //PlayerWindow3D pw3D = new PlayerWindow3D(TSkeletonHelper.CloneRecording(SKLRecording));
            PlayerWindow3D pw3D = HendlerHolder.OpenNewPlayerWindow3D(TSkeletonHelper.CloneRecording(SKLRecording));

            pw3D.Title = this.Title;
            //pw3D.Show();
        }
Beispiel #3
0
 public void StopCapture()
 {
     recording = false;
     if (sKLFileStream == null)
     {
         return;
     }
     CaptureStopwatch.Stop();
     if (sKLFileStream != null)
     {
         sKLFileStream.Close();
     }
     sKLFileStream = null;
     if (SKLRecording != null)
     {
         SKLRecording.Clear();
     }
     HendlerHolder.OpenNewPlayerWindow(true, SKLFileName);
     SKLFileName = null;
     ChangeContentWhileRecordingOrPlaying(false);
     SKLRecording = TSkeletonHelper.ReadRecordingFromFile(SKLFileName);
     LoadSKLRecording(SKLFileName);
     ChangeContentWhileRecordingOrPlaying(false);
     if (SKLRecording != null)
     {
         ProgressSlider.Maximum = SKLRecording.Count - 1;
         ProgressSlider.Value   = ProgressSlider.Maximum;
         ProgressSlider.Value   = 0;
         if (SKLRecording.Count > 0)
         {
             DrawImage((TSkeleton[])SKLRecording[0]);
         }
     }
     else
     {
         ProgressSlider.Maximum = 0;
         ProgressSlider.Value   = 0;
         DrawImage(null);
     }
 }
        private void ComputeButton_Click(object sender, RoutedEventArgs e)
        {
            ArrayList skelRecording         = TSkeletonHelper.ReadRecordingFromFile(SKLFileTextBox.Text);
            int       clastersCount         = int.Parse(ClasterCountBox.Text);
            double    minimaTimeDistanceBox = double.Parse(MinimaTimeDistanceBox.Text, CultureInfo.InvariantCulture);
            double    epsilon       = double.Parse(textBoxEpsilon.Text, CultureInfo.InvariantCulture);
            int       maxIterations = int.Parse(textBoxMaxIterations.Text, CultureInfo.InvariantCulture);

            try
            {
                String GDLVersion = "1.1";
                if (radioButtonGDL1_0.IsChecked == true)
                {
                    GDLVersion = "1.0";
                }
                if (radioButtonGDL1_1.IsChecked == true)
                {
                    GDLVersion = "1.1";
                }
                //if (radioButtonGDL1_1.IsChecked == true)
                //!!
                GDLVersion = "1.1";
                keyFrames  = RGDLTrainer(skelRecording,
                                         InputGDLtextBox.Text,
                                         OutputGDLtextBox.Text,
                                         clastersCount, minimaTimeDistanceBox,
                                         textBoxRuleName.Text,
                                         GDLVersion,
                                         epsilon,
                                         maxIterations);
                OutputGDLFile = OutputGDLtextBox.Text;
                //this.Close();
                this.Visibility = Visibility.Hidden;
            }
            catch (RGDLException ex)
            {
                MessageBox.Show(ex.Message, "R-GDL Exception", MessageBoxButton.OK);
            }
        }
Beispiel #5
0
        public void LoadSKLRecording(String SKLFile)
        {
            ArrayList SKLRecordingHelp = null;

            try
            {
                SKLRecordingHelp = TSkeletonHelper.ReadRecordingFromFile(SKLFile);
            }
            catch (Exception e)
            {
                String msg = "SKL file " + SKLFile + " loading error: " + e.Message;
                HendlerHolder.DisplayMessage(this, msg);
                return;
            }
            if (SKLRecordingHelp == null)
            {
                String msg = "SKL file " + SKLFile + " seems to be empty.";
                HendlerHolder.DisplayMessage(this, msg);
                return;
            }
            sKLFileName  = SKLFile;
            SKLRecording = SKLRecordingHelp;
            if (SKLRecording != null)
            {
                ProgressSlider.Maximum = SKLRecording.Count - 1;
                ProgressSlider.Value   = ProgressSlider.Maximum;
                ProgressSlider.Value   = 0;
                if (SKLRecording.Count > 0)
                {
                    DrawImage((TSkeleton[])SKLRecording[0]);
                }
            }
            else
            {
                ProgressSlider.Maximum = 0;
                ProgressSlider.Value   = 0;
                DrawImage(null);
            }
        }