標籤:index count source 下載 sha solution bit net dex
videoDevices = new FilterInfoCollection(FilterCategory.VideoInputDevice); if (videoDevices.Count == 0) { MessageBox.Show("未檢測到網路攝影機,請確認!"); return; } selectedDeviceIndex = 0; videoSource = new VideoCaptureDevice(videoDevices[selectedDeviceIndex].MonikerString);//串連網路攝影機 int ResolutionIndex = 0; for (int i = 0; i < videoSource.VideoCapabilities.Length; i++) { if (videoSource.VideoCapabilities[i].FrameSize.Width == 1600) //1600*1200解析度即可 { ResolutionIndex = i; break; } } videoSource.VideoResolution = videoSource.VideoCapabilities[ResolutionIndex]; videoSourcePlayer1.VideoSource = videoSource; // set NewFrame event handler videoSourcePlayer1.Start();
下載庫添加引用添加
videoSourcePlayer
控制項就不說了
代碼操作很簡單
但有可能部分usb網路攝影機不支援
if (videoSource == null) return; Bitmap bitmap = videoSourcePlayer1.GetCurrentVideoFrame();
使用AForge.NET Framework開啟網路攝影機並 C#