private void LivePenTrackingForm_FormClosing(object sender, FormClosingEventArgs e) { #if DEBUG tracker.DebugPicture -= tracker_DebugPicture; #endif camera.FrameReady -= camera_FrameReady; camera.Stop(); }
private void toggleCameraButton_Click(object sender, EventArgs e) { if (!_camera.IsRunning) { _camera.Start(); this.toggleCameraButton.Text = "Stop Camera"; } else { _camera.Stop(); this.toggleCameraButton.Text = "Start Camera"; } }
private void CameraSelected(object sender, SelectionChangedEventArgs e) { if (_camera != null) { _camera.FrameReady -= NewImage; _camera.Stop(); } Properties.Settings.Default.Camera = CameraBox.SelectedIndex; Properties.Settings.Default.Save(); _camera = new AForgeCamera(_cams[CameraBox.SelectedIndex].Key); _camera.FrameReady += NewImage; _camera.Start(); }
public static void TakeVideo() { String saveDir = @"C:\temp\images\video"; if (!Directory.Exists(saveDir)) { Directory.CreateDirectory(saveDir); } AForgeCamera camera = new AForgeCamera(); camera.FrameReady += delegate(object o, FrameReadyEventArgs e) { Console.WriteLine("Frame {0}", e.Frame.Number); e.Frame.Bitmap.Save(Path.Combine(saveDir, "pic-" + e.Frame.Number + ".png")); }; camera.Start(); Console.ReadLine(); camera.Stop(); }