QR Codes Variety – Part One

Benefits of variety

After we saw that there are at least 32 different QR codes that say any specific sentence or text, the question that pops up is – is there any advantage or benefit that we can derive from this fact?

Variety by nature has the following advantages:
1- Choice; you can choose the one that mostly suits your needs.
2- Identification; different look enables identification of one individual from another.
3- Functionality; different look means different characteristics that often translates to different abilities.
4 – Rich variety sometimes calls for reduction; in that case groups of members with similar characteristics are formed, at least in mind.

Let’s see how these advantages apply to the QR codes world.

Choosing the right QR code

Even if all you need is printing a black and white QR code, in most cases the printed QR code size matters.  In most cases the smaller the version of the QR code the better. This is where few words on QR code versions are needed.

Apart from masks and security levels, QR code comes in several sizes, called versions. QR codes are extendable; it means that as you add more text into them, they will grow. The smallest version that can contain only few words is called version 1. It contains 21×21 modules (a module is a small black or white square – one of the many that composes the code). There are 40 different versions of QR codes. Every version adds additional four modules in every direction – so version 2 has 25×25 modules (and more data) and so on until version 40 (177×177 modules) which can contain 2,953 characters, this can be a sufficient quantity of binary data to include a short ringtone!
Every version has four security levels and every security level has eight possible masks.

Now as you may remember from the ‘I love you’ QR codes when we looked at the different security levels we had the following example.

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

Do you note that the QR code with the high security level is bigger? Actually the first three are all version 1- 21×21 boxes on each dimension. The last one is version 2 – 25×25 boxes. It will take more space on print and if you will scale it to the size of the others every module in it will be smaller (and hence might be more difficult for readers to decode it).
So the rule here is to take the code with highest possible security level without growing up in version. In our example the best is the Quality level QR code (25%).

Why is it good to take the highest available security level without growing on size? It is the easiest QR code for readers to read. Not all readers are equal and while some readers will be able to read corrupted codes with low security levels, others will not. The more security you add to your QR code the more supported by readers it becomes. It will survive corruption that might come from poor camera focus in certain devices. It will better stand stains, scratches and humidity and it takes exactly the same area on print that the ones with lower security.

 

Choosing the right QR code for Designers

What if you want to put some art into your QR code? Let’s say you put some color and you want to add your logo or a nice picture on the QR code. This is where the security level starts to play its part. This is the kind of situation where you would like to compromise and take the higher version of QR code for getting the highest available security. We must remember that as pretty as the image might be, it is a hindrance for the QR code reader.

Let’s start with a high security level QR code -30% of its data can be corrupted.

The red colored parts of this QR code do not contain any data. The three red patterns at the corners are called finders or finder patterns, and are a part of every QR code. They never contain any data.
The smaller red pattern close to the other corner (right bottom corner) is called a guide pattern, and also never contains any data. These are patterns that exist to help the reader to detect the QR code on the image.
The other two red comb-like lines are called time lines. They do not contain any data either, and are there to help readers detect the version of the QR code.
Almost all other modules not in the red areas, contain the actual data in the QR code.
When we say 30% of the data area we refer to this area and not 30% of the area of the whole QR code!

 

Where are the guaranteed 30% of data corruption?

How do I calculate 30% of data area?
First do not count pixels; what should be counted are modules – boxes. It is much simpler.

How many modules of data do we have in our example?
This QR code is of version 3 – so we have here 29×29 = 841 modules.
Removing the three finder patterns which are always at size of7x7 modules in every version, (the white space that surround them make each of them 8×8), we have
841 – 8x8x3 = 649 modules.
Removing the alignment pattern which is always 5×5 modules, we have 649-25 = 624 modules.
Removing the time lines which are 29-8×2 = 13 each (8 modules is the width of every finder pattern including its surrounding space).
We have two lines like this – so we are left with 624-13×2 = 598 modules.

The format info area is 31 modules for every version. This is where the mask we used is encoded so that readers will know to unmask them before decoding the code.

Here is the QR code – the green encircled areas are the areas of the format info. This is their locations in all versions.

The version info adds additional 36 modules and exists only in versions between 7 and 40.
In our case (version 3) we have only the 31 modules of format info, which leave us with 598-31 = 567.
This is our data area!

To save you from calculating data and possible corruption areas for every version, here is a table for all versions from 1 to 10.

30% from our data area (567 modules) are 170 modules. I took out from our original QR code a rectangle of size of 17×10=170 modules.

30% corruption

Now try to read this with your favorite reader – good chances that no reader can read this. So where is the promised 30% area corruption?

Let’s take another step – 27% of area corruption. This is 153 modules – let’s take out a rectangle with an area of 150 boxes (15×10).

27% corruption

Again you can try your reader probably to no avail. Although 30% of data corruption is promised – no reader can read a QR code with 27% of data corrupted.

Going down – let’s try below the 25% area corruption – an erased rectangle of size 14×10 with area of 140 modules.

25% corruption

Here too no reader I know of can read this. We are in a 30% data security level with an image of less than 25% of data corrupted and still no reader can read this!
Let’s go down to 22% of data corruption – 126 modules erased in a box of 14×9 modules.
I added to this another one with 17% of data corruption (100 modules missing) below.

               22% corruption                                                  17% corruption

We are now at 22% of data corruption in a QR code with 30% data corruption guaranteed! Let’s see how many readers can read this. I chose here few familiar readers in case you find a reader not in the list that is worth trying, please let me know and I will add it. Note this was checked with iPhone readers.

So we see that although 30% are promised, only 22 percent are guaranteed with the good readers while 17% has better chance, promising a greater number of readers that will be able to read your code.

Real data corruption

But wait a minute, the data in the missing rectangles was not totally corrupted, it was blanked. A totally corrupted data is when every white module turns black and every black module turns white. This is the real test for robustness.
So let’s take a look at the 22% and 17% examples and see how much security do we really have?
In the images below the same boxes of 22% and 17% are totally corrupted, meaning inversed.

         22% of maximum corruption                          17% of maximum corruption

Security levels and reality

As we saw the 30% area that security level promises us for our playground is actually more around 22%-17% in reality. The same holds for lower security levels.
What is the reason for this?
Well the reason hides into the complex math of the specific implementation of the Reed-Solomon algorithm. We will not delve into this in this forum. The important thing for us to know is that we actually have less area for playground than the spec promises.

However reality is sweeter than this. This is where the rich variety of QR codes may enter into play in the world of QR designers. Choosing the right mask for your QR code may enable you, after all, to reach very close to the promised 30% and sometimes even more.
I promise to focus on this in my next post.

Advertisements

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 designed QR codes, mask, QR codes, security level and tagged , , , , . Bookmark the permalink.

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 )

Twitter picture

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

Facebook photo

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

Google+ photo

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

Connecting to %s