Esempio n. 1
0
 public void StartRecording(string name = "orig", bool saveAsMp4 = false)
 {
     lock (videoSaverLock)
     {
         videoSaver = new StdVideoSaver(name, cmpWin, saveAsMp4);
     }
 }
Esempio n. 2
0
 public void EndRecording()
 {
     lock (videoSaverLock)
     {
         if (videoSaver != null)
         {
             videoSaver.StopRecording();
         }
         videoSaver = null;
     }
 }
Esempio n. 3
0
        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");
                }
            });
        }