Computer

Did you know that it is possible to read QR codes without a computer or smartphone?

Did you know that it is possible to read QR codes without a computer or smartphone?

I QR codes they are a type of two-dimensional barcode that can store information both vertically and horizontally. They are composed of a matrix of dots (black squares on a white background) that represent data: texts, URLs (links), telephone numbers and other information. They have been increasingly used for some time for various reasons: they can be easily managed using devices such as smartphones or tablets equipped with a camera; read a QR code takes only a few seconds, making them a quick and effective tool for transferring information; they store a large amount of data compared to traditional linear barcodes and are very versatile.

The use of QR codes, in fact, is widespread in multiple contexts: they become tools for verifying tickets and boarding passes, for making digital payments, they are used as product labels, for advertising, for access to digital menus and so on. It is possible to use a QR code to share the WiFi password and you can also create these supports in Windows, with an overall rather simple procedure.

The web application “Reading QR codes without a computer“ takes stock of the “functioning” of QR codes, revealing all of them secrets. For simplicity, the discussion of the part relating to error correction is avoided, which would require the introduction of more complex concepts.

The basic structure of a QR code

Each QR code can have one dimension pre-established or composed of a certain number of modules (they retain 1 bit each). There version the smaller one is made up of 21×21 modules but it is possible to increase by 4 “cells” both horizontally and vertically to obtain larger QR codes.

At three of the four corners, there are the so-called Finder pattern, square shapes that allow scanners to more easily recognize the QR code (in red in the image below). The white line (in the figure it is highlighted in green) that surrounds the perimeter of the Finder pattern separates them from the actual information contained within the two-dimensional code.

Other graphic features that help QR code scanner I am Alignment pattern e Timing pattern: the former are completely absent in the 21×21 version while the latter (in orange) are horizontal rows and vertical columns that always alternate empty and full cells (white/black).

QR code structure

Mask pattern and error correction

Mask pattern ed error correction are two key concepts in QR codes: they contribute to their robustness and allow to correct mistakes. Il mask pattern is a predefined template applied to the data form of a QR code to improve readability and error detection. It serves to make the distribution of information more uniform, reducing the possibility of reading errors caused by repetitive patterns or from areas that are too homogeneous. There are 8 different ones mask pattern available.

The technique of error correction allows you to still read the information, even if part of the QR code is damaged or illegible. THE correction levels There are four errors available (L, M, Q, H), each of which offers a different degree of error tolerance. Higher levels require more error correction modules (at the expense of the volume of data that can be retained), but offer greater robustness.

The formatting informationstored both vertically and horizontally, summarize the use of mask pattern ed error correction (they are indicated in blue in the image published above).

Read a QR code without a computer and smartphone

Although it is theoretically possible to read a QR code without computers e smartphone it is a bit of a “provocation” because it requires carrying out a series of non-trivial steps. The idea, however, is to explain the iterative approach that devices equipped with a scanner follow QR codewhich can for example be formed by the coupling between a digital camera (like the one that equips smartphones and tablets) and an “ad hoc” application.

The first step is to look for information on mask pattern which is placed in a very specific position (in the image it is highlighted in yellow).

Codice QR: mask pattern

A black module corresponds to the value 1, a white module to the value 0. In the example, therefore, the mask pattern is equal to 110 which, with a conversion from binary code to decimal code, returns 6.

Converting mask pattern to decimal

The XOR operation on the graphic content of the QR code

We said previously that there are 8 different types of mask pattern. The value contained in the modules highlighted previously suggests the specific mask pattern to use (with a code ranging from 0 to 7). The mask pattern it must be overlaid on the original QR code by modifying the content of the data modules based on the color of the cell.

When the the black one of the mask pattern overlap with black cells of the original QR code, these become white. On the contrary, when the black cells of the mask pattern overlap with white cells of the original QR code, they turn black. Finally, when the white cells of the mask pattern overlap with white cells of the original QR code, they remain white.

The operation that is performed is an exclusive disjunction or XOR. The process, as mentioned above, helps to ensure a uniform distribution of the data in the QR code, improving readability and resistance to reading errors.

