public static void startPreview(previewFPS previewFPS) { IsCapturing = true; if (!previewRoutine.IsBusy) { previewRoutine.RunWorkerAsync(previewFPS); ImageProcessService.StartImgProcessRoutine(); } }
private static void previewRoutine_doWork(object sender, DoWorkEventArgs e) { IsCapturing = true; previewFPS FPS = (previewFPS)e.Argument; Capture webcam; try { webcam = new Capture(); } catch (Exception ex) { return; } while (!previewRoutine.CancellationPending) { fps = Stopwatch.StartNew(); //==== Display Original image========== try { GV.imgOriginal = webcam.QueryFrame(); } catch (Exception ex) { } if (GV.imgOriginal != null) { GV.imgOriginal_pure = GV.imgOriginal.Copy(); processedImageDisplaying(); } Thread.Sleep(1000 / (int)FPS); fps.Stop(); videoFPS = $"Video FPS:{1000f / fps.ElapsedMilliseconds: 0.0}"; previewRoutine.ReportProgress(0); } }
private static void previewRoutine_doWork(object sender, DoWorkEventArgs e) { IsCapturing = true; previewFPS FPS = (previewFPS)e.Argument; while (!previewRoutine.CancellationPending) { if (ConnectionService.mCamera == null) { previewRoutine.CancelAsync(); return; } imgOriginal = ConnectionService.Capture(); if (MainWindow.main.DecodeSwitch) { CortexCore.Decode(imgOriginal.ToBitmap()); } previewRoutine.ReportProgress(0); Thread.Sleep(1000 / (int)FPS); } }
public static void startPreview(previewFPS previewFPS) { IsCapturing = true; previewRoutine.RunWorkerAsync(previewFPS); }