News for hackers. Stuff that matters.

Ask HN: How are QR scanners written?

I have been programming web and backend stuff for over a decade but I have never done any kind of image processing. I tried googling but there is so much noise in the QR space.

What I want to know is, how does QR scanner code work? How do you go from a photo of a QR to the encoded text within, allowing for all of the factors that will get in the way like poor quality cameras, off-center photos, blurriness etc? Is there a code-first tutorial or worked example somewhere?

( 3 comments | 10 points | on HN )
Re:Ask HN: How are QR scanners written? by muzani on Tuesday November 16, 2021 @06:01PM (#29247356)
Here's some code you can dig into: https://github.com/zxing/zxing

It's a very good one, and one that has been copied for a lot of custom QR scanners

Re:Ask HN: How are QR scanners written? by pavelgvay on Wednesday November 17, 2021 @03:42AM (#29250449)
On my first job at an internet provider company, they had no backend. They were using some proprietary software and SQL functions instead. One day the CEO came in and said: "Guys, we need to print a small QR code on mails to customers. ". The team lead responded: "Sure, our intern can do it."

Oh my gosh, that was a crazy task! I built a fully functional QR code generator on pure SQL from scratch! It was very fun.

Check out Wikipedia [1]. They explain how QR codes work really well. Well enough to build your own generator.

I also used ZXing code [2], that Muzani shared below here, as a reference.

[1] — https://en.wikipedia.org/wiki/QR_code

[2] — https://github.com/zxing/zxing

Re:Ask HN: How are QR scanners written? by gt565k on Tuesday November 16, 2021 @04:47PM (#29246736)