qr code encoding http://obooij.home.xs4all.nl/nerdspul

messing with qr codes

QR codes are ugly. It should be possible to make coding schemes that result in nicer looking images that contain "scannable" information. Nevertheless, it seems we are going to be stuck with QR codes for a while.

idea to make qrs nicer

I tried (and failed...) to make nicer looking QR codes. Now we have pseudo-randomly formed QR codes that point to nicely formed web addresses (url). For example the one above points to http://obooij.home.xs4all.nl/nerdspul. My idea was to make a nicer looking QR code that points to a pseudo-randomly formed web address. This web addresses would just be a redirect to the actual website I want to advertise.

failed attempt

I downloaded software to encode (text to images) and decode (images to text). For encoding I chose libqrencode. For decoding I first tried libdecodeqr. However, it couldn't decode all qr codes. For example, if I input the version 10 qr code example from wikipedia as png, it returns STATUS=2089 and no output. I switched to zbar for decoding which did work.

Then I tried to change the appearance of some qr codes and see how this would change the text encoded in them. However, I found out that the text is coded multiple times in a single qr-code using so called "error-correction" code. If you change some of the image, the decoder finds the same text. After a certain number of changes the image just fails to decode, because there is not enough error-correction. This might, of course, depend on the used decoder, but I expect this is the case for most of them. This makes it quite difficult to make a nice bitmap that decodes into a strange web address.

partly succeeded attempt

Then I tried to do it the other way around: changing the text to see how the image changes. In this way there is always a well-formed url, but it is difficult to get the image we want. I implemented a small library (qrsmurrie) based on genetic algorithms that tries to find a text string that results in a certain target qr-code close to a target image. The code can be downloaded here (public domain).

The following is a first result I obtained. On the left I tried to learn a qr-code that was a white as possible and on the right as black as possible:

white qr black qr

This seems promising, but I got bored tuning the parameters of the genetic algorithm (cross-over-, mutation-rate, etc.).