private void buttonopencam_Click(object sender, EventArgs e) { dot2 = 0; if (buttonopencam.Text == "打开") { captureDevice.VideoResolution = videoCapabilitie; videoSourcePlayer.VideoSource = captureDevice; captureDevice.SimulateTrigger(); videoSourcePlayer.Start(); output("已打开摄像头。", 1); buttonopencam.Text = "关闭"; buttonphoto.Enabled = true; comboBoxcam.Enabled = false; comboBoxreso.Enabled = false; } else { try { videoSourcePlayer.Stop(); } catch (Exception) { } videoSourcePlayer.VideoSource = null; output("已关闭摄像头。", 1); buttonopencam.Text = "打开"; buttonphoto.Enabled = false; comboBoxreso.Enabled = true; comboBoxcam.Enabled = true; } }
/// <summary> /// 抓拍,图形通过OnSnapShot事件回调返回 /// </summary> public void Snapshot() { if ((videoDevice != null) && (videoDevice.ProvideSnapshots)) { videoDevice.SimulateTrigger(); } }
// Simulate snapshot trigger private void triggerButton_Click(object sender, EventArgs e) { if ((videoDevice != null) && (videoDevice.ProvideSnapshots)) { videoDevice.SimulateTrigger( ); } }
private void btn_cam_Click(object sender, EventArgs e) { if (btn_cam.Text == "Open") { captureDevice.VideoResolution = videoCapabilitie; AVPlayer_Cam1.VideoSource = captureDevice; if (ckBox_DeSwitch.Checked) { captureDevice.NewFrame += new NewFrameEventHandler(FaceDetection); btn_takePic.Enabled = false; } else { btn_takePic.Enabled = true; } ckBox_DeSwitch.Enabled = false; captureDevice.SimulateTrigger(); AVPlayer_Cam1.Start(); btn_cam.Text = "Close"; } else { if (ckBox_DeSwitch.Checked) { captureDevice.NewFrame -= new NewFrameEventHandler(FaceDetection); } ckBox_DeSwitch.Enabled = true; pBox_faceDst.Image = null; AVPlayer_Cam1.Stop(); AVPlayer_Cam1.VideoSource = null; btn_cam.Text = "Open"; } }
private void btnSnapShot_Click(object sender, EventArgs e) { videoDevice.SimulateTrigger(); Bitmap bitmap = pbVideo.Image as Bitmap; pbSnap.Image = bitmap; label1.Text = string.Format("W:{0} H:{1}", bitmap.Width, bitmap.Height); }
public void TakeSnapShot() { videoCaptureDevice.Stop(); videoCaptureDevice.ProvideSnapshots = true; videoCaptureDevice.SimulateTrigger(); videoCaptureDevice.Start(); }
// Simulate snapshot trigger private void triggerButton_Click(object sender, EventArgs e) { if ((kamera != null) && (kamera.ProvideSnapshots)) { kamera.SimulateTrigger( ); } }
private void btnTrigger_Click(object sender, EventArgs e) { if ((videoDevice != null) && (videoDevice.ProvideSnapshots)) { videoDevice.SimulateTrigger(); } if (btnStartBill.Enabled) { btnStartBill.Enabled = false; } }
private void btn_Click(object sender, EventArgs e) { try { if ((videoDevice != null)) { videoDevice.SimulateTrigger(); } } catch (Exception ex) { Disconnect(); MessageBox.Show(ex.Message); } }
private void dispatcherTimer_Tick(object sender, EventArgs e) { System.Media.SoundPlayer player; if (timerTicks < 5) { player = new System.Media.SoundPlayer(@"Resources\count_blip.wav"); } else { player = new System.Media.SoundPlayer(@"Resources\camera_shutter.wav"); if (videoSource.IsRunning) { if (videoSource.ProvideSnapshots) { videoSource.SimulateTrigger(); } else { UpdateTemplateStackData(lastFrame); } snapshotIndex++; } } player.Play(); timerTicks++; if (timerTicks == 5 + photoCollection.Count) { Task.Delay(1000).ContinueWith(delegate { ((DispatcherTimer)sender).Stop(); Dispatcher.BeginInvoke(new Action(delegate { PhotoSessionComplete(); })); }); } }