当前位置: 首页>>代码示例>>C#>>正文


C# VideoCaptureDevice.Start方法代码示例

本文整理汇总了C#中AForge.Video.DirectShow.VideoCaptureDevice.Start方法的典型用法代码示例。如果您正苦于以下问题:C# VideoCaptureDevice.Start方法的具体用法?C# VideoCaptureDevice.Start怎么用?C# VideoCaptureDevice.Start使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在AForge.Video.DirectShow.VideoCaptureDevice的用法示例。


在下文中一共展示了VideoCaptureDevice.Start方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Connect

        public bool Connect()
        {
            var videoDevices = new FilterInfoCollection(FilterCategory.VideoInputDevice);

            if (videoDevices.Count == 0)
            {
                return false;
            }
            // create video source
            currentDevice = new VideoCaptureDevice(videoDevices[0].MonikerString);
            videoSourcePlayer1.VideoSource = currentDevice;
            var videoCapabilities = currentDevice.VideoCapabilities;
            //foreach (var video in videoCapabilities)
            //{
            //    LogHelper.Info("预览分辨率->" + video.FrameSize.Width + "*" + video.FrameSize.Height);
            //}
            if (videoCapabilities.Count() > 0)
                currentDevice.VideoResolution = currentDevice.VideoCapabilities.Last();

            var snapVabalities = currentDevice.SnapshotCapabilities;
            //foreach (var snap in snapVabalities)
            //{
            //    LogHelper.Info("抓拍分辨率->" + snap.FrameSize.Width + "*" + snap.FrameSize.Height);
            //}
            if (snapVabalities.Count() > 0)
                currentDevice.SnapshotResolution = currentDevice.SnapshotCapabilities.Last();

            currentDevice.Start();

            return true;
        }
开发者ID:ysjr-2002,项目名称:QuickDoor,代码行数:31,代码来源:ucUsbCamera.cs

示例2: button1_Click

        private void button1_Click(object sender, EventArgs e)
        {
            cam = new VideoCaptureDevice(webcams[comboBox1.SelectedIndex].MonikerString);
            cam.NewFrame += new NewFrameEventHandler(cam_NewFrame);

            cam.Start();
        }
开发者ID:Rohail1,项目名称:OOP-Project,代码行数:7,代码来源:Form1.cs

示例3: button2_Click

 private void button2_Click(object sender, EventArgs e)
 {
     FinalVideo2 = new VideoCaptureDevice(VideoCaptureDevices[comboBox1.SelectedIndex].MonikerString);
     FinalVideo2.NewFrame += new NewFrameEventHandler(FinalVideo_NewFrame2);
     FinalVideo2.Start();
     //   FinalVideo.Stop();
 }
开发者ID:GustavoGregorio,项目名称:Projetos-pessoais,代码行数:7,代码来源:Form1.cs

示例4: button1_Click

        public void button1_Click(object sender, EventArgs e)
        {
            _controller.Connect(new SerialPort((string)comboBox2.SelectedItem, 57600));

            videoSource = new VideoCaptureDevice(videoDevices[comboBox1.SelectedIndex].MonikerString);
            videoSource.NewFrame += new NewFrameEventHandler(video_NewFrame);
            videoSource.Start();
        }
开发者ID:GurtDotCom,项目名称:2015_Reference_Robot,代码行数:8,代码来源:Form1.cs

示例5: GetFrame

        public void GetFrame()
        {
            // enumerate video devices
            var videoDevices = new FilterInfoCollection(FilterCategory.VideoInputDevice);

            //foreach (FilterInfo item in videoDevices)
            //{

            //videoSource = new VideoCaptureDevice(item.MonikerString);
            videoSource = new VideoCaptureDevice(videoDevices[1].MonikerString);
            //videoSource.DesiredFrameSize = new Size(160, 120);

            // create video source
            //VideoCaptureDevice videoSource = new VideoCaptureDevice(videoDevices[0].MonikerString);

            // set NewFrame event handler
            videoSource.NewFrame += new NewFrameEventHandler(video_NewFrame);
            // start the video source
            videoSource.Start();
            // ...
            System.Threading.Thread.Sleep(500);
            Trace.WriteLine("FramesReceived: " + videoSource.FramesReceived);
            // signal to stop
            videoSource.SignalToStop();
            // ...
            //}
        }
