Start() public method

Start video source.
Starts video source and return execution to caller. Video source object creates background thread and notifies about new frames with the help of NewFrame event.
public Start ( ) : void
return void
コード例 #1
3
ファイル: ucUsbCamera.cs プロジェクト: ysjr-2002/QuickDoor
        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;
        }
コード例 #2
1
ファイル: Form1.cs プロジェクト: Rohail1/OOP-Project
        private void button1_Click(object sender, EventArgs e)
        {
            cam = new VideoCaptureDevice(webcams[comboBox1.SelectedIndex].MonikerString);
            cam.NewFrame += new NewFrameEventHandler(cam_NewFrame);

            cam.Start();
        }
コード例 #3
0
        private void button1_Click(object sender, EventArgs e)
        {
            vkl             = true;
            button5.Enabled = false;
            button4.Enabled = true;
            var videoDevices = new FilterInfoCollection(FilterCategory.VideoInputDevice);

            height        = Settings.height;
            width         = Settings.width;
            player        = new VideoSourcePlayer();
            player.Top    = 30;
            player.Left   = 30;
            player.Width  = width;
            player.Height = height;
            player.Show();
            Controls.Add(player);
            button1.Top  = height + 30;
            button1.Left = width + 50;
            button2.Top  = height + 60;
            button2.Left = width + 50;
            button3.Top  = height + 90;
            button3.Left = width + 50;
            button4.Top  = height + 120;
            button4.Left = width + 50;
            button5.Top  = height + 160;
            button5.Left = width + 50;
            cam          = new AForge.Video.DirectShow.VideoCaptureDevice(videoDevices[0].MonikerString);
            cam.Start();
            player.VideoSource = cam;
            player.Start();
        }
コード例 #4
0
ファイル: Form1.cs プロジェクト: JollySwagman/Super8
        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();
            // ...
            //}
        }
コード例 #5
0
ファイル: WebcamDBService.cs プロジェクト: solsetmary/Makhzan
        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();
            }
        }
コード例 #6
0
        public MainWindow()
        {
            InitializeComponent();

            ////////////////////Video Config - Start//////////////////////
            FilterInfoCollection videoDevices = new FilterInfoCollection(FilterCategory.VideoInputDevice);
            string toPrint = "";
            foreach (FilterInfo vidDevice in videoDevices)
            {
                toPrint += vidDevice.MonikerString + "  \n  ";
            }
            MessageBox.Show("Found:\n\n" + toPrint);
            if (videoDevices.Count < 2)
            {
                MessageBox.Show("Not enough webcams detected, closing");
                Environment.Exit(0);
            }
            VideoCaptureDevice leftSource = new VideoCaptureDevice(videoDevices[0].MonikerString);
            VideoCaptureDevice rightSource = new VideoCaptureDevice(videoDevices[1].MonikerString);

            leftSource.Start();
            rightSource.Start();

            leftPlayer.VideoSource = leftSource;
            rightPlayer.VideoSource = rightSource;

            leftHost.Child = leftPlayer;
            rightHost.Child = rightPlayer;

            leftPlayer.Start();
            rightPlayer.Start();
        }
コード例 #7
0
        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;
                }
            }
        }
コード例 #8
0
ファイル: WebcamWindow.xaml.cs プロジェクト: GeoOjacob/sppdi
 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();
 }
コード例 #9
0
ファイル: Clscamera.cs プロジェクト: jacean/RingsII
 public static void Cameraint(int i)
 {
     videoSource = new VideoCaptureDevice(videoDevices[i].MonikerString);
      videoSource.DesiredFrameSize = new Size(2048, 1536);
      videoSource.DesiredFrameRate = 1;
      videoSource.Start();
 }
コード例 #10
0
        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();
            }
        }
コード例 #11
0
 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();
 }
コード例 #12
0
ファイル: Form1.cs プロジェクト: zStyle/GoRecorder
 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;
         }
     }
 }
コード例 #13
0
        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();
        }
