使用AForge 和 ZXing nuget 全安上了,这个还要灰度处理,代码中没有涉及
usinnugetg AForge.Video;
using AForge.Video.DirectShow;
using ZXing;
using ZXing.Windows.Compatibility;//重要,这个得引入
load
public partial class Form1 : Form
{
private static NewFrameEventHandler videoSource_NewFrame;
FilterInfoCollection videoDevices;
VideoCaptureDevice videoSource;
int selectedDeviceID = 0;
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
videoDevices = new FilterInfoCollection(FilterCategory.VideoInputDevice);
if (videoDevices.Count == 0)
{
MessageBox.Show("灭有摄像头"); ;
}
else
{