3 ms·
Using https://duckduckgo.com/?q=qrcode%20decode%20by%20hand https://duckduckgo.com/?q=qrcode%20decode%20by%20hand gives me a number of results like http://blog
by jcynix 1y ago
Using https://duckduckgo.com/?q=qrcode%20decode%20by%20hand https://duckduckgo.com/?q=qrcode%20decode%20by%20hand gives me a number of results like
http://blog.qartis.com/decoding-small-qr-codes-by-hand/ http://blog.qartis.com/decoding-small-qr-codes-by-hand/
https://beck-thompson.github.io/QRcodewebsite/ https://beck-thompson.github.io/QRcodewebsite/
Reading QR codes without a computer! https://qr.blinry.org/ https://qr.blinry.org/
And then there are a number of OSS implementations for Android (check fdroid.orgl, Debian/Ubuntu, etc. Maybe study the code?
- mananaysiempre 1y agoThat’s not what I’m asking about: once you’ve found the QR code in the bag of pixels you got from your camera and converted it to a boolean array of module colours, then yes, all you have left is a bit error-correction math and some amusingly archaic Japanese character encoding schemes—definitely some work, but ultimately just some work. (For that matter, the Wikipedia article on QR codes contains enough detail to do this.) What has thus far remained a mystery to me is going from a bag of noisy pixels with a blurry photo of a tattoo on a hairy arm surrounded by random desk clutter to array of booleans. I meant “by hand” as in “without libraries”, not “using a human”, as in the latter case the human’s visual cortex does the interesting part! And the open-source Android apps that I’ve looked at just wrap ZXing, which is huge (so a sibling commenter’s suggestion of looking at a different, QR-code-specific library is helpful).
- jcynix 1y ago> What has thus far remained a mystery to me is going from a bag of noisy pixels [...] to array of booleans. Ah, OK. You can use software like ImageMagick to partition images into levels of gray or just black and white. I have some examples somewhere I played with some time ago, but not accessible online right now, sorry. If the contrast of the original image is high enough, just the qrcode would remain to be parsed.
- jcynix 1y agoHere's an example to start with: ImageMagick's -threshold or -adaptive-threshold (depending on the image's lighting) are what you want to look at, e.g. try something like magick input.jpg \ -colorspace Gray \ -adaptive-threshold 8x8+10% \ candidate.png
- edoceo 1y agoAnd if you wanna go even lower, you'll "raw" read the image pixel by pixel to normalise colour to black/white and then read that matrix for the QR pattern. And then, cause there are some inverted colour QRs, flip and scan again.
- dimatura 1y agoYou can examine the code of zxing-cpp (which is fairly nice IMO) for a simple, "classical computer vision" approach to this. It's not the most robust implementation but it is pretty functional. But in general, you can divide the problem more or less like this (not necessarily in this order) 1. find the rough spatial region of the barcode. Crop that out and only focus on this 2. Correct ("rectify") for any rotation or perspective skew of the barcode, turn it into a frontoparallel version of the barcode 3. Binarize the image from RGB or grayscale into pure black and white 4. Normalize the size so that each pixel is the smallest spatial unit of the barcode.