コード例 #14
0
ファイル: WebCam.cs プロジェクト: onarf/Free3DTrack
        public WebCam(string VideoDeviceMoniker)
        {
            thisvideoSource = new VideoCaptureDevice(VideoDeviceMoniker);

            thisvideoSource.NewFrame += new NewFrameEventHandler(Cam_NewFrame);
            thisvideoSource.DesiredFrameRate = 60;
            thisvideoSource.Start();
        }
コード例 #15
0
ファイル: Logic.cs プロジェクト: valik35/CurseProject
        public Logic()
        {
            videodevices = new FilterInfoCollection(FilterCategory.VideoInputDevice);
            videoSource = new VideoCaptureDevice(videodevices[0].MonikerString);

            videoSource.NewFrame += videoSource_NewFrame;
            videoSource.Start();
        }
コード例 #16
0
ファイル: Form1.cs プロジェクト: Lena-P/face-recognizer
 private void InitializeCapture()
 {
     FilterInfoCollection videoDevices = new FilterInfoCollection(FilterCategory.VideoInputDevice);
     videoSource = new VideoCaptureDevice(videoDevices[0].MonikerString);
     videoSource.NewFrame += new NewFrameEventHandler(NewFrameHandler);
     videoSource.VideoResolution = videoSource.VideoCapabilities[4];
     defaultRect = new System.Drawing.Rectangle(0, 0, videoSource.VideoResolution.FrameSize.Width, videoSource.VideoResolution.FrameSize.Height);
     videoSource.Start();
 }
コード例 #17
0
ファイル: Form1.cs プロジェクト: DogiDepytat/Git
 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();
   
 }
コード例 #18
0
 public void Start()
 {
     if (deviceExists)
     {
         videoSource = new VideoCaptureDevice(videoDevices[0].MonikerString);
         videoSource.NewFrame += videoSource_NewFrame;
         videoSource.Start();
     }
 }
コード例 #19
0
        private void btnCStart_Click(object sender, EventArgs e)
        {
            usbCams = new FilterInfoCollection(FilterCategory.VideoInputDevice);

            cam = new VideoCaptureDevice(usbCams[0].MonikerString);

            cam.NewFrame += new NewFrameEventHandler(cam_NewFrame);

            cam.Start();
        }
コード例 #20
0
        public MainForm()
        {
            InitializeComponent();
            timerLapso.Stop();
            timerCaptura.Stop();
            buttonEmpezar.Focus();

            //TestSet testSet = TestSetDao.GetTestSet(defaultTestSet);

            VideoSources = new AForge.Video.DirectShow.FilterInfoCollection(AForge.Video.DirectShow.FilterCategory.VideoInputDevice);
            if (VideoSources != null)
            {
                foreach (Screen screens1 in Screen.AllScreens)
                {
                    comboBoxPantallas.Items.Add(screens1.DeviceName);
                }

                screens2 = Screen.AllScreens;

                comboBoxPantallas.SelectedIndex = 0;

                foreach (FilterInfo VideoSource in VideoSources)
                {
                    comboBoxWebCam.Items.Add(VideoSource.Name);
                }

                VideoSource           = new AForge.Video.DirectShow.VideoCaptureDevice(VideoSources[0].MonikerString);
                VideoSource.NewFrame += new NewFrameEventHandler(FinalFrame_NewFrame);
                VideoSource.Start();

                if (comboBoxWebCam.Items.Count > 0)
                {
                    comboBoxWebCam.SelectedIndex = 0;
                }
            }

            buttonTerminar.Enabled = false;

            try {
                Conexion.Open();

                SqlCommand    cmd = new SqlCommand("select max(SECCION) AS SECCION from [NEUROSKY_IMAGENES]", Conexion);
                SqlDataReader dr  = cmd.ExecuteReader();

                if (dr.Read())
                {
                    int.TryParse(Convert.ToString(dr["SECCION"]), out this.Seccion);
                    Seccion++;
                }
                Conexion.Close();
            } catch (Exception e) {
                Console.WriteLine("Fallo la conexion a la base");
                Console.WriteLine(e.Message);
            }
        }
コード例 #21
0
 private void initVideo()
 {
     // enumerate video devices
     FilterInfoCollection videoDevices = new FilterInfoCollection(FilterCategory.VideoInputDevice);
     // 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();
 }