The 2×2 square in the lower right corner of the QR code returns information about coding, i.e. the type of information that the QR code contains. There are several coding modes: the most versatile is byte because it allows the storage of binary information. It is suitable for encoding text into format UTF-8coding that gives the way to represent special characters present in many languages.

Go to reading the data

The operation was successfully completed CHORUSyou can move on to the phase reading the data contained in the QR code. Data acquisition occurs starting from the bottom right corner and then proceeding “in a zigzag”. Obviously, you need to skip the containing areas Finder, Alignment e Timing patternformat information, and so on since these are areas that do not contain useful data. For the same reason, the contents of the first 2×2 cell which returns, as seen previously, the coding information must be excluded.

Reading data contained in the two-dimensional code

If you are dealing with a “codifica byte“, the content of the modules that make up the QR code must be acquired in groups of 8 (1 byte = 8 bits), moving from the bottom right corner and proceeding upwards. The first byte returns the length of the stringwhile from the second byte onwards the entire content of the QR code can be extracted, proceeding one character at a time.

XOR example

In the example in the figure, the QR code previously “XORato” starting from the correspondent mask pattern, has a “byte” value in the yellow box (bottom right). The first group of 8 bits (1 byte) corresponds to 00001100 (always reading from bottom to top), i.e. to the decimal value 12. It means that the QR code in question contains a string totaling 12 bytes long (in our case, the classic “Hello World!“).

The first group of 8 bits in blue (01001000) corresponds to the H in value hexadecimal i.e. the first character of the string Hello World!. Continuing vertically and to the left, the string will gradually form.

Codice ASCII QR code

Hexadecimal 48 corresponds precisely to ASCII code of the uppercase “H” character (check the HEX value, for example, on this page).

Generate any QR code

To experiment on your own, the web application available here allows you to create a QR code inserting the string specified by the user. All the images proposed below change accordingly to help each user study each specific case.

The same thing can be done by scanning any code existing and it is even possible to request the generation of QR codes starting from English terms generated in a completely random way.

Read QR code

The images of the QR codes published in the article are taken from “Reading QR codes without a computer“.

Leave a Reply

Your email address will not be published. Required fields are marked *

Computer

Did you know that it is possible to read QR codes without a computer or smartphone?

Did you know that it is possible to read QR codes without a computer or smartphone?

I QR codes they are a type of two-dimensional barcode that can store information both vertically and horizontally. They are composed of a matrix of dots (black squares on a white background) that represent data: texts, URLs (links), telephone numbers and other information. They have been increasingly used for some time for various reasons: they can be easily managed using devices such as smartphones or tablets equipped with a camera; read a QR code takes only a few seconds, making them a quick and effective tool for transferring information; they store a large amount of data compared to traditional linear barcodes and are very versatile.

The use of QR codes, in fact, is widespread in multiple contexts: they become tools for verifying tickets and boarding passes, for making digital payments, they are used as product labels, for advertising, for access to digital menus and so on. It is possible to use a QR code to share the WiFi password and you can also create these supports in Windows, with an overall rather simple procedure.

The web application “Reading QR codes without a computer“ takes stock of the “functioning” of QR codes, revealing all of them secrets. For simplicity, the discussion of the part relating to error correction is avoided, which would require the introduction of more complex concepts.

The basic structure of a QR code

Each QR code can have one dimension pre-established or composed of a certain number of modules (they retain 1 bit each). There version the smaller one is made up of 21×21 modules but it is possible to increase by 4 “cells” both horizontally and vertically to obtain larger QR codes.

At three of the four corners, there are the so-called Finder pattern, square shapes that allow scanners to more easily recognize the QR code (in red in the image below). The white line (in the figure it is highlighted in green) that surrounds the perimeter of the Finder pattern separates them from the actual information contained within the two-dimensional code.

Other graphic features that help QR code scanner I am Alignment pattern e Timing pattern: the former are completely absent in the 21×21 version while the latter (in orange) are horizontal rows and vertical columns that always alternate empty and full cells (white/black).

QR code structure

Mask pattern and error correction

Mask pattern ed error correction are two key concepts in QR codes: they contribute to their robustness and allow to correct mistakes. Il mask pattern is a predefined template applied to the data form of a QR code to improve readability and error detection. It serves to make the distribution of information more uniform, reducing the possibility of reading errors caused by repetitive patterns or from areas that are too homogeneous. There are 8 different ones mask pattern available.

