资源简介
C#调用摄像头(AForge)实现扫描条码解析(Zxing),解析之后会关闭摄像头并在文本框中显示条码信息,DLL源码中内含有,下载可以直接使用。 介绍: 自动识别:点击Start按钮会调用PC摄像头,代码内置Timer,会每100毫秒识别一下当前摄像头图像中的图像,并调用条码识别功能判定是否有条码,如果有的话就直接停止,否则继循环识别。 截图:也可以手动截图,截图后存在运行目录,请自行查找。 补充:识别通过率取决于摄像头的像素,我的笔记本比较烂,所以通过率不高。高像素的摄像头通过率很高。
代码片段和文件信息
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using AForge;
using AForge.Controls;
using AForge.Imaging;
using AForge.Video;
using AForge.Video.DirectShow;
using System.Drawing.Imaging;
using ZXing;
using ZXing.Common;
using ZXing.QrCode;
using ZXing.QrCode.Internal;
///
/// 20190515 by hanfre
/// 关于原理:
/// C#调用摄像头+存储图片+Zxing/Zbar图片识别.当开启摄像头的时候利用Timer对当前图片进行解析处理,识别条码;
/// 关于条码解析:
/// 这个DEMO含两个条码解析组件,分别是Zxing和Zbar,使用哪个可以自己切换;
/// 关于作者:
/// Hanfre
///
namespace WindowsFormsApplication1
{
///
/// 20190515 by hanfre
///
public pa
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
..A..H. 59392 2019-05-15 14:29 WindowsFormsApplication3\.vs\WindowsFormsApplication3\v14\.suo
文件 199 2019-05-15 14:29 WindowsFormsApplication3\WindowsFormsApplication1\App.config
文件 21515 2019-05-15 15:38 WindowsFormsApplication3\WindowsFormsApplication1\bin\Debug\2019-05-15-15-38-14-12.jpg
文件 21857 2019-05-15 15:38 WindowsFormsApplication3\WindowsFormsApplication1\bin\Debug\2019-05-15-15-38-15-71.jpg
文件 44544 2019-05-15 10:55 WindowsFormsApplication3\WindowsFormsApplication1\bin\Debug\AForge.Controls.dll
文件 17920 2019-05-15 10:55 WindowsFormsApplication3\WindowsFormsApplication1\bin\Debug\AForge.dll
文件 262656 2019-05-15 10:55 WindowsFormsApplication3\WindowsFormsApplication1\bin\Debug\AForge.Imaging.dll
文件 61440 2019-05-15 10:55 WindowsFormsApplication3\WindowsFormsApplication1\bin\Debug\AForge.Video.DirectShow.dll
文件 20992 2019-05-15 10:55 WindowsFormsApplication3\WindowsFormsApplication1\bin\Debug\AForge.Video.dll
文件 964989 2016-01-27 10:14 WindowsFormsApplication3\WindowsFormsApplication1\bin\Debug\libiconv-2.dll
文件 17920 2016-01-27 10:14 WindowsFormsApplication3\WindowsFormsApplication1\bin\Debug\libzbar-cil.dll
文件 209438 2016-01-27 10:14 WindowsFormsApplication3\WindowsFormsApplication1\bin\Debug\libzbar.dll
文件 14336 2019-05-15 15:07 WindowsFormsApplication3\WindowsFormsApplication1\bin\Debug\WindowsFormsApplication1.exe
文件 199 2019-05-15 14:29 WindowsFormsApplication3\WindowsFormsApplication1\bin\Debug\WindowsFormsApplication1.exe.config
文件 28160 2019-05-15 15:07 WindowsFormsApplication3\WindowsFormsApplication1\bin\Debug\WindowsFormsApplication1.pdb
文件 22696 2019-05-15 15:30 WindowsFormsApplication3\WindowsFormsApplication1\bin\Debug\WindowsFormsApplication1.vshost.exe
文件 199 2019-05-15 14:29 WindowsFormsApplication3\WindowsFormsApplication1\bin\Debug\WindowsFormsApplication1.vshost.exe.config
文件 490 2015-07-10 19:01 WindowsFormsApplication3\WindowsFormsApplication1\bin\Debug\WindowsFormsApplication1.vshost.exe.manifest
文件 454656 2018-04-15 02:39 WindowsFormsApplication3\WindowsFormsApplication1\bin\Debug\zxing.dll
文件 20480 2018-04-15 02:39 WindowsFormsApplication3\WindowsFormsApplication1\bin\Debug\zxing.presentation.dll
文件 9045 2019-05-15 15:07 WindowsFormsApplication3\WindowsFormsApplication1\Form1.cs
文件 5669 2019-05-15 15:07 WindowsFormsApplication3\WindowsFormsApplication1\Form1.Designer.cs
文件 6014 2019-05-15 15:07 WindowsFormsApplication3\WindowsFormsApplication1\Form1.resx
文件 2870 2019-05-15 14:29 WindowsFormsApplication3\WindowsFormsApplication1\obj\Debug\DesignTimeResolveAssemblyReferences.cache
文件 7876 2019-05-15 15:07 WindowsFormsApplication3\WindowsFormsApplication1\obj\Debug\DesignTimeResolveAssemblyReferencesInput.cache
文件 0 2019-05-15 10:56 WindowsFormsApplication3\WindowsFormsApplication1\obj\Debug\TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs
文件 0 2019-05-15 10:56 WindowsFormsApplication3\WindowsFormsApplication1\obj\Debug\TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs
文件 0 2019-05-15 10:56 WindowsFormsApplication3\WindowsFormsApplication1\obj\Debug\TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs
文件 3584 2019-05-15 15:05 WindowsFormsApplication3\WindowsFormsApplication1\obj\Debug\TempPE\Properties.Resources.Designer.cs.dll
文件 2187 2019-05-15 15:37 WindowsFormsApplication3\WindowsFormsApplication1\obj\Debug\WindowsFormsApplication1.csproj.FileListAbsolute.txt
............此处省略28个文件信息
评论
共有 条评论