6 ms·
Creating a QR Code step by step
- tazard 8y agoThanks! That was really interesting. This is the first time I have found the processes broken down in a way I can easily follow
- robin_reala 8y agoA while ago I found a generator that took an image and a text and tried to use a genetic algorithm to evolve a QR code that looked like (a 2-bit dither of) the image. Unfortunately I’ve since lost the link, but I was quite impressed that it managed to generate a QR code for my then-employer’s URL that looked like their logo. Impressive what’s possible with a lot of error correction.
- magnat 8y agoHere is a paper and demo describing creation of such codes: http://vecg.cs.ucl.ac.uk/Projects/SmartGeometry/halftone_QR/halftoneQR_sigga13.html http://vecg.cs.ucl.ac.uk/Projects/SmartGeometry/halftone_QR/... Sadly, original online demo doesn't work anymore, but by looking for "halftone qr code" you'll find plenty of alternative implementations like this: http://jsfiddle.net/lachlan/r8qWV/ http://jsfiddle.net/lachlan/r8qWV/
- luisrudge 8y agoThanks amazing. Thanks! I always wondered how companies create their own type of QR-code. Anyone has any idea how something like this can be built? https://i.imgur.com/wtxZDdh.png https://i.imgur.com/wtxZDdh.png
- xhruso00 8y agoMessenger codes: https://itunes.apple.com/us/app/scan-code-editor-for-messenger-codes/id1148316864?mt=12 https://itunes.apple.com/us/app/scan-code-editor-for-messeng...
- nayuki 8y agoPlease don't call these QR codes; they are simply proprietary 2D barcodes (respectively Facebook Messenger and Snapchat). The Snap code looks like a 18×18 grid of dots with the center punched out. This probably conveys about 200 bits of information. I suppose that could encode 30 ASCII characters which should be enough to describe a unique username. Or maybe it is a random binary number that is an opaque user ID in Snapchat's database. Either way, I'm guessing that the graphics and algorithm are a trade secret, so you can't get a definitive truth on how these barcodes are generated. The Messenger code seems hard to analyze because of its different bar lengths and circular layout. The four bulls-eye patterns remind me of QR alignment patterns. I have no idea what the information-theoretic capacity is, but I'll guess it's in the order of magnitude of 500 bits. Again, I suspect the algorithm is not available to the public. As for Spotify Codes, I discussed them in https://www.reddit.com/r/programming/comments/9th8a7/creating_a_qr_code_step_by_step/e8wdq5l/ https://www.reddit.com/r/programming/comments/9th8a7/creatin... .
- fit2rule 8y agoThat is really a brilliant web page, and the interaction of the data and the text is also very fascinating .. seems to have a brettvictor-like effect, I no longer felt like I was viewing a web page but rather an interactive document that was teaching me something technical while allowing me to explore the subjects edge cases .. Nice!
- tln 8y agoThis is fantastic. From this, I learned that making your URLs uppercase makes for a more compact code! The links at the bottom are great reads as well, especially: https://research.swtch.com/qart https://research.swtch.com/qart I hope that QR codes become more widely used, now that iOS and Android both include QR capabilities directly in the native camera apps.
- giobox 8y agoQR codes have their uses, but I can’t stand when they are placed on billboards as a link to more info. A simple URL I can read and remember for later, good luck memorising a QR code. I’ve seen too many obvious examples of a marketing team getting carried away and abusing these things. The most absurd one was on a police notice on the London Underground advising people to take care to hide their valuables from thieves. How could you find out more? By taking your 800 dollar valuable out to scan the QR code...
- erichurkman 8y agoThat's because in the West, marketers at best tried to replicate CueCat [0] with QR codes. QR codes are infinitely more useful if tied with an action from the real world -> digital world: scan this QR code to pay for this item; scan this name tag to get my full contact card; etc. [0] https://en.wikipedia.org/wiki/CueCat https://en.wikipedia.org/wiki/CueCat
- dwohnitmok 8y agoVisit China to see a cornucopia of QR codes. Everything there is QR codes. Almost all payment is done through scanning a QR code (even tiny stands by the side of the road). Public transportation is accessed through QR codes. Adding people on social networks is done through QR codes. Some restaurants don't even have menus and you access their menu via a QR code (and of course pay again through the same). QR codes everywhere.
- nayuki 8y agoIronically in China the popular name for QR Codes is 二維碼 (literally "2D code"). This is disappointing because there are other types of 2D barcodes (Data Matrix, Aztec, PDF417, etc.) and because it fails to acknowledge the QR brand.
- classichasclass 8y agoActually, I kind of hoped he would show the computation of the Reed-Solomon codes, or at least had a popout for it if it would have made the page too long.
- akalin 8y agoYou might be interested in https://www.akalin.com/intro-erasure-codes https://www.akalin.com/intro-erasure-codes
- classichasclass 8y agoAh, excellent. Thank you both.
- masklinn 8y agoThe author has that in an other article: https://www.nayuki.io/page/reed-solomon-error-correcting-code-decoder https://www.nayuki.io/page/reed-solomon-error-correcting-cod...
- kragen 8y agoHe who?
- nayuki 8y agoIf I think it's interesting enough, I might implement separate interactive web pages to explain both the finite field arithmetic and the Reed-Solomon encoder LFSR. But if you look at these existing materials, I hope you agree with me that RS ECC encoding is long and tedious: * https://www.embeddedrelated.com/showarticle/1182.php#c-implementation https://www.embeddedrelated.com/showarticle/1182.php#c-imple... * https://www.reddit.com/r/programming/comments/9th8a7/creating_a_qr_code_step_by_step/e8x3yp9/ https://www.reddit.com/r/programming/comments/9th8a7/creatin... * https://www.backblaze.com/blog/reed-solomon/ https://www.backblaze.com/blog/reed-solomon/ * https://en.wikiversity.org/wiki/Reed%E2%80%93Solomon_codes_for_coders https://en.wikiversity.org/wiki/Reed%E2%80%93Solomon_codes_f...
- lisper 8y agoAwesome! Now, how do I read a QR code?
- nayuki 8y agoSee: https://www.reddit.com/r/programming/comments/9th8a7/creating_a_qr_code_step_by_step/e8x20ck/ https://www.reddit.com/r/programming/comments/9th8a7/creatin... ; https://www.youtube.com/watch?v=KA8hDldvfv0 https://www.youtube.com/watch?v=KA8hDldvfv0
- lisper 8y agoYeah, that's not quite what I meant. Once I have the QR-code's pixel map, decoding that is easy. What I don't know how to do is to recover the pixel map from an image without knowing the scale, orientation, and viewing angle.
- tekromancr 8y agoI think that's the purpose of the finder patterns. From a Source image I imagine you would locate the finders, find the edges, unskew the source image, and use the finders to correct the rotational orientation, and then crop the image. Maybe binarize the new image to make the next step easier. At that point, it's a matter of working out the size of each cell to generate a grid to drop on top of the image. Then you can sample each cell of the grid. If it's light, 1. If it's dark 0. Now you have the pixel map. I am sure it's more complex, but I think a lot of this sounds like stuff you could do with openCV
- deleted 8y ago[deleted]
- 0898 8y agoA guy I know ran IT for a London borough's libraries. Part of his job was to generate QR codes to go on various posters, stands and literature. He generated hundreds of them. Recently, he checked how many times they'd been scanned by a member of the public. It was zero.
- tomwilson 8y agoIt’s weird how in China QR codes are basically ubiquitous and yet the rest of the world basically ignores them. The difference as far as I can tell is WeChat, which basically everyone has, has great QR code support built in iOS has great integration built in now to the camera app which should help, but android is still spotty.
- otachack 8y agoAndroid is terrible. The best thing to do is piggy back zebra crossing's open source app and integrate it directly into the app. But as for a general use scanner, Android still depends on the user to download a external app. Motorola has it built into their camera app but I feel users don't know and don't reach out for it on reflex. Google has their own solution but it is the stupidest, roundabout way of using it where the host app has to dynamically download the library that has the necessary barcode scanning.
- Severian 8y agoHmm, interesting, Moto Camera automatically detects and provides the QR code text/info. I guess I took it for granted and thought it was stock Google photo app.
- m-p-3 8y agoIf Google was serious about them, they'd make some baseline support for QR code the camera app must support out of the box and provide a standard library to use it. Just looking at how many QR code reader apps are on the Play Store, and how many of them request a ton of unnecessary permission is downright scary. The same thing happened with flashlight app before the feature was introduced in stock Android.
- rubenbe 8y agoI often use QR codes to quickly transfer long URLs etc from my PC to my phone. In the commandline you can run "qrencode --type UTF8 -o - <text>" and get a pure text-only QR code.