有没有大佬知道怎么调用外部摄像头,急
解决方案 »
- [高分提问] C# 写的应用程序 如何和 C# 写的asp.net 网站通信?
- 如何判断线程超时?????
- 求助,急!如何获得存储过程返回的结果集?
- 怎么隐藏TabControl控件的TabPage上面的选项卡?我记得Delphi的这个控件就可以实现这个功能(好象是用TabVisible属性来控制)。如果没有
- 序列化 未将对象引用设置到对象的实例
- 关于 Repeater的问题
- Datatable合计
- 多窗口技术中, 每个窗口里动态变化的窗口内容是如何实现的?
- 如何更新数据库中的数量
- 读二进制文件的问题
- 关于CefSharp.Cef.Shutdown主窗口一起退出问题
- mvc @Html.Action 路径问题
http://blog.csdn.net/weixin_36957825/article/details/53636430
引用,代码.前两天刚写的例子,,,,,,,
/// <summary>
/// 打开摄像头
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void button1_Click(object sender, EventArgs e)
{
videoDevices = new FilterInfoCollection(FilterCategory.VideoInputDevice);
selectedDeviceIndex = 0;
videoSource = new VideoCaptureDevice(videoDevices[selectedDeviceIndex].MonikerString);//连接摄像头。
videoSource.VideoResolution = videoSource.VideoCapabilities[selectedDeviceIndex];
videoSourcePlayer1.VideoSource = videoSource;
// set NewFrame event handler
videoSourcePlayer1.Start();
} /// <summary>
/// 拍照
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void button2_Click(object sender, EventArgs e)
{
if (videoSource == null)
return;
Bitmap bitmap = videoSourcePlayer1.GetCurrentVideoFrame();
string fileName = DateTime.Now.ToString("yyyy-MM-dd-HH-mm-ss-ff") + ".jpg";
bitmap.Save(@"E:\" + fileName, System.Drawing.Imaging.ImageFormat.Jpeg);
bitmap.Dispose();
}
开发者模式安装,有C#的demo ,把里面的dll和代码贴出来改改就行了