问题
I have barcode images in jpg format and want to extract barcode # from those. Please help!
回答1:
See the CodeProject article: Reading Barcodes from an Image - II.
The author (James) improves (and credits) a previously written VB library to decode barcodes from an image using only .NET code.
There are two projects in the downloadable solution:
- The barcode library - written in C#
- The test app - written in VB
I have successfully used the C# code in VS2008 against a JPG image with an extended (includes alpha chars) code 39 barcode.
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 user submits a function that 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!
UPDATE: Incidentally, I just looked at the blog that Joachim Kerschbaumer mentions in another answer to your question. Definitely keep an eye on that project! It looks like a very robust solution. If it can read those skewed barcodes from those busy images, then it can do anything!
回答2:
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.
回答3:
I use the softek barcode toolkit - http://www.bardecode.com/
Works very well - $249 for single developer.
来源:https://stackoverflow.com/questions/204008/barcode-image-to-code39-conversion-in-c