コード例 #22
0
ファイル: Form1.cs プロジェクト: sajjanm/Motion-Capture
 public MotionCCTV()
 {
     
     InitializeComponent();
     isResolutionSet = false;
     webcam=new FilterInfoCollection(FilterCategory.VideoInputDevice);
     cam = new VideoCaptureDevice(webcam[0].MonikerString);
     md = new MotionDetector(new TwoFramesDifferenceDetector(), new MotionAreaHighlighting()); // creates the motion detector
     cam.NewFrame += new NewFrameEventHandler(cam_NewFrame); // defines which method to call when a new frame arrives
     cam.Start(); // starts the videoCapture
     Display.Paint += Display_Paint;
 }
コード例 #23
0
ファイル: Form1.cs プロジェクト: oe2dlo/GitProjects
        private void btnStart_Click(object sender, EventArgs e)
        {
            if (_webcams.Count == 0)
            {
                MessageBox.Show("No Webcam installed!", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }

            _camera = new VideoCaptureDevice(_webcams[0].MonikerString);
            _camera.NewFrame += _camera_NewFrame;
            _camera.Start();
        }
コード例 #24
0
        private void FrmAorgeCamera_Load(object sender, EventArgs e)
        {
            if (camera.Devices.Count <= 0)
                return;

            var device = camera.Devices[0];
            videoDevice = new VideoCaptureDevice(device.MonikerString);
            var videoCapabilities = videoDevice.VideoCapabilities;
            //videoDevice.VideoResolution = videoCapabilities[10];
            videoDevice.NewFrame += videoDevice_NewFrame;
            videoDevice.Start();
        }
コード例 #25
0
ファイル: Form1.cs プロジェクト: bakasura980/EVOTE-PROJECT
 private void Form1_Load(object sender, EventArgs e)
 {
     webcam = new FilterInfoCollection(FilterCategory.VideoInputDevice);
     foreach (FilterInfo VideoCaptureDevice in webcam)
     {
         comboBox1.Items.Add(VideoCaptureDevice.Name);
     }
     comboBox1.SelectedIndex = 1;
     cam = new VideoCaptureDevice(webcam[comboBox1.SelectedIndex].MonikerString);
     cam.NewFrame += new NewFrameEventHandler(cam_NewFrame);
     cam.Start();
 }
コード例 #26
0
 private void comboBoxWebCam_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (VideoSources != null)
     {
         if (VideoSource.IsRunning)
         {
             VideoSource.Stop();
         }
         VideoSource           = new AForge.Video.DirectShow.VideoCaptureDevice(VideoSources[comboBoxWebCam.SelectedIndex].MonikerString);
         VideoSource.NewFrame += new NewFrameEventHandler(FinalFrame_NewFrame);
         VideoSource.Start();
     }
 }
コード例 #27
0
ファイル: frmMain.cs プロジェクト: everbot/webcamdemo
 private void btnStartWebcam_Click(object sender, EventArgs e)
 {
     videoDevices = new FilterInfoCollection(FilterCategory.VideoInputDevice);
     videoSource = new VideoCaptureDevice(videoDevices[0].MonikerString);
     videoSource.NewFrame += new NewFrameEventHandler(video_NewFrame);
     CloseVideoSource();
     videoSource.DesiredFrameSize = new Size(320, 240);
     //videoSource.DesiredFrameRate = 7;
     Thread.Sleep(2000);
     videoSource.Start();
     timerFrameRate.Enabled = true;
     btnStartWebcam.Enabled = false;
 }
コード例 #28
0
        public snapShotSender(VideoCaptureDevice VCD)
        {
            videoDevice = VCD;
            VSP = new VideoSourcePlayer();
            videoCapabilities = videoDevice.VideoCapabilities;
            snapshotCapabilitites = videoDevice.SnapshotCapabilities;

            videoDevice.VideoResolution = videoCapabilities[0];
            videoDevice.ProvideSnapshots = true;
            videoDevice.SnapshotResolution = snapshotCapabilitites[_quality];
            videoDevice.SnapshotFrame += videoDevice_SnapshotFrame;
            VSP.VideoSource = videoDevice; //Idk why this has to happen to get snapshots, but it does...
            videoDevice.Start();
        }
