News for hackers. Stuff that matters.
Re:Generating a QR code with only ARM Assembly by amelius on Wednesday September 08, 2021 @01:11PM (#28460053)
OT. Does anyone know of a good open source library to read "Data Matrix" 2d barcodes? The ones I found are either broken or extremely slow. The frustrating part is that there seem to be many mobile phone apps which can do it just fine, but I want to run this in my own code on my desktop machine, so each barcode can trigger an appropriate action.
Re:Generating a QR code with only ARM Assembly by dmitrygr on Wednesday September 08, 2021 @01:29PM (#28460321)
The spec is quite clear (i was able to implement creating datamatrix codes of all sizes/shaped from the spec in C in a day). Take a look at it. It also covers how to decode them. You might be able to write it yourself and learn a lot in the process.

It goes into great depth on suggested methods to decode. See section 9 "Reference decode algorithm for Data Matrix" in ISO/IEC 16022 second edition 2006-09-15, which you'll need to BUY...

I've uploaded for you to view here: https://mega.nz/file/ctQCxDaQ#Y7-XyMeR2e8nJQ79cJfWKmlfwxPm2Q...

Because, fuck ISO for paywalling knowledge!

Re:Generating a QR code with only ARM Assembly by codetrotter on Wednesday September 08, 2021 @01:37PM (#28460436)
Hos do you correct for angles around the axes x, y and z? That’s the hard part I imagine
Re:Generating a QR code with only ARM Assembly by wizzwizz4 on Wednesday September 08, 2021 @02:17PM (#28461050)
Re:Generating a QR code with only ARM Assembly by gregsadetsky on Wednesday September 08, 2021 @04:42PM (#28462787)
And here's a Matlab implementation based on that paper:

https://github.com/lapauwThomas/QR_reader

Would be curious to see how it performs.

Re:Generating a QR code with only ARM Assembly by dmitrygr on Wednesday September 08, 2021 @01:46PM (#28460591)
I updated the comment you replied to with more info :)
Re:Generating a QR code with only ARM Assembly by nayuki on Wednesday September 08, 2021 @03:14PM (#28461734)
Thanks, this is going to be a fun read. =)
Re:Generating a QR code with only ARM Assembly by zwieback on Wednesday September 08, 2021 @01:20PM (#28460201)
The only one I've used is https://github.com/zxing/zxing, but it was a long time ago. Seemed to work ok for DataMatrix.
Re:Generating a QR code with only ARM Assembly by gregsadetsky on Wednesday September 08, 2021 @02:41PM (#28461352)
zxing has an online decoder -- https://zxing.org/w/decode.jspx -- but I've seen it fail so often that I'm wondering whether it's very "strict" / doesn't account for image distortion that much?

Or does the web site use hardcoded settings that are more tweakable in the library?

Huh, interesting -- zxing is in "Maintenance Mode Only": https://github.com/zxing/zxing

I'd be suuuuper interested to know: what's the state of the art in terms of QR decoding, both in terms of decoding speed, amenability to various image distortions, and (which I've always dreamed of) the ability to partially decode a QR code, even if the error correction fails for some parts of it, or even totally? i.e. a very very verbose debugging/decoding mode?

Re:Generating a QR code with only ARM Assembly by ianlevesque on Wednesday September 08, 2021 @05:57PM (#28463556)
If you just want effective and free and don’t care about open, Google’s is the best https://developers.google.com/ml-kit/vision/barcode-scanning

Also depending on your application you could buy a hardware scanner like https://www.zebra.com/us/en/products/scanners/fixed-mount-sc... for cheap secondhand since they are all over retail. The protocol can be as simple as it “types” the barcode over USB HID like a keyboard, or there are more specialized modes.

Re:Generating a QR code with only ARM Assembly by amelius on Wednesday September 08, 2021 @06:09PM (#28463662)
Google's barcode kit seems to be available only for Android and iOS.
Re:Generating a QR code with only ARM Assembly by pabs3 on Thursday September 09, 2021 @02:18AM (#28466872)
The zxing C++ port worked for me recently:

https://github.com/nu-book/zxing-cpp/

Re:Generating a QR code with only ARM Assembly by cameldrv on Wednesday September 08, 2021 @01:43PM (#28460537)
I wasn't able to find one for an important project and we ended up having to go with a commercial library. The open source ones were very unreliable.
Re:Generating a QR code with only ARM Assembly by gregsadetsky on Wednesday September 08, 2021 @02:42PM (#28461366)
Would you mind sharing which one? Did you look at a few / are there good comparison articles?
Re:Generating a QR code with only ARM Assembly by jiehong on Wednesday September 08, 2021 @04:00PM (#28462294)
No OP, but I'm aware of a few:

- scandit: https://www.scandit.com/developers/

- cognex: https://cmbdn.cognex.com/

- aspose: https://products.aspose.com/barcode/

In open source, I heard of libdmtx[0], but not much happens on it these days. I also saw html5-qrcode[1]

[0]: https://github.com/dmtx

[1]: https://github.com/mebjas/html5-qrcode, which directly depends on a port of zxing to javascript.

Re:Generating a QR code with only ARM Assembly by gregsadetsky on Wednesday September 08, 2021 @04:29PM (#28462632)
Fascinating, thanks a lot for these.

Scandit and Cognex have iOS apps, and Aspose has a web recognizer demo.

I tried all three with a 2D QR code (my vax card!) from which I truncated ~2-3 bit-"rows" from the bottom. None of the apps/site detected the code.

This is truly not a thorough test -- the 2D rows may be more information-dense than I think i.e. they are not recoverable using the built-in error correction (basically I'm removing too much information -- the equivalent of a long/deep scratch on a CD).

--

I'm just trying to get an intuitive sense of how much damage a QR code can sustain and ... I guess if there's such a thing as QR code forensics (there must be...??) for decoding partial codes versus not detecting "anything".

Thanks again for the links. Super interesting space

Re:Generating a QR code with only ARM Assembly by jhugo on Wednesday September 08, 2021 @07:42PM (#28464411)
When generating a QR code, you can decide how much redundancy to include, making the QR larger for the same data but more resilient to "scratches".
Re:Generating a QR code with only ARM Assembly by gregsadetsky on Wednesday September 08, 2021 @07:52PM (#28464485)
Thanks. Looking into it [0], the QR code I'm testing uses the "up to 7% damage" error correction level L, which makes sense since there's already a lot of data being packed in the (vax proof) code.

... I still want to find a debugging/verbose QR decoder :-)

[0] https://blog.qrstuff.com/2011/12/14/qr-code-error-correction

Re:Generating a QR code with only ARM Assembly by cameldrv on Wednesday September 08, 2021 @04:21PM (#28462529)
There are a lot more QR code libraries available, and while they're conceptually very similar, the open source DataMatrix libraries are much less developed and are far less reliable.
Re:Generating a QR code with only ARM Assembly by amelius on Wednesday September 08, 2021 @07:01PM (#28464130)
I tried libdmtx, but it was extremely slow, and also it had problems with most of my barcodes, even after I cleaned up the images as much as I could.
Re:Generating a QR code with only ARM Assembly by cameldrv on Wednesday September 08, 2021 @04:19PM (#28462509)
We ended up using one from a company called 2D technology group. They were the only one we found that supported ARM Linux and did grading of codes.
Re:Generating a QR code with only ARM Assembly by lloydatkinson on Wednesday September 08, 2021 @03:54PM (#28462209)
This is the third request for datamatrix barcodes I've seen on HN, Twitter, and Reddit today. What's going on?
Re:Generating a QR code with only ARM Assembly by amelius on Wednesday September 08, 2021 @04:18PM (#28462483)
I don't know about others, but I want to read Digikey barcodes. They are in data-matrix format.