private void ShowRealTimePicture() { try { if (CaptureProvider != null && CaptureProvider.IsRunning) { Bitmap src = CaptureProvider.GetCurrentFrame(); if (src != null) { lock (src) { using (Graphics gph1 = Graphics.FromImage(src)) { if (UserPaint != null) { UserPaint(src, new PaintEventArgs(gph1, imageCtr.ClientRectangle)); } else { DrawGuidesLines(gph1, src.Width, src.Height); } } this.BeginInvoke((Action) delegate() { imageCtr.Image = src; }); } } } } catch { } }
private void BT3_Click(object sender, EventArgs e) { if (CaptureProvider != null) { Bitmap src = CaptureProvider.GetCurrentFrame(); //ImgLib.ImageU8 p = new ImageU8(src); //p.ApplyCannyEdgeDetector(); if (src == null) { return; } string path = String.Format("{0}\\Image", Application.StartupPath); if (!Directory.Exists(path)) { Directory.CreateDirectory(path); } // p.Save(String.Format("{0}\\{1}.bmp", path, DateTime.Now.ToString("yyyyMMddHHmmss"))); src.Save(String.Format("{0}\\{1}.bmp", path, DateTime.Now.ToString("yyyyMMddHHmmss")), ImageFormat.Bmp); } }