开发者ID:JollySwagman,项目名称:Super8,代码行数:27,代码来源:Form1.cs

示例6: Start

        public void Start()
        {
            FilterInfoCollection videoDevices;
            string camDescr;
            try
            {
                videoDevices = new FilterInfoCollection(FilterCategory.VideoInputDevice);
                if (videoDevices.Count == 0)
                {
                    throw new ApplicationException("no webcams");
                }
                else
                {
                    camName = videoDevices[Convert.ToInt32(devIndex)].MonikerString;
                    camDescr = videoDevices[Convert.ToInt32(devIndex)].Name;
                }
            }
            catch (ApplicationException)
            {
                throw new ApplicationException("failed web cams initialize");
            }

            videoSource = new VideoCaptureDevice(camName);
            videoSource.NewFrame += new NewFrameEventHandler(video_NewFrame);
            videoSource.DesiredFrameSize = new Size(Convert.ToInt32(devWidth), Convert.ToInt32(devHeigth));//new Size(320, 240);//new Size(480, 360);//new Size(640, 480);//
            videoSource.DesiredFrameRate = 29;
            videoSource.Start();

            if (timerUploadImage == null)
            {
                timerUploadImage = new System.Timers.Timer(700);
                timerUploadImage.Elapsed += new ElapsedEventHandler(timerUploadImage_Tick);
                timerUploadImage.Start();
            }
        }
开发者ID:solsetmary,项目名称:Makhzan,代码行数:35,代码来源:WebcamDBService.cs

示例7: btnIniciar_Click

 private void btnIniciar_Click(object sender, EventArgs e)
 {
     if (btnIniciar.Text == "Start")
     {
         if (ExistenDispositive)
         {
             FuenteVideo = new VideoCaptureDevice(DispositiveVideo[cboDispositive.SelectedIndex].MonikerString);
             FuenteVideo.NewFrame += new NewFrameEventHandler(video_NuevoFrame);
             FuenteVideo.Start();
             Estado.Text = "Connection Complete";
             btnIniciar.Text = "Stop";
             cboDispositive.Enabled = false;
             groupBox1.Text = DispositiveVideo[cboDispositive.SelectedIndex].Name.ToString();
         }
         else
             Estado.Text = "Error: No matching device.";
     }
     else {
         if (FuenteVideo.IsRunning) {
             btnIniciar.Text = "Start";
             TerminarFuenteDeVideo();
             Estado.Text = "Dispositiveo detenio";
             cboDispositive.Enabled = true;
         }
     }
 }
开发者ID:zStyle,项目名称:GoRecorder,代码行数:26,代码来源:Form1.cs

示例8: VideoCaptureDevice

 private void btnComeçar_Click(object sender, RoutedEventArgs e)
 {
     //Iniciar a camera e mostrar no picture Box[form control] por meio do evento
     cam = new VideoCaptureDevice(webcam[cmbDevices.SelectedIndex].MonikerString);
     cam.NewFrame += new NewFrameEventHandler(cam_NewFrame);
     cam.Start();
 }
开发者ID:GeoOjacob,项目名称:sppdi,代码行数:7,代码来源:WebcamWindow.xaml.cs

示例9: Cameraint

 public static void Cameraint(int i)
 {
     videoSource = new VideoCaptureDevice(videoDevices[i].MonikerString);
      videoSource.DesiredFrameSize = new Size(2048, 1536);
      videoSource.DesiredFrameRate = 1;
      videoSource.Start();
 }
开发者ID:jacean,项目名称:RingsII,代码行数:7,代码来源:Clscamera.cs

