/// <summary> /// Receives the current <see cref="CameraFrame"/> to process. /// </summary> /// <param name="frame">The current frame</param> private void ProcessFrameSync([NotNull] CameraFrame frame) { if (frame == null) { throw new ArgumentNullException(nameof(frame)); } if (_status != Status.Running) { return; } if (IsObjectDetectionRequested) { if (!_objectDetectionService.detectOnRepeat) { IsObjectDetectionRequested = false; } ObjectDetectionService.DetectAsync(frame).ContinueWith(OnObjectsDetected); } if (_objectDetectionService.detectOnRepeat) { return; } List <TrackedObject> trackedObjects = ObjectTrackingService.TrackSync(frame); IsProcessingFrame = false; Vector2 unprojectionOffset = ObjectTrackingService.unprojectionOffset; _visualizationManager.UpdateTrackedObjects(trackedObjects, unprojectionOffset); }
public void Reset() { IsObjectDetectionRequested = false; ObjectDetectionService.Reset(); ObjectTrackingService.Reset(); _visualizationManager.Reset(); IsProcessingFrame = false; }
public ConfigurationViewModel(IItemInteractionService manipulationService) { Messenger.Default.Register <string>(this, (message) => { //Debug.WriteLine("CVM msg recieved: " + message); switch (message.ToUpper()) { case "STARTCALIBRATION": this.Start(); break; case "STOPCALIBRATION": this.Stop(); break; } }); _manipulationService = manipulationService as ObjectDetectionService; _manipulationService.IsWindowVisible = true; this.SaveCalibration = new RelayCommand(() => { if (_manipulationService.IsCalibrating || _manipulationService.ObjectCount == 0) { MessageBox.Show("Please complete calibration and ensure that the 'Calibrate' setting is unchecked and at least one Object is Detected before Saving Calibration."); } else { MessageBox.Show(_manipulationService.SaveCalibration()); } }); this.LoadCalibration = new RelayCommand(() => { _manipulationService.LoadCalibration(); }); this.CloseCommand = new RelayCommand <Window>( (window) => { _manipulationService.IsWindowVisible = false; _manipulationService.IsCalibrating = false; window.Close(); var mainWindow = Application.Current.Windows.Cast <Window>().SingleOrDefault(w => w.Name == "MainWindow"); if (mainWindow != null) { mainWindow.Show(); } }, (window) => window != null ); this.StartService = new RelayCommand(() => { _manipulationService.Start(); }); this.StopService = new RelayCommand(() => { _manipulationService.Stop(); }); this._manipulationService.PropertyChanged += _manipulationService_PropertyChanged; }
private void OnMinimalPredictionProbabilityUpdated(SliderEventData eventData) { if (eventData == null) { return; } double value = eventData.NewValue; minimalPredictionProbabilityLabel.text = $"{value:0.0}"; ObjectDetectionService.ChangeMinimalPredictionProbability(value); Debug.Log($"Changed minimal prediction probability to {value:0.0}"); }
private void OnMaxConcurrentRequestUpdated(SliderEventData eventData) { if (eventData == null) { return; } int value = (int)(eventData.NewValue * 20f); maxConcurrentRequestLabel.text = $"{value}"; ObjectDetectionService.ChangeMaxConcurrentRequestLimit(value); Debug.Log($"Max object detection request limit changed to {value}"); }
public ConfigurationViewModel(IItemInteractionService manipulationService) { Messenger.Default.Register<string>(this, (message) => { //Debug.WriteLine("CVM msg recieved: " + message); switch (message.ToUpper()) { case "STARTCALIBRATION": this.Start(); break; case "STOPCALIBRATION": this.Stop(); break; } }); _manipulationService = manipulationService as ObjectDetectionService; _manipulationService.IsWindowVisible = true; this.SaveCalibration = new RelayCommand(() => { if (_manipulationService.IsCalibrating || _manipulationService.ObjectCount == 0) MessageBox.Show("Please complete calibration and ensure that the 'Calibrate' setting is unchecked and at least one Object is Detected before Saving Calibration."); else MessageBox.Show(_manipulationService.SaveCalibration()); }); this.LoadCalibration = new RelayCommand(() => { _manipulationService.LoadCalibration(); }); this.CloseCommand = new RelayCommand<Window>( (window) => { _manipulationService.IsWindowVisible = false; _manipulationService.IsCalibrating = false; window.Close(); var mainWindow = Application.Current.Windows.Cast<Window>().SingleOrDefault(w => w.Name == "MainWindow"); if (mainWindow != null) { mainWindow.Show(); } }, (window) => window != null ); this.StartService = new RelayCommand(() => { _manipulationService.Start(); }); this.StopService = new RelayCommand(() => { _manipulationService.Stop(); }); this._manipulationService.PropertyChanged += _manipulationService_PropertyChanged; }