条形码图像到 C# 中的 Code39 转换?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/204008/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-03 17:55:07  来源:igfitidea点击:

barcode image to Code39 conversion in C#?

c#image-processingbarcodecode39

提问by Ramesh Soni

I have barcode images in jpg format and want to extract barcode # from those. Please help!

我有jpg格式的条形码图像,想从中提取条形码#。请帮忙!

采纳答案by Doug L.

See the CodeProject article: Reading Barcodes from an Image - II.

请参阅 CodeProject 文章:从图像中读取条码 - II

The author (James) improves (and credits) a previously writtenVB library to decode barcodes from an image using only .NET code.

作者 ( James) 改进(并感谢)以前编写的VB 库,以仅使用 .NET 代码从图像中解码条形码。

There are two projects in the downloadable solution:

可下载的解决方案中有两个项目:

  • The barcode library - written in C#
  • The test app - written in VB
  • 条码库 - 用 C# 编写
  • 测试应用程序 - 用 VB 编写

I have successfully used the C# code in VS2008 against a JPG image with an extended (includes alpha chars) code 39 barcode.

我已经成功地将 VS2008 中的 C# 代码用于带有扩展(包括 alpha 字符)代码 39 条形码的 JPG 图像。

The library has the ability to scan an entire image for a barcode, where the barcode is only a portion. This has good and bad points. It is more flexible, but you may have to parse out noise. Of course, you will want to start with the cleanest image possible. Also, the scanned barcode must be fairly straight, not rotated or skewed at an angle.

该库能够扫描整个图像以获取条码,其中条码只是一部分。这有好有坏。它更灵活,但您可能需要解析噪音。当然,您会希望从尽可能干净的图像开始。此外,扫描的条码必须相当直,不能旋转或倾斜一定角度。

If you can limit the scan to a "slice" of the actual barcode, you might get better accuracy.

如果您可以将扫描限制为实际条形码的“切片”,您可能会获得更好的准确性。

In the article comments, another usersubmits a functionthat re-scans the barcode and uses a checksum digit, which is great if you control the printing of the original barcode and can include the checksum in the first place.

在文章评论中,另一个用户提交重新扫描条码并使用校验和数字的功能,如果您控制原始条码的打印并且可以首先包含校验和,这很棒。

There are, of course some very impressive (and some very expensive) commercial solutions that have the advantage of being well-tested, more flexible, can scan more barcode formats, and are more tolerant of image quality due to improved image sampling. But this is a good (free) start!

当然,有一些非常令人印象深刻(也有一些非常昂贵)的商业解决方案具有经过充分测试、更灵活、可以扫描更多条码格式以及由于改进的图像采样而对图像质量更宽容的优势。但这是一个好的(免费)开始!

You will need to sign up with CodeProject to download the code, but that is free also - and worth the time because there is so much good code on that site!

您需要注册 CodeProject 才能下载代码,但这也是免费的 - 值得花时间,因为该站点上有很多好的代码!

UPDATE: Incidentally, I just looked at the blogthat Joachim Kerschbaumermentions in another answerto your question. Definitely keep an eye on that project! It looks like a veryrobust solution. If it can read those skewed barcodes from those busy images, then it can do anything!

更新:顺便说一句,我只是看着博客约阿希姆Kerschbaumer中提到了另一个答案你的问题。一定要关注那个项目!它看起来是一个非常强大的解决方案。如果它可以从那些繁忙的图像中读取那些倾斜的条形码,那么它就可以做任何事情!

回答by Ramesh Soni

I use the softek barcode toolkit - http://www.bardecode.com/

我使用 softek 条码工具包 - http://www.bardecode.com/

Works very well - $249 for single developer.

效果很好 - 单个开发人员 249 美元。

回答by Joachim Kerschbaumer

we've developed a c# component that reads values from barcodes of all dimension, rotation, quality etc. it's not yet release but we will release detailed information about it at http://blog.lemqi.com. it will be probably free (maybe open source). but maybe it's still 1-2 weeks till release as we have to refactor the code before.

我们开发了 ac# 组件,可以从所有尺寸、旋转、质量等的条形码中读取值。它尚未发布,但我们将在http://blog.lemqi.com 上发布有关它的详细信息。它可能是免费的(可能是开源的)。但也许离发布还有 1-2 周的时间,因为我们之前必须重构代码。