Learn more on QR codes

Humans, machines and languages

In our language when two different people say the exact same words theyu never sound identical . As humans we have an innate ability to understand these voices without too much effort. On the other hand, machines have great difficulties understanding phrases from natural human voices. When I tried searching using Google’s voice search on my phone, a simple word like ‘Tiger’ was identified as  ‘Target’. Actually almost every word I tried was misinterpreted.

On the other side of the equation we have languages that machines understand and human simply cannot. One of the best examples for this is QR codes.

Below are five different QR codes. Four of them say ‘I love you’ and one of them says ‘I hate you’. Which is which? Don’t use your phone reader! See the problem – we have no clue.
The only thing we might see is that the rightmost two look extremely similar,so we can say that they probably say the same – nothing more!


Well truth is that the first four QR codes from the left say all ‘I love you’ while the last one says the opposite ‘I hate you’. Sad – we have no natural skills to handle this. This is a machine’s language after all, invented by people. In a sense we can say here what was once considered funny –‘We can write it, yes – but we cannot read it’.

The hidden masks

But wait a moment, why have four different ways to say the same thing? What benefit can come out of it– after all people invented this system.
Before answering this – let me put all the cards on the table. Here are four additional QR codes that say the same. Check it for yourself using your reader.

 It appears that QR codes have eight different masks. Every message has a unique naked form which is never seen by human eyes, simply because every QR code must come out with a mask!
The masks are not really known in wide public, mainly because nobody found any benefit in them. Originally they were created to make sure that the QR codes will be pretty. Beauty is in the eye of the beholder, and their creator defined beauty as having roughly  50% of the dots white and the other 50% black. The spec says something like – “try all the masks and the one which is closest to 50% for white and black is the one to put on your QR code”.
The word mask here is taken from its photography context, when it was used to put pieces of materials as masks to hide some parts of the image and expose other to light for printing. Masks are used here in a very similar way – to expose parts of the naked barcode and to hide (means invert color) of other parts.

Reality is that all readers will read any barcode with any of the eight masks without telling you anything about the mask. Practically it means all masks are legal and valid. Masks can have a value for us as people, marketers and customers; we will reach this later.

How masks and security are connected?

In our human world, masks and security may have a connection. Hiding behind a mask may provide some kind of secured feeling.
Not so in QR codes world. There is absolutely no connection between the two and they are totally independent.
I would like to first explain the technical meaning of security in QR codes (they actually have a non technical aspect of security as well).

A security level is actually a robustness level. Security level is also called -Error Correction level or shortly EC. It makes the QR code more resistant to hazards like stains, cracks in the paper they are printed on, horizontal lines on TV screens and more.

QR codes have 4 security levels which are:
Low – Permits around 7% of QR code data area to be corrupted
Medium – Permits around 15% corruption
Quality – Permits around 25% corruption
High – Permits around 30% corruption

Here are four QR codes containing ‘I love you’ each from another security level.

    Low 7%           Medium 15%   Quality 25%    High 30%

Security level is one of the magical things in QR codes. It is here to ensure that if a part of the QR code will be corrupted, it will be possible to reconstruct it again. For that you add to the original data another chunk of artificial data in such a way that every sub group of the combined data will be able to reproduce the remaining part of the combined data (given the erased data is not too large). This is called the Reed-Solomon algorithm named after the mathematicians who discovered this system in 1960.
It means that if you erase ANY part of the data within the permitted limit (like 30% for high above); the erased data can be retrieved completely.  This technology is the reason why many music CDs continue to play even when they have small scratches on their surface. By the way this same technology is hidden in all the hard drives of our computers as well.

How many ways to say ‘I love you’?

All this ends with the quite amazing fact that you can say ‘I love you’ (or anything else) in QR code language in 32 different visual ways, 8 masked QR for every of the 4 security levels.
If you consider ‘I LOVE YOU’ to be the same as ‘I love you’  (as URL does), than we have 64 different ways to say ‘I love you’ in QR code language.
Trust me; this is something that must be useful. I will share with you a few thoughts I have on how to use it in my next post. I am sure that other greater ways using this are lurking there silently in the world.

About eismann oreilly

Recently bumped into QR codes, that ignited my imagination. The more I learn about them the more potential and possibilities are unveiled. With some help from your imagination we may find ourselves in a new world...
This entry was posted in mask, QR codes, security level and tagged , , , . Bookmark the permalink.

4 Responses to Learn more on QR codes

  1. rogersmolski says:

    Interesting pov!

    One thing though – masking was not implemented to “make sure that the QR codes will be pretty”.

    Masking is there to ensure as far as possible that the data area does not contain alignment patterns that could confuse the scanner. Certainly an even distribution of white and dark modules improves reliability but it is just one of the factors used by the encoding algorithm in deciding which mask should be used.

    In theory every generator adhering to the specification should use the same mask for identical data (at the same ECL). However it is possible that there are QR Code generators that will produce every code with the same mask simply because the component of the algorithm for selecting the appropriate mask has not been implemented.

    • Thanks Richard.
      Roger – I was too poetic when talking about beauty, this of course is a “beauty” that has functionality, supposed to help readers- as you mentioned. To our luck all masks work pretty fine in this aspect. I could not find a QR code that went out really bad with a certain mask. On second thought, it might be interesting to search after one:)

  2. RobW says:

    Very interesting explanation on the technical side of QR codes. I see a lot of designers starting to “beautify” custom codes who would do well do read this & understand what goes into making codes readable by various scanning apps & phones. I’d bet most of the testing phase is done without any of this info.

    Looking forward to the next installment!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s