如何在我的可视化 C# 表单中使用 zxing.net
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/17512059/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How do I use zxing.net in my visual C# form
提问by legohead
I have never done anything like this before and slowly trying to learn C# for personal use.
我以前从未做过这样的事情,慢慢地尝试学习 C# 以供个人使用。
I am trying to create a program that reads a barcode from a webcam and outputs the barcode's number. I was recommended to use zxing.Netbut i have no idea where to start.
我正在尝试创建一个从网络摄像头读取条形码并输出条形码编号的程序。我被推荐使用,zxing.Net但我不知道从哪里开始。
How do i get input from my webcam and output to the C# windows form.
How do i use
zxing.Netto convert the barcode into a number combination.How do i output this to the screen.
我如何从我的网络摄像头获取输入并输出到 C# windows 窗体。
我如何使用
zxing.Net将条形码转换为数字组合。我如何将其输出到屏幕上。
回答by Joachim Rosskopf
You can find a demo WindowsForms application, which show encoding and decoding from a webcam in the source-code on codeplex:
您可以在 codeplex 的源代码中找到一个演示 WindowsForms 应用程序,它显示了来自网络摄像头的编码和解码:
http://zxingnet.codeplex.com/SourceControl/latest#trunk/Clients/WindowsFormsDemo/Program.cs
http://zxingnet.codeplex.com/SourceControl/latest#trunk/Clients/WindowsFormsDemo/Program.cs
回答by Gorgi Rankovski
I've never done this, but with a little research I can suggest this:
我从来没有这样做过,但是通过一些研究,我可以提出以下建议:
Check thisarticle - it has a working example of how to get a stream from a USB camera. It's not simple, but it is worth trying :)
On this page: http://zxingnet.codeplex.com/scroll to the Usage Example. Over there I can see that it accepts a bitmap and then returns a result or a null if it can't recognize the barcode. So, all you need to do from #1 is to convert the stream to a bitmap object and pass it to zxing barcode reader.
zxing.NET returns the decoded number in plain text, so you can output it to the screen on any way you want?
检查这篇文章 - 它有一个关于如何从 USB 摄像头获取流的工作示例。这并不简单,但值得一试:)
在此页面上:http: //zxingnet.codeplex.com/滚动到使用示例。在那里,我可以看到它接受位图,然后如果无法识别条形码,则返回结果或空值。因此,从 #1 开始,您需要做的就是将流转换为位图对象并将其传递给 zxing 条形码阅读器。
zxing.NET 以纯文本形式返回解码后的数字,因此您可以以任何方式将其输出到屏幕上?
Any reason not to use a barcode reader device?
有什么理由不使用条形码阅读器设备?
回答by snakel
Please do visit this article, to download a c# qr decoding working code sample using zxing library: http://www.itechflare.com/main/blog/c-program-for-2d-barcode-decoding/
请访问这篇文章,下载使用 zxing 库的 ac# qr 解码工作代码示例:http: //www.itechflare.com/main/blog/c-program-for-2d-barcode-decoding/
regards
问候

