private async void OnStop() { _captureStarted = false; capture.Dispose(); capture = null; //PipelineResult = new PipelineResult(); StartCommand.RaiseCanExecuteChanged(); StopCommand.RaiseCanExecuteChanged(); TakeScreenShotCommand.RaiseCanExecuteChanged(); CalibrateColorSkinCommand.RaiseCanExecuteChanged(); ActivateCalibrateColorSkinCommand.RaiseCanExecuteChanged(); }
private async Task Load() { capture = new VideoCapture(); capture.Open(0, VideoCaptureAPIs.ANY); if (!capture.IsOpened()) { return; } else { //backSub = OpenCvSharp.BackgroundSubtractorMOG.Create(); _currentFrame = (await ReadVideoStreamAsync()); //EqualizeHistogramFilter filter = new EqualizeHistogramFilter(new EqualizeHistogramConfig { IsActive = true }); //filter.Apply(colorMat); await GetBackground(); _captureStarted = true; StartCommand.RaiseCanExecuteChanged(); StopCommand.RaiseCanExecuteChanged(); TakeScreenShotCommand.RaiseCanExecuteChanged(); CalibrateBackgroundCommand.RaiseCanExecuteChanged(); CalibrateColorSkinCommand.RaiseCanExecuteChanged(); ActivateCalibrateColorSkinCommand.RaiseCanExecuteChanged(); Tracker.RunAsync(); while (_captureStarted) { _currentFrame = await ReadVideoStreamAsync(); await Pipeline.RunAsync(_currentFrame); //Tracker.Tracker.DetectHandFrom(Pipeline); DisplayOutput(Pipeline, Tracker, _showDebug); FrameRate.Tick(); } } }