可能重复:
从C#控制相机设备
我有一台笔记本电脑,笔记本电脑的盖子上有内置摄像头。
我想编写一个C#应用程序以捕获图像,并将其保存到硬盘驱动器。
有没有人有一个快速的代码片段来实现这一目标?
我在Windows 7(64位)下运行
Emgu cv库对此有些大材小用,但是下面是一个示例,分为7行:
ImageViewer viewer = new ImageViewer(); //create an image viewer
Capture capture = new Capture(); //create a camera captue
Application.Idle += new EventHandler(delegate(object sender, EventArgs e)
{ //run this until application closed (close button click on image viewer)
viewer.Image = capture.QueryFrame(); //draw the image obtained from camera
});
viewer.ShowDialog(); //show the image viewer
Run Code Online (Sandbox Code Playgroud)
(来源:http : //emgu.com/wiki/index.php/Camera_Capture_in_7_lines_of_code)
| 归档时间: |
|
| 查看次数: |
29376 次 |
| 最近记录: |