示例10: StartVideo

        public void StartVideo()
        {
            if (filterInfoCollection != null)
            {
                videoCaptureDevice = new VideoCaptureDevice(filterInfoCollection[1].MonikerString);
                try
                {
                    if (videoCaptureDevice.VideoCapabilities.Length > 0)
                    {
                        string highestSolution = "0;0";

                        for (int i = 0; i < videoCaptureDevice.VideoCapabilities.Length; i++)
                        {
                            highestSolution = videoCaptureDevice.VideoCapabilities[i].FrameSize.Width.ToString() +';'
                            +i.ToString();
                        }

                        videoCaptureDevice.VideoResolution =
                            videoCaptureDevice.VideoCapabilities[Convert.ToInt32(highestSolution.Split(';')[1])];

                    }

                }
                catch (Exception e)
                {

                }

                videoCaptureDevice.NewFrame += newFrameEventHandler;

                videoCaptureDevice.Start();
            }
        }
开发者ID:3dprintscanner,项目名称:PedestrianDetectorDemo,代码行数:33,代码来源:WebcamManager.cs

示例11: button_iniciar_Click

        private void button_iniciar_Click(object sender, EventArgs e)
        {
            if (button_iniciar.Text.Equals("Iniciar"))
            {
                if (existem_dispositivos)
                {
                    fonte_video = new VideoCaptureDevice(dispositivos_video[comboBox_dispositivo.SelectedIndex].MonikerString);
                    fonte_video.NewFrame += new NewFrameEventHandler(VideoNovoFrame);
                    fonte_video.Start();
                    //statusStrip_barra.Text = "Executando dispositivo";
                    button_iniciar.Text = "Parar";
                    comboBox_dispositivo.Enabled = false;
                    //label_nome.Text = dispositivos_video[comboBox_camera.SelectedIndex].ToString();

                }
                else
                {
                    //statusStrip_barra.Text = "Error: Não encontrado dispositivo";
                }

            }
            else
            {
                if (fonte_video != null)// || fonte_video.IsRunning)
                {
                    TerminarFonteVideo();
                    //statusStrip_barra.Text = "Dispositivo Terminado";
                    //button_iniciar.Text = "Iniciar";
                    comboBox_dispositivo.Enabled = true;
                }
            }
        }
开发者ID:ViniciusConsultor,项目名称:academia-vida-fisica,代码行数:32,代码来源:Form2.cs

示例12: WebCam

        public WebCam(string VideoDeviceMoniker)
        {
            thisvideoSource = new VideoCaptureDevice(VideoDeviceMoniker);

            thisvideoSource.NewFrame += new NewFrameEventHandler(Cam_NewFrame);
            thisvideoSource.DesiredFrameRate = 60;
            thisvideoSource.Start();
        }
开发者ID:onarf,项目名称:Free3DTrack,代码行数:8,代码来源:WebCam.cs

示例13: Logic

        public Logic()
        {
            videodevices = new FilterInfoCollection(FilterCategory.VideoInputDevice);
            videoSource = new VideoCaptureDevice(videodevices[0].MonikerString);

            videoSource.NewFrame += videoSource_NewFrame;
            videoSource.Start();
        }
开发者ID:valik35,项目名称:CurseProject,代码行数:8,代码来源:Logic.cs

示例14: button1_Click

 private void button1_Click(object sender, EventArgs e)
 {
     videoSource = new VideoCaptureDevice(videoDevices[0].MonikerString);
         videoSource.NewFrame += videoSource_NewFrame;
         videoSource.Start();
         while (newImage == null){}
         videoSource.Stop();
         newImage = null;
 }
开发者ID:Aleksey993,项目名称:Misoi,代码行数:9,代码来源:MainForm.cs

示例15: button3_Click

 private void button3_Click(object sender, EventArgs e)
 {
     videoDevices = new FilterInfoCollection(FilterCategory.VideoInputDevice); // список устройств
     videoSource = new VideoCaptureDevice(videoDevices[0].MonikerString);  // подключения устройства
     videoSource.NewFrame += new NewFrameEventHandler(videoSource_NewFrame);  // создание источника видеосигнала 
     pictureBox1.SizeMode = PictureBoxSizeMode.Zoom;
     videoSource.Start();
   
 }
开发者ID:DogiDepytat,项目名称:Git,代码行数:9,代码来源:Form1.cs


注:本文中的AForge.Video.DirectShow.VideoCaptureDevice.Start方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。