Пример #1
0
        private void trackBarVideo_MouseDown(object sender, MouseEventArgs e)
        {
            OpenNIRecordingController video_src = videoDisplay.Source as OpenNIRecordingController;

            if (video_src != null)
            {
                video_src.StopPlayback();
            }
        }
Пример #2
0
        private void trackBarVideo_KeyDown(object sender, PreviewKeyDownEventArgs e)
        {
            OpenNIRecordingController video_src = videoDisplay.Source as OpenNIRecordingController;

            // The p key is used for playback control and should hence not
            // change that state.
            if (video_src != null && e.KeyData != Keys.P)
            {
                video_src.StopPlayback();
            }
        }
Пример #3
0
        private void buttonPlay_Click(object sender, EventArgs e)
        {
            OpenNIRecordingController video_src = videoDisplay.Source as OpenNIRecordingController;

            if (video_src != null)
            {
                if (buttonPlay.Text.Equals(BUTTON_PLAY_PLAY_TEXT))
                {
                    video_src.StartPlayback();
                }
                else
                {
                    video_src.StopPlayback();
                }
            }
        }
Пример #4
0
        /// <summary>
        /// Initializes the export.
        /// </summary>
        private void buttonExport_Click(object sender, EventArgs e)
        {
            OpenNIRecordingController exportVideo = videoDisplay.Source as OpenNIRecordingController;

            if (exportVideo == null)
            {
                return;
            }

            // Stop playback before configuration.
            exportVideo.StopPlayback();

            // Select frames to export
            List <int> export_frames = new List <int>(
                Math.Abs(trackBarVideo.LastHighlightedFrame - trackBarVideo.FirstHighlightedFrame));

            for (int i = trackBarVideo.FirstHighlightedFrame; i <= trackBarVideo.LastHighlightedFrame; i++)
            {
                export_frames.Add(i);
            }

            Dictionary <int, int> statistics = exportVideo.GetUserStatistics(export_frames);

            // Show export configuration dialog.
            ExportConfiguration configuration_form = new ExportConfiguration(
                statistics, export_frames);

            configuration_form.ImageSensorData = exportVideo.ImageOrDepth;
            configuration_form.DrawBackground  = exportVideo.DrawBackground;
            configuration_form.DrawHighlight   = exportVideo.DrawUserHighlight;
            configuration_form.DrawLabels      = exportVideo.DrawUserInformation;
            configuration_form.DrawSkeleton    = exportVideo.DrawSkeletonMesh;

            configuration_form.ShowDialog(this);
            if (configuration_form.DialogResult == DialogResult.Cancel)
            {
                return;
            }

            // Set paralellization event handlers.
            exportVideo.ExportMadeProgress += exportMadeProgress;
            exportVideo.ExportFailed       += exportFailed;

            // Check whether the user selected to do a batch export.
            if (configuration_form.DoBatchExport)
            {
                exportVideo.ExportFinished += batchExportPart1Finished;
                // Configure for the first batch export part and ignore
                // the corresponding user preferences.
                configuration_form.ImageSensorData = true;
                configuration_form.DrawBackground  = true;
                configuration_form.DrawSkeleton    = false;
                configuration_form.DrawHighlight   = false;
                configuration_form.DrawLabels      = false;
            }
            else
            {
                exportVideo.ExportFinished += exportFinished;
            }

            // Display progress bar.
            exportForm.progressBar.Value    = 0;
            exportForm.textBoxProgress.Text = "Initializing export...";
            exportForm.Show(this);

            // Prepare export directory.
            FileInfo      recording = new FileInfo(exportVideo.RecordingFilename);
            DirectoryInfo recordDir = recording.Directory;
            DirectoryInfo exportDir = OpenNIImageProvider.
                                      GetNewFolderWithHigherIndex(recordDir, EXPORT_DIR_PREFIX, "-");

            // Begin exporting.
            exportVideo.ExportFrames(
                export_frames,
                configuration_form.SelectedUsers,
                configuration_form.AnnotationIn2D,
                configuration_form.AnnotationIn3D,
                configuration_form.ExportRelativePathNames,
                configuration_form.ImageSensorData,
                configuration_form.DrawBackground,
                configuration_form.DrawSkeleton,
                configuration_form.DrawHighlight,
                configuration_form.DrawLabels,
                exportDir);
        }