public MainWindow() { // Initialize the main controls InitializeComponent(); // Add and initilize the image display videoDisplay = new OpenNIImageDisplay(); Controls.Add(videoDisplay); videoDisplay.Size = new Size(640, 480); videoDisplay.Location = new Point(30, 7); try { kinect = new OpenNILiveStreamController(); kinect.StartedRecording += kinect_StartedRecording; kinect.StoppedRecording += kinect_StoppedRecording; } catch (Exception) { kinect = null; } // Initialize tab pages and events tabControlVideoSources.SelectedTab = tabPageExport; // Initialize project directory // Try to load from settings if (Settings.Default.ProjectDirectory != null && Settings.Default.ProjectDirectory != "") { projectDirectory = Settings.Default.ProjectDirectory; } else { projectDirectory = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments); } // Set evaluation form evaluationForm = new Evaluation(videoDisplay); evaluationForm.VisibleChanged += new EventHandler(evaluationForm_VisibleChanged); buttonEvaluation.Text = BUTTON_EVALUATION_SHOW_TEXT; evaluationForm.EvaluationRangeChanged += new Action<int, int>(evaluationForm_EvaluationRangeChanged); // Initialize File system watcher fileSystemWatcherProjectDir.Path = projectDirectory; // Initialize Event system. fileSystemWatcherProjectDir.Changed += fileSystemWatcherProjectDir_Changed; videoDisplay.ErrorOccured += videoImageControl_ErrorOccured; tabControlVideoSources.SelectedIndexChanged += tabControlVideoSources_SelectedIndexChanged; // - for the TrackBar videoDisplay.SourceChanged += trackBarVideoImageSourceChanged; videoDisplay.NewRecordingFrameDisplayed += trackBarVideoUpdateValue; // - for the PlayButton videoDisplay.SourceChanged += buttonPlayImageSourceChanged; videoDisplay.StartedPlaying += buttonPlayStartedPlayingHandler; videoDisplay.StoppedPlaying += buttonPlayStoppedPlayingHandler; // - for the Mark Frame button videoDisplay.SourceChanged += buttonMarkFrameImageSourceChanged; evaluationForm.VisibleChanged += buttonMarkFrameEvaluationFormVisibleChanged; // - for the evaluation button videoDisplay.SourceChanged += buttonEvaluationUpdateEnabledHandler; // - for the export and reset button trackBarVideo.MarkerValueChanged += buttonExportUpdateEnabledHandler; evaluationForm.VisibleChanged += buttonExportUpdateEnabledHandler; trackBarVideo.MarkerValueChanged += buttonResetMarkersUpdateEnabledHandler; evaluationForm.VisibleChanged += buttonResetMarkersUpdateEnabledHandler; // Initialize project dir display updateListBoxProjectDir(); // Initialize the export form exportForm.buttonCancelExport.Click += cancelCurrentExport; }
public Evaluation(OpenNIImageDisplay videoControl) { InitializeComponent(); // Initialize Statistics statistics = new Statistics(); statistics.ClearCumulativeConfidencePoints += clearCumulativeConfidencePoints; statistics.AddCumulativeConfidencePoint += addConfidencePoint; statistics.ClearErrorPoints += clearErrorPoints; statistics.AddErrorPoint += addErrorPoint; statistics.FinalizeErrorUpdate += finalizeMainPointUpdate; statistics.FinalizeConfidenceUpdate += finalizeCumulativeConfidenceUpdate; statistics.FrameUpdated += statistics_FrameUpdated; videoControl.NewRecordingFrameDisplayed += UpdateFrame; // Add data Bindings textBoxGlobalMean.DataBindings.Add("Text", statistics, "GlobalMean", true, DataSourceUpdateMode.Never, 0, "0.000", NUMBER_CULTURE); textBoxFrameMean.DataBindings.Add("Text", statistics, "FrameMean", true, DataSourceUpdateMode.Never, 0, "0.000", NUMBER_CULTURE); textBoxFrameValue.DataBindings.Add("Text", statistics, "FrameValue", true, DataSourceUpdateMode.Never, 0, "0.000", NUMBER_CULTURE); textBoxNumberOfPoints.DataBindings.Add("Text", statistics, "NumberOfPoints", true, DataSourceUpdateMode.Never, 0, "0", NUMBER_CULTURE); // Initialize list box and error chart area foreach (JointTranslationTuple translation in JointDictionary.JointTranslationList) { checkedListBoxBodyParts.Items.Add(translation.name); chartErrors.Series.Add(translation.name); chartErrors.Series[translation.name].Enabled = false; chartErrors.Series[translation.name].ChartType = SeriesChartType.StackedArea; chartErrors.Series[translation.name].ToolTip = translation.name; annotations[translation.joint_type] = new List <Annotation>(); } // Add always present legend items LegendItem legendItemMarkerFalsePositive = new LegendItem(); legendItemMarkerFalsePositive.Name = "False Positive"; legendItemMarkerFalsePositive.MarkerStyle = MarkerStyle.Square; legendItemMarkerFalsePositive.MarkerSize = 7; legendItemMarkerFalsePositive.ImageStyle = LegendImageStyle.Marker; legendItemMarkerFalsePositive.MarkerColor = markerColorFalseNegative; chartErrors.Legends[0].CustomItems.Add(legendItemMarkerFalsePositive); LegendItem legendItemMarkerFalseNegative = new LegendItem(); legendItemMarkerFalseNegative.Name = "False Negative"; legendItemMarkerFalseNegative.MarkerStyle = MarkerStyle.Circle; legendItemMarkerFalseNegative.ImageStyle = LegendImageStyle.Marker; legendItemMarkerFalseNegative.MarkerColor = markerColorFalsePositive; legendItemMarkerFalseNegative.MarkerSize = 7; chartErrors.Legends[0].CustomItems.Add(legendItemMarkerFalseNegative); LegendItem legendItemMarkerNA = new LegendItem(); legendItemMarkerNA.Name = "No data available"; legendItemMarkerNA.MarkerStyle = MarkerStyle.Circle; legendItemMarkerNA.ImageStyle = LegendImageStyle.Marker; legendItemMarkerNA.MarkerColor = markerColorNA; legendItemMarkerNA.MarkerSize = 7; chartErrors.Legends[0].CustomItems.Add(legendItemMarkerNA); // Add the line annotation marking the displayed frame. frame_indicator = new VerticalLineAnnotation(); frame_indicator.AxisX = chartErrors.ChartAreas[0].AxisX; frame_indicator.AxisY = chartErrors.ChartAreas[0].AxisY; frame_indicator.X = 0; frame_indicator.Height = chartErrors.Height; frame_indicator.LineColor = Color.Red; frame_indicator.LineWidth = 1; frame_indicator.LineDashStyle = ChartDashStyle.Solid; frame_indicator.Y = frame_indicator.AxisY.Minimum; chartErrors.Annotations.Add(frame_indicator); // Initialize the video source the line indicator is synced with. videoDataSource = videoControl; videoDataSource.SourceChanged += new EventHandler(videoDataSource_SourceChanged); }
public Evaluation(OpenNIImageDisplay videoControl) { InitializeComponent(); // Initialize Statistics statistics = new Statistics(); statistics.ClearCumulativeConfidencePoints += clearCumulativeConfidencePoints; statistics.AddCumulativeConfidencePoint += addConfidencePoint; statistics.ClearErrorPoints += clearErrorPoints; statistics.AddErrorPoint += addErrorPoint; statistics.FinalizeErrorUpdate += finalizeMainPointUpdate; statistics.FinalizeConfidenceUpdate += finalizeCumulativeConfidenceUpdate; statistics.FrameUpdated += statistics_FrameUpdated; videoControl.NewRecordingFrameDisplayed += UpdateFrame; // Add data Bindings textBoxGlobalMean.DataBindings.Add("Text", statistics, "GlobalMean", true, DataSourceUpdateMode.Never, 0, "0.000", NUMBER_CULTURE); textBoxFrameMean.DataBindings.Add("Text", statistics, "FrameMean", true, DataSourceUpdateMode.Never, 0, "0.000", NUMBER_CULTURE); textBoxFrameValue.DataBindings.Add("Text", statistics, "FrameValue", true, DataSourceUpdateMode.Never, 0, "0.000", NUMBER_CULTURE); textBoxNumberOfPoints.DataBindings.Add("Text", statistics, "NumberOfPoints", true, DataSourceUpdateMode.Never, 0, "0", NUMBER_CULTURE); // Initialize list box and error chart area foreach (JointTranslationTuple translation in JointDictionary.JointTranslationList) { checkedListBoxBodyParts.Items.Add(translation.name); chartErrors.Series.Add(translation.name); chartErrors.Series[translation.name].Enabled = false; chartErrors.Series[translation.name].ChartType = SeriesChartType.StackedArea; chartErrors.Series[translation.name].ToolTip = translation.name; annotations[translation.joint_type] = new List<Annotation>(); } // Add always present legend items LegendItem legendItemMarkerFalsePositive = new LegendItem(); legendItemMarkerFalsePositive.Name = "False Positive"; legendItemMarkerFalsePositive.MarkerStyle = MarkerStyle.Square; legendItemMarkerFalsePositive.MarkerSize = 7; legendItemMarkerFalsePositive.ImageStyle = LegendImageStyle.Marker; legendItemMarkerFalsePositive.MarkerColor = markerColorFalseNegative; chartErrors.Legends[0].CustomItems.Add(legendItemMarkerFalsePositive); LegendItem legendItemMarkerFalseNegative = new LegendItem(); legendItemMarkerFalseNegative.Name = "False Negative"; legendItemMarkerFalseNegative.MarkerStyle = MarkerStyle.Circle; legendItemMarkerFalseNegative.ImageStyle = LegendImageStyle.Marker; legendItemMarkerFalseNegative.MarkerColor = markerColorFalsePositive; legendItemMarkerFalseNegative.MarkerSize = 7; chartErrors.Legends[0].CustomItems.Add(legendItemMarkerFalseNegative); LegendItem legendItemMarkerNA = new LegendItem(); legendItemMarkerNA.Name = "No data available"; legendItemMarkerNA.MarkerStyle = MarkerStyle.Circle; legendItemMarkerNA.ImageStyle = LegendImageStyle.Marker; legendItemMarkerNA.MarkerColor = markerColorNA; legendItemMarkerNA.MarkerSize = 7; chartErrors.Legends[0].CustomItems.Add(legendItemMarkerNA); // Add the line annotation marking the displayed frame. frame_indicator = new VerticalLineAnnotation(); frame_indicator.AxisX = chartErrors.ChartAreas[0].AxisX; frame_indicator.AxisY = chartErrors.ChartAreas[0].AxisY; frame_indicator.X = 0; frame_indicator.Height = chartErrors.Height; frame_indicator.LineColor = Color.Red; frame_indicator.LineWidth = 1; frame_indicator.LineDashStyle = ChartDashStyle.Solid; frame_indicator.Y = frame_indicator.AxisY.Minimum; chartErrors.Annotations.Add(frame_indicator); // Initialize the video source the line indicator is synced with. videoDataSource = videoControl; videoDataSource.SourceChanged += new EventHandler(videoDataSource_SourceChanged); }
public MainWindow() { // Initialize the main controls InitializeComponent(); // Add and initilize the image display videoDisplay = new OpenNIImageDisplay(); Controls.Add(videoDisplay); videoDisplay.Size = new Size(640, 480); videoDisplay.Location = new Point(30, 7); try { kinect = new OpenNILiveStreamController(); kinect.StartedRecording += kinect_StartedRecording; kinect.StoppedRecording += kinect_StoppedRecording; } catch (Exception) { kinect = null; } // Initialize tab pages and events tabControlVideoSources.SelectedTab = tabPageExport; // Initialize project directory // Try to load from settings if (Settings.Default.ProjectDirectory != null && Settings.Default.ProjectDirectory != "") { projectDirectory = Settings.Default.ProjectDirectory; } else { projectDirectory = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments); } // Set evaluation form evaluationForm = new Evaluation(videoDisplay); evaluationForm.VisibleChanged += new EventHandler(evaluationForm_VisibleChanged); buttonEvaluation.Text = BUTTON_EVALUATION_SHOW_TEXT; evaluationForm.EvaluationRangeChanged += new Action <int, int>(evaluationForm_EvaluationRangeChanged); // Initialize File system watcher try { fileSystemWatcherProjectDir.Path = projectDirectory; // Initialize Event system. fileSystemWatcherProjectDir.Changed += fileSystemWatcherProjectDir_Changed; } catch (Exception) { projectDirectory = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments); MessageBox.Show(this, "Project folder could not be loaded. Using Default.", "Info", MessageBoxButtons.OK, MessageBoxIcon.Information); // TODO Error handling } videoDisplay.ErrorOccured += videoImageControl_ErrorOccured; tabControlVideoSources.SelectedIndexChanged += tabControlVideoSources_SelectedIndexChanged; // - for the TrackBar videoDisplay.SourceChanged += trackBarVideoImageSourceChanged; videoDisplay.NewRecordingFrameDisplayed += trackBarVideoUpdateValue; // - for the PlayButton videoDisplay.SourceChanged += buttonPlayImageSourceChanged; videoDisplay.StartedPlaying += buttonPlayStartedPlayingHandler; videoDisplay.StoppedPlaying += buttonPlayStoppedPlayingHandler; // - for the Mark Frame button videoDisplay.SourceChanged += buttonMarkFrameImageSourceChanged; evaluationForm.VisibleChanged += buttonMarkFrameEvaluationFormVisibleChanged; // - for the evaluation button videoDisplay.SourceChanged += buttonEvaluationUpdateEnabledHandler; // - for the export and reset button trackBarVideo.MarkerValueChanged += buttonExportUpdateEnabledHandler; evaluationForm.VisibleChanged += buttonExportUpdateEnabledHandler; trackBarVideo.MarkerValueChanged += buttonResetMarkersUpdateEnabledHandler; evaluationForm.VisibleChanged += buttonResetMarkersUpdateEnabledHandler; // Initialize project dir display updateListBoxProjectDir(); // Initialize the export form exportForm.buttonCancelExport.Click += cancelCurrentExport; }