コード例 #1
1
ファイル: Form1.cs プロジェクト: MPuchkin/glyphs_2015
        // Open local video capture device
        private void localVideoCaptureDeviceToolStripMenuItem_Click(object sender, EventArgs e)
        {
            var form = new VideoCaptureDeviceForm();

            if (form.ShowDialog(this) == DialogResult.OK)
            {
                // open it
                OpenVideoSource(form.VideoDevice);
            }
        }
コード例 #2
1
ファイル: AForgeCamera.cs プロジェクト: glocklueng/agg-sharp
        public AForgeCamera(string preferedCameraName = null, int preferedWidth = 640, int preferedHeight = 480, DownSample downSampleVideo = DownSample.None)
        {
            this.downSampleVideo = downSampleVideo;

            if (preferedCameraName != null)
            {
                FilterInfoCollection videoDevices = new FilterInfoCollection(FilterCategory.VideoInputDevice);
                foreach (FilterInfo info in videoDevices)
                {
                    if (info.Name.Contains(preferedCameraName))
                    {
                        videoCaptureDevice = new VideoCaptureDevice(info.MonikerString);
                        videoCaptureDevice.DesiredFrameSize = new Size(preferedWidth, preferedHeight);
                        break;
                    }
                }
            }

            if (videoCaptureDevice == null)
            {
                VideoCaptureDeviceForm form = new VideoCaptureDeviceForm();
                if (form.ShowDialog(null) == DialogResult.OK)
                {
                    // create video source
                    videoCaptureDevice = form.VideoDevice;
                }
            }

            if (videoCaptureDevice != null)
            {
                //videoCaptureDevice.DesiredFrameRate = 5;
                //videoCaptureDevice.ProvideSnapshots = true;
                //videoCaptureDevice.DesiredSnapshotSize = new Size(preferedWidth, preferedHeight);
                //videoCaptureDevice.SnapshotFrame += new NewFrameEventHandler(videoCaptureDevice_SnapshotFrame);

                asyncCopiedVideoImage = new ImageBuffer(videoCaptureDevice.DesiredFrameSize.Width, videoCaptureDevice.DesiredFrameSize.Height, 32, new BlenderBGRA());
                if (downSampleVideo == DownSample.HalfSize)
                {
                    imageForExternalUse = new ImageBuffer(videoCaptureDevice.DesiredFrameSize.Width / 2, videoCaptureDevice.DesiredFrameSize.Height / 2, 32, new BlenderBGRA());
                }
                else
                {
                    imageForExternalUse = new ImageBuffer(videoCaptureDevice.DesiredFrameSize.Width, videoCaptureDevice.DesiredFrameSize.Height, 32, new BlenderBGRA());
                }
                videoCaptureDevice.Start();
                videoCaptureDevice.NewFrame += new NewFrameEventHandler(source_NewFrame);
            }
        }
コード例 #3
0
ファイル: VideoDevice.cs プロジェクト: raze1392/Motionizer
        public List<FilterInfo> getCamList()
        {
            List<FilterInfo> cameras = new List<FilterInfo>();
            try
            {
                videoDevices = new FilterInfoCollection(FilterCategory.VideoInputDevice);
                videoDeviceList = new VideoCaptureDeviceForm();

                if (videoDevices.Count == 0)
                {
                    throw new ApplicationException();
                }
                deviceExist = true;

                foreach (FilterInfo device in videoDevices)
                {
                    cameras.Add(device);
                }
            }
            catch (ApplicationException)
            {
                deviceExist = false;
                cameras = null;
            }
            return cameras;
        }
コード例 #4
0
        public void Start()
        {
            AForge.Video.DirectShow.VideoCaptureDeviceForm f = new AForge.Video.DirectShow.VideoCaptureDeviceForm();
            f.ShowDialog();

            capturingDevice = f.VideoDevice;

            f.VideoDevice.NewFrame += VideoDevice_NewFrame;
            f.VideoDevice.Start();

            FPSLoop          = new DispatcherTimer();
            FPSLoop.Interval = TimeSpan.FromSeconds(1);
            FPSLoop.Tick    += FPSLoop_Tick;
            FPSLoop.Start();
        }
コード例 #5
0
ファイル: MainForm.cs プロジェクト: macki/GestureRecognition
        private void PlayRecord(object sender, EventArgs e)
        {
            VideoCaptureDeviceForm form = new VideoCaptureDeviceForm();

            // create new instance of video data analyser
            _videDataAnalyser = new DataAnalyser(_selectedRecord, _selectedRecord.Id);

            // create video source
            FileVideoSource fileSource = new FileVideoSource(_selectedRecord.AbsolutePath);

            // open
            OpenVideoSource(fileSource);
        }
コード例 #6
0
ファイル: MainForm.cs プロジェクト: macki/GestureRecognition
        private void OpenRecord_Click(object sender, EventArgs e)
        {
            VideoCaptureDeviceForm form = new VideoCaptureDeviceForm();

            if (openFileDialog.ShowDialog() == DialogResult.OK)
            {
                // create video source
                FileVideoSource fileSource = new FileVideoSource(openFileDialog.FileName);
                _recordToSave = new Records { AbsolutePath = openFileDialog.FileName };
                // open it
                OpenVideoSource(fileSource);
            }

            if (RecordsGridView.Rows.Count > 0)
            {
                RecordsGridView.CurrentRow.Selected = false;
            }
        }
コード例 #7
0
ファイル: MainWindow.xaml.cs プロジェクト: Spawek/valeo
 private void button_ChangeVideoSource_Click(object sender, RoutedEventArgs e)
 {
     VideoCaptureDeviceForm form = new VideoCaptureDeviceForm();
     if (form.ShowDialog() == System.Windows.Forms.DialogResult.OK)
     {
         videoSource = form.VideoDevice;
         glyphRecogniser.InjectVideoSource(videoSource);
     }
     else
     {
         Console.WriteLine("Couldn't open video source");
     }
 }