3 ms·
> 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 p
by 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.