// Start video source public void Start( ) { if (videoSource != null) { videoSource.Start( ); } }
private void StartCamera() { var rectangle = new Rectangle(); foreach (var screen in System.Windows.Forms.Screen.AllScreens) { rectangle = Rectangle.Union(rectangle, screen.Bounds); } videoSource = new ScreenCaptureStream(rectangle); videoSource.NewFrame += capturedWebCamNewFrame; videoSource.Start(); /* * if (CurrentDevice != null) * { * videoSource = new VideoCaptureDevice(CurrentDevice.MonikerString); * videoSource.NewFrame += capturedWebCamNewFrame; * videoSource.Start(); * } * else * { * MessageBox.Show("Current device can't be null"); * } */ }
public void StartCamera(LiveCamStatus cameraId) { switch (cameraId) { case LiveCamStatus.webCamLocal2: StopCamera(); _videoSource = new MJPEGStream("http://192.168.1.192:8089/video"); _videoSource.NewFrame += video_NewFrame; _videoSource.Start(); IsWebCamLocal1Play = false; IsWebCamLocal2Play = true; break; case LiveCamStatus.webCamLocal1: if (CurrentDevice != null) { StopCamera(); _videoSource = new AForge.Video.DirectShow.VideoCaptureDevice(CurrentDevice.MonikerString); _videoSource.NewFrame += video_NewFrame; _videoSource.Start(); IsWebCamLocal1Play = true; IsWebCamLocal2Play = false; } else { MessageBox.Show("Current device can't be null"); } break; default: break; } }
//Defines actions,happening after clicking the Start button:Calls OpenConnections method(described below) and Starts the camera private void btnStart_Click(object sender, EventArgs e) { OpenConnections(); videoSource = new VideoCaptureDevice(videoDevicesList[cmbVideoSource.SelectedIndex].MonikerString); videoSource.NewFrame += new NewFrameEventHandler(video_NewFrame); videoSource.Start(); }
private void StartCamera() { //przypisanie wybranej kamerki jako ta z ktĆ³rej bÄdziemy korzystaÄ videoSource = new VideoCaptureDevice(cameraDevices[cameraListComboBox.SelectedIndex].MonikerString); videoSource.NewFrame += video_NewFrame; videoSource.Start(); }
// Start video source public void start() { if (_videoSource != null) { _videoSource.Start(); } }
private void LoanBtn_Click(object sender, EventArgs e) { if (videoSource != null && videoSource.IsRunning) { lblErrorMessage.Text = "You are already scanning!"; timer2.Start(); } else { double value = Convert.ToDouble(StockNUD.Value); Item item = type[ItemCb.SelectedIndex]; if (item.Quantity != 0) { if (value != 0) { btnStopCamera.Enabled = true; btnStopCamera.Visible = true; videoSource.Start(); timer1.Start(); } else { lblErrorMessage.Text = "Please select a quantity for the item!"; timer2.Start(); } } else { lblErrorMessage.Text = "Item not in stock!"; timer2.Start(); } } }
private void MotionForm_Shown(object sender, EventArgs e) { AppendLog("ēØåŗå·²å č½½..."); try { AppendLog("ę£åØčÆ»åęåå¤“č®¾å¤åč”Ø..."); //åå§åęåå¤“č®¾å¤ VideoDevicesList = new FilterInfoCollection(FilterCategory.VideoInputDevice); AppendLog("ä½æēØé»č®¤ęåå¤“č®¾å¤..."); //ä½æēØé»č®¤č®¾å¤ VideoSource = new VideoCaptureDevice(VideoDevicesList[0].MonikerString); //ē»å®äŗ件 AppendLog("ę³Øåč¦ę„äŗ件"); VideoSource.NewFrame += new NewFrameEventHandler(Alert); AppendLog("ę£åØåÆåØęå夓..."); //åÆåØęå夓 VideoSource.Start(); } catch (Exception ex) { AppendLog("ę ę³čæę„ęåÆåØęå夓ļ¼ēØåŗå³å°éåŗ...\n{0}", ex.Message); MessageBox.Show(string.Format("ę ę³čæę„ęå夓:\n{0}", ex.Message)); Application.Exit(); } AppendLog("č®¾å¤åå§åå®ęļ¼å¼å§ēč§..."); //čæåØēč§ LunchDetector = new MotionDetector(motionDetector, motionProcessing); AppendLog("čæč”ēč§åå»ŗå®ę..."); AppendLog("āāāāāāāāāāāā"); }
public virtual void StartRecording() { _videoSource.NewFrame += VideoNewFrame; _videoSource.Start(); StartNewVideoFileWriter(); }
/// <summary> /// Starts the video stream. /// </summary> /// <remarks></remarks> public void Start() { if (Source != null && !Source.IsRunning) { Source.Start(); } }
public void StartCamera(FilterInfo filterInfo = null, PictureBox pictureBox = null) { try { if (IsDesktopSource) { if (File.Exists(Program.Localpath + "\\resolution.txt")) { var str = File.ReadAllText(Program.Localpath + "\\resolution.txt").Split('_'); Program.width = int.Parse(str[0]); Program.height = int.Parse(str[1]); wf = float.Parse(str[2]); hf = float.Parse(str[3]); } else { Program.width = SystemInformation.VirtualScreen.Width; Program.height = SystemInformation.VirtualScreen.Height; } ClsCommon.WriteLog(Environment.OSVersion.Version.Major + " Major " + Environment.OSVersion.Version.Major + " Minor. METHOD :- StartCamera();"); var rectangle = new Rectangle(0, 0, Program.width, Program.height); heigth = rectangle.Height; widht = rectangle.Width; ClsCommon.WriteLog(heigth + "X" + widht + " Method :- Screen Height and width."); _videoSource = new ScreenCaptureStream(rectangle); _videoSource.NewFrame += video_NewFrame; _videoSource.Start(); } else if (IsWebcamSource) { _PictureBox = pictureBox; CurrentDevice = filterInfo; if (CurrentDevice != null) { _videoSource = new VideoCaptureDevice(CurrentDevice.MonikerString); _videoSource.NewFrame += video_NewFrame; _videoSource.Start(); var video = new VideoCaptureDevice(CurrentDevice.MonikerString).VideoCapabilities; heigth = video[0].FrameSize.Height; widht = video[0].FrameSize.Width; ClsCommon.WriteLog(heigth + "X" + widht + " Method :- video Height and width."); } else { MessageBox.Show("Current device can't be null"); } } else if (IsIpCameraSource) { _videoSource = new MJPEGStream(IpCameraUrl); _videoSource.NewFrame += video_NewFrame; _videoSource.Start(); } } catch (Exception ex) { ClsCommon.WriteLog(ex.Message + " Method :- Start Camera"); } }
private void btnStart_Click(object sender, EventArgs e) { if (videoSource == null) { var vcd = new VideoCaptureDevice(videoDevicesList[cmbVideoSource.SelectedIndex].MonikerString); vcd.VideoResolution = vcd.VideoCapabilities[resolutionsBox.SelectedIndex]; Debug.WriteLine(vcd.VideoCapabilities[1].FrameSize.ToString()); Debug.WriteLine(resolutionsBox.SelectedIndex); videoSource = vcd; videoSource.NewFrame += new NewFrameEventHandler(video_NewFrame); videoSource.Start(); StartButton.Text = "Š”ŃŠ¾Šæ"; controlPanel.Enabled = true; cmbVideoSource.Enabled = false; } else { videoSource.SignalToStop(); if (videoSource != null && videoSource.IsRunning && originalImageBox.Image != null) { originalImageBox.Image.Dispose(); } videoSource = null; StartButton.Text = "Š”ŃŠ°ŃŃ"; controlPanel.Enabled = false; cmbVideoSource.Enabled = true; } }
// Start video source public void Start() { if (mVideoSource != null) { mVideoSource.Start(); } }
private void Button_ResumeFeeding_Click(object sender, RoutedEventArgs e) { if (videoSource != null) { videoSource.Start(); } }
private void StartCamera() { if (IsDesktopSource) { var rectangle = new Rectangle(); foreach (var screen in System.Windows.Forms.Screen.AllScreens) { rectangle = Rectangle.Union(rectangle, screen.Bounds); } _videoSource = new ScreenCaptureStream(rectangle); _videoSource.NewFrame += video_NewFrame; _videoSource.Start(); } else if (IsWebcamSource) { if (CurrentDevice != null) { _videoSource = new VideoCaptureDevice(CurrentDevice.MonikerString); _videoSource.NewFrame += video_NewFrame; _videoSource.Start(); } else { MessageBox.Show("Current device can't be null"); } } else if (IsIpCameraSource) { _videoSource = new MJPEGStream(IpCameraUrl); _videoSource.NewFrame += video_NewFrame; _videoSource.Start(); } }
public void Start() { if (ivideo != null) { ivideo.Start(); } }
public void StartCamera(LiveCamStatus cameraId, System.Windows.Controls.Image image, String ipWebcam = null) { switch (cameraId) { case LiveCamStatus.webCamLocal2: _videoSource = new MJPEGStream(ipWebcam); _videoSource.NewFrame += new NewFrameEventHandler((sender, args) => { video_NewFrame(sender, args, image); }); _videoSource.Start(); break; case LiveCamStatus.webCamLocal1: if (CurrentDevice != null) { StopCamera(image); Thread.Sleep(1000); _videoSource = new AForge.Video.DirectShow.VideoCaptureDevice(CurrentDevice.MonikerString); _videoSource.NewFrame += new NewFrameEventHandler((sender, args) => { video_NewFrame(sender, args, image); }); _videoSource.Start(); } else { MessageBox.Show("Current device can't be null"); } break; default: break; } }
public void Start(Rectangle position) { _position = position; //resolution can't be odd _position.Width = _position.Width % 2 == 0 ? _position.Width : _position.Width - 1; _position.Height = _position.Height % 2 == 0 ? _position.Height : _position.Height - 1; CreateInputDirectoryIfNotExists(); try { _watermarkImage = Image.FromFile(Properties.Settings.Default.WatermarkPath); } catch (FileNotFoundException e) { } _videoSource = new ScreenCaptureStream(_position); _videoSource.NewFrame += CaptureFrame; _videoSource.Start(); _videoWriter = new VideoFileWriter(); var inputFilePath = $"{Properties.Settings.Default.SaveToPath}\\{DateTime.Now:yyyy-MM-dd-HH-mm-ss}.{FILE_CONTAINER}"; _videoWriter.Open(inputFilePath, _position.Width, _position.Height, FRAME_RATE, VideoCodec.H264, BIT_RATE); _isRecording = true; _firstFrameTime = null; }
private void button1_Click(object sender, EventArgs e) { videoSource = new VideoCaptureDevice(videoDevicesList[comboBox1.SelectedIndex].MonikerString); videoSource.NewFrame += new NewFrameEventHandler(video_NewFrame); videoSource.Start(); decode_QRtag(); }
public void Instantiate_Camera() { int cam_count = 0; videoDevicesList = new FilterInfoCollection(FilterCategory.VideoInputDevice); foreach (FilterInfo videoDevice in videoDevicesList) { Console.WriteLine("Kamera[" + cam_count + "]: " + videoDevice.Name); cam_count++; } if (videoDevicesList.Count > 0) { Console.WriteLine("mamy kamerek: " + videoDevicesList.Count); } else { Console.WriteLine("Nie mamy kamerek :/"); } try { Console.WriteLine("Wpisz 0 lub 1 i zatwierdz enterem zeby wybrac kamerke"); int camera = Int32.Parse(Console.ReadLine()); videoSource = new VideoCaptureDevice(videoDevicesList[camera].MonikerString); videoSource.NewFrame += new NewFrameEventHandler(video_NewFrame); videoSource.Start(); Console.WriteLine("kamerka wybrana: " + videoDevicesList[camera].Name); } catch (Exception) { Console.WriteLine("KUPA :3"); } }
public void CameraOn() { _videoCaptureDevice.NewFrame += VideoCaptureDevice_NewFrame; _videoCaptureDevice.Start(); //write line to output class for testing purpose _output.OutputLine("Camera on"); }
private void btn_Start_Click(object sender, EventArgs e) { string ConnectionString = "http://" + cameraIp.Text + "/axis-cgi/jpg/image.cgi"; videoSource = new JPEGStream(ConnectionString); videoSource.NewFrame += new NewFrameEventHandler(video_NewFrame); videoSource.Start(); }
private void BtnStart_Click(object sender, RoutedEventArgs e) { string ConnectionString = "http://" + ipInfo.Text + "/axis-cgi/jpg/image.cgi"; _videoSource = new JPEGStream(ConnectionString); _videoSource.NewFrame += new NewFrameEventHandler(video_NewFrame); _videoSource.Start(); }
public void Start() { if (CurrentDevice != null) { _videoSource = new VideoCaptureDevice(CurrentDevice.MonikerString); _videoSource.NewFrame += this.DisplayWindow.video_NewFrame; _videoSource.Start(); } }
private void btnStart_Click(object sender, EventArgs e) { GettingConnection(); videoSource = new VideoCaptureDevice(videoDevicesList[cmbVideoSource.SelectedIndex].MonikerString); videoSource.NewFrame += new NewFrameEventHandler(video_NewFrame); videoSource.Start(); //if (pictureBox1.InvokeRequired) { pictureBox1.Invoke(new MethodInvoker(() => VideoSender())); } else VideoSender(); //VideoSender(); }
private void StartCamera() { if (((FilterInfo)cbDevices.SelectedItem) != null) { videoSource = new VideoCaptureDevice(((FilterInfo)cbDevices.SelectedItem).MonikerString); videoSource.NewFrame += video_NewFrame; videoSource.Start(); } }
private VideoFeed(IVideoSource source) { videoSource = source; //videoSource.DesiredFrameRate = 60; //videoSource.DesiredFrameSize = new Size(640, 480); videoSource.Start(); }
private void StartLastAddedCamera() { _videoSource = new MJPEGStream(IpCameraUrls.Last().ImageSourcePath); var image = MonitoringImages.FirstOrDefault(mi => mi.Url == IpCameraUrls.Last().ImageSourcePath); image.VideoSource = _videoSource; _videoSource.NewFrame += CaptureVideo_Frame; _videoSource.Start(); }
private static void RunDemoApplication(IVideoSource videoSource, IAudioSource audioSource) { // Create a simple form with just a button and an image var form = new Form() { Text = "SmartApp", ClientSize = new Size(640, 550), StartPosition = FormStartPosition.CenterScreen, MinimizeBox = false, MaximizeBox = false, FormBorderStyle = FormBorderStyle.FixedSingle }; // Image to render the video var buffer = new Bitmap(640, 480, PixelFormat.Format24bppRgb); var image = new PictureBox() { Size = new Size(640, 480), Location = new Point(0, 0), Image = buffer }; form.Controls.Add(image); // Button to start/stop recording var btn = new Button() { Size = new Size(640, 70), Location = new Point(0, 480), Text = "Keep pressed to record", Font = new Font(FontFamily.GenericSansSerif, 16.0f, FontStyle.Bold) }; btn.MouseDown += (_, __) => { videoSource.Start(); audioSource.Start(); }; btn.MouseUp += (_, __) => { videoSource.Stop(); audioSource.Stop(); }; form.Controls.Add(btn); // Draw the rectangles for the faces on the bitmap and show it on the screen videoSource.FrameReady += (_, frame) => { using (var g = Graphics.FromImage(buffer)) using (var pen = new Pen(Color.Red, 3f)) { g.DrawImage(frame.Image, new Rectangle(0, 0, buffer.Width, buffer.Height)); foreach (var face in frame.Faces) { g.DrawRectangle(pen, face.Bounds); } } image.Invoke((Action)(() => { image.Refresh(); })); }; // Show the form and block Application.EnableVisualStyles(); form.ShowDialog(); }
private void btnStart_Click(object sender, RoutedEventArgs e) { if (_videoSource == null) { _videoSource = new MJPEGStream(ConnectionString); _videoSource.NewFrame += new NewFrameEventHandler(video_NewFrame); _videoSource.Start(); } }
private void StartCamera() { if (CurrentDevice != null) { _videoSource = new VideoCaptureDevice(CurrentDevice.MonikerString); _videoSource.NewFrame += video_NewFrame; _videoSource.Start(); } }
// Start cameras private void StartCameras(IVideoSource videoSource) { // create first video source videoSourcePlayer1.VideoSource = videoSource; if (CWViewer1 == null || !CWViewer1.Visible) videoSourcePlayer1.VideoSource = videoSource; if (CWViewer2 == null || !CWViewer2.Visible) videoSourcePlayer2.VideoSource = videoSource; // Start feed videoSource.NewFrame += new NewFrameEventHandler(videoSource_NewFrame); videoSource.Start(); // Start image processing worker new RunWorkerDelegate(this.RunWorker).BeginInvoke(null, this); // start timer timer.Start( ); }