WPF通过USB获取摄像头数据
最简单的demo————WPF获取USB摄像头数据
一、操作步骤
1、单击“检测”按钮
获取摄像头数据
2、在下拉框选择相应摄像头
3、单击“连接”按钮
就能看到摄像头的拍摄画面
4、点击“拍照”按钮
二、代码部分
新建WPF项目后
1、引入程序集
AForge.dll
AForge.Controls.dll
AForge.Imaging.dll
AForge.Video.dll
AForge.Video.DirectShow.dll
2、页面布局
<Window x:Class="viewtest2.MainWindow"
xmlns:wfi ="clr-namespace:System.Windows.Forms.Integration;assembly=WindowsFormsIntegration"
xmlns:aforge ="clr-namespace:AForge.Controls;assembly=AForge.Controls"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="MainWindow" Height="350" Width="525">
<Grid Margin="0,0,-6.333,-0.333">
<Grid.ColumnDefinit