public RoadVideoCapture(WindowShiftCompare swin, RVReporter rpt, int ind = 0) { reporter = rpt; cmpWin = swin; gv = new GZVideoCapture(grabbed, ind); }
public MainWindow() { InitializeComponent(); comm.Init(new SimpleComApp()); bool showing = false; var videoSaver = new StdVideoSaver("testtestimg", this, true); var gv = new GZVideoCapture(matdel => { Console.Write("!"); if (showing) { return; } showing = true; Console.Write("~"); var mat = matdel.Clone(); TDispatch(() => { using (mat) { //CvInvoke.Imshow("test", mat); showing = false; try { lock (lockobj) { using (var bmp = mat.Bitmap) { MemoryStream ms = new MemoryStream(); //mat.Bitmap.Save(ms, System.Drawing.Imaging.ImageFormat.Bmp); bmp.Save(ms, System.Drawing.Imaging.ImageFormat.Bmp); ms.Seek(0, SeekOrigin.Begin); mainCanv.Source = Convert(ms); } } } catch (Exception exc) { } } }); }, 0); Task.Run(async() => { while (true) { if (comm.WriteQueueLength > 0) { Console.Write("-"); await Task.Delay(10); continue; } Console.Write("+"); await comm.WriteComm("R10\n"); } }); }