コード例 #29
0
ファイル: WebcamHandler.cs プロジェクト: GeekGalaxy/QuasarRAT
 public static void HandleGetWebcam(GetWebcam command, Client client)
 {
     Client = client;
     NeedsCapture = true;
     Webcam = command.Webcam;
     if (!WebcamStarted)
     {
         var videoCaptureDevices = new FilterInfoCollection(FilterCategory.VideoInputDevice);
         FinalVideo = new VideoCaptureDevice(videoCaptureDevices[command.Webcam].MonikerString);
         FinalVideo.NewFrame += FinalVideo_NewFrame;
         FinalVideo.Start();
         WebcamStarted = true;
     }
 }
コード例 #30
0
 private void btnStart_Click(object sender, EventArgs e)
 {
     try
     {
         if (_finalFrame.IsRunning) _finalFrame.Stop();
         _finalFrame = new VideoCaptureDevice(_captureDevice[cmbDeviceName.SelectedIndex].MonikerString);
         _finalFrame.NewFrame += FinalFrame_NewFrame;
         _finalFrame.Start();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
コード例 #31
0
 private void frmFoto_Load(object sender, EventArgs e)
 {
     if (existenDispositivos)
     {
 	    fuenteDeVideo = new VideoCaptureDevice(dispositivosDeVideo[0].MonikerString);
 	    fuenteDeVideo.NewFrame += new NewFrameEventHandler(MostrarImagen);
 	    fuenteDeVideo.Start();
 	}
 	else
 	{
 	    MessageBox.Show("No se encuentra ningún dispositivo de vídeo en el sistema", "Información", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
         this.Close();
      }
 }
コード例 #32
0
ファイル: VideoDevice.cs プロジェクト: raze1392/Motionizer
 public bool startVideoSource(int index)
 {
     if (deviceExist)
     {
         videoSource = new VideoCaptureDevice(videoDevices[index].MonikerString);
         videoSource.NewFrame += new NewFrameEventHandler(videoFrameHandler);
         CloseVideoSource();
         videoSource.Start();
         return true;
     }
     else
     {
         return false;
     }
 }
コード例 #33
0
ファイル: CaptureVideo.cs プロジェクト: doskir/Drumbot
        public void StartCapturing(object logic)
        {
            _logic = (Logic)logic;
            int fps = 25;

            writerThread      = new Thread(ImageWriter);
            writerThread.Name = "writerThread";
            writerThread.Start();

            var videoDevices = new FilterInfoCollection(FilterCategory.VideoInputDevice);

            _captureDevice = new VideoCaptureDevice(videoDevices[0].MonikerString);
            _captureDevice.DesiredFrameSize = new Size(704, 576);
            _captureDevice.DesiredFrameRate = fps;
            _captureDevice.NewFrame        += new AForge.Video.NewFrameEventHandler(camera_NewFrame);
            _captureDevice.Start();
            globFrameCount   = 0;
            globCaptureStart = DateTime.Now;
            //now capturing
        }
コード例 #34
0
ファイル: Entidade.cs プロジェクト: brayandiehl/Loja
 private void AtivarFoto_CheckedChanged(object sender, EventArgs e)
 {
     if (AtivarFoto.Checked)
     {
         FilterInfoCollection videosource = new FilterInfoCollection(FilterCategory.VideoInputDevice);
         if (videosource != null)
         {
             videoSource = new AForge.Video.DirectShow.VideoCaptureDevice(videosource[0].MonikerString);;
             videoSource.VideoResolution = videoSource.VideoCapabilities[1];
             videoSource.NewFrame       += (s, a) => Foto.Image = (Bitmap)a.Frame.Clone();
             videoSource.Start();
         }
     }
     else
     {
         if (videoSource.IsRunning)
         {
             videoSource.Stop();
         }
     }
 }
コード例 #35
-1
ファイル: MainForm.cs プロジェクト: Aleksey993/Misoi
 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;
 }