The technique of error correction allows you to still read the information, even if part of the QR code is damaged or illegible. THE correction levels There are four errors available (L, M, Q, H), each of which offers a different degree of error tolerance. Higher levels require more error correction modules (at the expense of the volume of data that can be retained), but offer greater robustness.

The formatting informationstored both vertically and horizontally, summarize the use of mask pattern ed error correction (they are indicated in blue in the image published above).

Read a QR code without a computer and smartphone

Although it is theoretically possible to read a QR code without computers e smartphone it is a bit of a “provocation” because it requires carrying out a series of non-trivial steps. The idea, however, is to explain the iterative approach that devices equipped with a scanner follow QR codewhich can for example be formed by the coupling between a digital camera (like the one that equips smartphones and tablets) and an “ad hoc” application.

The first step is to look for information on mask pattern which is placed in a very specific position (in the image it is highlighted in yellow).

Codice QR: mask pattern

A black module corresponds to the value 1, a white module to the value 0. In the example, therefore, the mask pattern is equal to 110 which, with a conversion from binary code to decimal code, returns 6.

Converting mask pattern to decimal

The XOR operation on the graphic content of the QR code

We said previously that there are 8 different types of mask pattern. The value contained in the modules highlighted previously suggests the specific mask pattern to use (with a code ranging from 0 to 7). The mask pattern it must be overlaid on the original QR code by modifying the content of the data modules based on the color of the cell.

When the the black one of the mask pattern overlap with black cells of the original QR code, these become white. On the contrary, when the black cells of the mask pattern overlap with white cells of the original QR code, they turn black. Finally, when the white cells of the mask pattern overlap with white cells of the original QR code, they remain white.

The operation that is performed is an exclusive disjunction or XOR. The process, as mentioned above, helps to ensure a uniform distribution of the data in the QR code, improving readability and resistance to reading errors.

The 2×2 square in the lower right corner of the QR code returns information about coding, i.e. the type of information that the QR code contains. There are several coding modes: the most versatile is byte because it allows the storage of binary information. It is suitable for encoding text into format UTF-8coding that gives the way to represent special characters present in many languages.

Go to reading the data

The operation was successfully completed CHORUSyou can move on to the phase reading the data contained in the QR code. Data acquisition occurs starting from the bottom right corner and then proceeding “in a zigzag”. Obviously, you need to skip the containing areas Finder, Alignment e Timing patternformat information, and so on since these are areas that do not contain useful data. For the same reason, the contents of the first 2×2 cell which returns, as seen previously, the coding information must be excluded.

Reading data contained in the two-dimensional code

If you are dealing with a “codifica byte“, the content of the modules that make up the QR code must be acquired in groups of 8 (1 byte = 8 bits), moving from the bottom right corner and proceeding upwards. The first byte returns the length of the stringwhile from the second byte onwards the entire content of the QR code can be extracted, proceeding one character at a time.

XOR example

In the example in the figure, the QR code previously “XORato” starting from the correspondent mask pattern, has a “byte” value in the yellow box (bottom right). The first group of 8 bits (1 byte) corresponds to 00001100 (always reading from bottom to top), i.e. to the decimal value 12. It means that the QR code in question contains a string totaling 12 bytes long (in our case, the classic “Hello World!“).

The first group of 8 bits in blue (01001000) corresponds to the H in value hexadecimal i.e. the first character of the string Hello World!. Continuing vertically and to the left, the string will gradually form.

Codice ASCII QR code

Hexadecimal 48 corresponds precisely to ASCII code of the uppercase “H” character (check the HEX value, for example, on this page).

Generate any QR code

To experiment on your own, the web application available here allows you to create a QR code inserting the string specified by the user. All the images proposed below change accordingly to help each user study each specific case.

The same thing can be done by scanning any code existing and it is even possible to request the generation of QR codes starting from English terms generated in a completely random way.

Read QR code

The images of the QR codes published in the article are taken from “Reading QR codes without a computer“.

Leave a Reply

Your email address will not be published. Required fields are marked *