以前项目中涉及到调用,本机摄像头.发布部分源码.
完整源码下载地址:http://yfdisk.com/fs/014169980600a8b886/
private void getCamList()
{try
{
videoDevices = new FilterInfoCollection(FilterCategory.VideoInputDevice);
comboBox1.Items.Clear();
if (videoDevices.Count == 0)
throw new ApplicationException();
DeviceExist = true;
foreach (FilterInfo device in videoDevices)
{
comboBox1.Items.Add(device.Name);
}
comboBox1.SelectedIndex = 0; //make dafault to first cam
}
catch (ApplicationException)
{
DeviceExist = false;
comboBox1.Items.Add("系统中没有可用设备!");
}
}