How does a QR code work?

Any scanner does the same.
Where can I find the decryption of ST00011, ST00012?

Not decrypted. Trim do not Trim, you still get failed.

there are QR codes-application that do the decryption themselves and all this in one phone, and not like yours. And in general, you are all confused.

Crop a picture is possible in many programs. In the same galleries for photos. For example, on my smartphone, I click on an open photo, a pencil icon appears below, click on it and various editing options appear. Although some ””” code scanners have trimming options

First of 4 services in Yandex search results that decoded the SBP code

Everything works great, great site, thanks!) I needed a Google authenticator on a PC, but there is no desire to sit with the phone).

I don’t know, it decodes most qr codes for me, but sometimes it needs to be cut off, but “Failed” rarely gives out. If it gives an error, then I’m already decrypting using the phone’s camera.
Maybe you forget to press the “Decrypt code” button?

I couldn’t decipher either. The idea is in demand, but it is worth reworking the algorithms.

Nothing works. I cropped the picture, leaving only the QR code. Doesn’t define anything.

Everything works. The first commentator is lying

Decryption does not work

Try cropping the picture.

Good night. Thank you for your advice. But I’m not very good at terms, please explain “crop picture”

Aspose QR Code Scanner is a free online application to read QR codes from your mobile phone’s image or camera. It is capable of finding and reading multiple barcodes on an image. Our sophisticated algorithm allows even corrupted barcodes to be read. The QR code scanner supports many different input formats (PNG, JPEG, BMP, GIF).

This free app is provided by Aspose. BarCode

Also see our Cloud API

FREQUENTLY ASKED QUESTIONS

How does a QR code work?

How does a QR code work?

How to scan a barcode

How does a QR code work?

Upload an image, select the type of barcode and click on the “Scan barcode” button.

How does a QR code work?

The app works on any platform including Windows, Mac, Android and iOS. All files are processed on our servers, installation of third-party software is not required.

Powered by Aspose. barcode. All files are processed by the Aspose libraries, which are used by many Fortune 100 companies in 114 countries.

Popular barcode types

You can also scan many other types of symbols.

How long is a QR code valid?

QR code does not expire. Think of a QR code as a container that stores the information that has been put into it. A sheet of paper with a QR code can get dirty and damaged, a hard drive that stores a digital image of your QR code can break. But although the QR code is readable, it contains the same data it was originally encoded with. But instead of the information itself, a QR code can encode a URL that leads to a page with some specific information. This link may expire, the page has disappeared, or the information on the page may change or become out of date. In this case, you can say that the QR code has “expired”.

Do QR codes contain personal information? Is my data safe?

QR codes contain exactly the information they are asked to encode. If you have a piece of paper with a printed QR code, it does not contain additional information. However, if you take a photo of the QR code with your smartphone, there is nothing to prevent your phone from attaching any personal data to the photo, such as your name, address, or any other information that it can get from your phone. If you have a personal passport/vaccination certificate, it may contain some personal information that you may want to keep private. But most likely not. Q The R-code in the vaccine certificate usually contains only a link to an external page, and the data on this page is usually anonymised. Visit the local government website or you can check what is encoded in your QR code with the Aspose scanner. Barcode

What information can I encode in a barcode?

Usually these are letters and numbers. Some barcodes also allow a specific set of special characters or all ASCII characters. The information encoded in a barcode is usually some description of the item on which the barcode is placed.

How small can a barcode be?

The barcode can be quite small. For example, 1×1 cm for a 2D barcode. But a smaller barcode can encode less information. And you also need to use a higher resolution printer.

How much data can a barcode contain?

Typically around 25 characters for a 1D barcode and around 2000 for a 2D barcode. Of course, the more characters you encode, the larger the barcode will be. A 1D barcode can become impractically wide if it encodes more than 15 characters.

In this article, we will show you how to read a QR code using a browser, app, Windows PC, and manually.

How to read QR code without app

If you don’t have a QR code reader app, you can still decipher those obscure black and white squares. And the easiest way to do this is to use a dedicated website.

How does a QR code work?

QR Code Reader Online

How to read a QR code using a smartphone

The easiest way to read QR codes is to use a smartphone with a special application installed.

How to read QR codes on Windows PC

How to read QR codes on a computer or laptop is detailed in our related material. Here you need a webcam to scan the barcode.

How to decode QR code manually

Interestingly, a QR code can be decoded without a scanner at all. You just need to know what QR is and how it works: its structure, functions and individual elements. Detailed information about this method can be found in our article.

How does a QR code work?

Editor of directions “Mobile devices” and “Home appliances”

Was the article interesting?

Decrypting a QR code without a scanner

How does a QR code work?

Decrypting a QR code without a scanner

Did you decipher the QR code?

Correct answer: in our example (see the picture above), the word “Heureka!” is encrypted with a QR code. (German: “Eureka!”). You can read about what exactly the individual elements mean in the photo gallery below. If right now you want to quickly and easily create a QR code yourself, for example, this utility will help you.

How does a QR code work?

Sometimes there are situations when you need to read a QR code, but there is no smartphone at hand. What to do? The only thing that comes to mind is to try to read it by hand. If anyone has encountered such situations or who is just wondering how a QR code is read by machines, then this article will help you understand this problem.

The article discusses the basic features of QR codes and the method of deciphering information without the use of computers.

Illustrations: 14, symbols: 8 510.

For those who do not know what a QR code is, there is a good article in the English Wikipedia. You can also read a thematic blog on Habré and several good articles on related topics that can be found by searching.

Let’s consider the solution of the problem of direct reading information from a QR-image using two codes as an example. The information was encoded in the online generator QR Coder.ru.

How does a QR code work?

To understand how to extract data from the code, you need to understand the algorithm. There are several standards in the QR code family, their basic principles can be found in the specifications. Briefly explain: the data to be encoded is divided into blocks depending on the encoding mode. A header indicating the mode and number of blocks is added to the data divided into blocks. There are also modes that use a more complex structure of information placement. We will not consider these modes because it is inexpedient to manually extract information from them. However, based on the principles described below, it is possible to adapt to these modes.

In case of incorrect data reading, special codes are used in QR that can correct reading errors. These are the so-called Reed-Solomon codes. We will not consider the principle of calculating codes, as well as correcting errors in information blocks, this is the topic of a separate article. Error-correcting Reed-Solomon (RS) codes are written after all information data. This greatly simplifies the task of directly reading information: you can simply read the data without touching the codes. As practice shows, usually most of the QR matrix is ​​occupied by corrective RS codes.

According to the standard, data with RS codes are “mixed” before being written to the picture. For these purposes, special masks are used. There are 8 algorithms, among which the best one is chosen. The selection criteria is based on a system of penalties, which can also be read about in the specification.

“Jumbled” data is recorded in a special sequence on a template picture, where technical information for decoding devices is added. Based on the described algorithm, we can distinguish a scheme for extracting data from a QR code:

How does a QR code work?

Here, with a green felt-tip pen, points that will need to be completed when directly reading the code are underlined. The remaining items can be omitted due to the fact that the reading is performed by a person.

Step 0. Q R code

How does a QR code work?

Looking at the pictures, you can see several distinct areas. These areas are used to detect the QR code. These data are of no interest from the point of view of recorded information, but they need to be crossed out or just memorized their location so that they do not interfere. The rest of the code field contains useful information. It can be divided into two parts: system information and data. There is also code version information. The maximum amount of data that can be written to the code depends on the version of the code. When the version is upgraded, special blocks are added, for example, like here:

How does a QR code work?

You can use them to navigate and understand which version of the QR is in front of you. Higher version codes are also usually not practical to read manually.

Placement of system information is shown in the figure:

How does a QR code work?

The system information is duplicated, which greatly reduces the possibility of errors in code detection and reading. System information is 15 bits of data, among which the first 5 are useful information, and the remaining 10 are BCH(15,5) codes that allow you to correct errors in system data. RS codes also belong to the class of BCH codes. Please note that in the figure, two strips of 15 bits do not intersect.

Step 1. Read 5 bits of system information

As already mentioned, only the first 5 bits are of interest. Of which 2 bits indicate the level of error correction, and the remaining 3 bits indicate which of the available 8 masks is applied to the data. In the considered QR codes, the system information contains:

How does a QR code work?

Step 2 System Information Mask

In addition to the already announced schemes for protecting system information, in addition, a static mask is used, which is applied to any system information. It looks like: 101010000010010. Since only the first 5 bits are of interest, the mask can be shortened and easily remembered: 10101 (ten – one hundred and one). After applying the “exclusive or” (xor) operation, we obtain information.

Possible error correction levels:

How does a QR code work?

Step 3: Read the Data Header

To understand what data to deal with, you must first read the 4-bit header, which contains information about the mode. The specifics of reading data is shown in the picture:

How does a QR code work?

List of possible modes:

Step 4 Applying a Mask to the Title

After extracting 4 bits describing the mode, it is necessary to apply a mask to them.
In our case, different masks are used for the two codes. The mask is determined by the expression given in the table above. If this expression is reduced to TRUE (true) for a bit with coordinates (i, j), then the bit is inverted, otherwise everything remains unchanged. The origin is in the upper left corner (0,0). Looking at the expressions, you can see patterns in them. For the considered QR codes, the masks will look like this:

How does a QR code work?

How does a QR code work?

How does a QR code work?

Step 5: Read Data

After receiving the mode data, you can start reading the information. It must be said that it is most interesting to read numeric and alphanumeric data, since they are easily interpreted. But also do not be afraid of 8-bit. It can also be easily interpretable information. For example, many online QR text generators encode in this mode using ASCII. Another reason why you should initially read the mode is that the number of data packets depends on it. Which also depends on the version of the code. For versions one through nine block lengths for more readable modes:

The first block after the mode indicator is the number of characters. For numeric mode, the quantity is encoded in the next 10 bits, and for 8-bit mode, in 8 bits (sorry for the tautology).

How does a QR code work?

How does a QR code work?

The figure shows that all 4 packages are ASCII codes of Latin letters that form the word “habr”

Naturally, the best way is to take your phone out of your pocket and, pointing the camera at the QR-picture, read all the information. However, in emergency cases, the described technique may come in handy. Of course, you can’t keep in your head all the indications of modes and types of masks, as well as ASCII characters, but you can remember popular combinations (at least those discussed in the article).

Specification

BS ISO/IEC 18004:2006. information technology. Automatic identification and data capture techniques. Q R Code 2005 bar code symbology specification. London: B.S.I. 2007. p. 126. I SBN 978-0-580-67368-9.

P. S. Follow the terms and conditions of the resource Creative Commons Attribution 3.0 Unported (CC BY 3.0)

P. P. S. If I made a mistake with the blog, then tell me where – I will transfer it.

Time to read

Introduction

This article is the first in a series of articles in which we will understand how a qr code works and write a simple qr detector and decoder, as well as our own qr code generator.

We will use python along with opencv and numpy. Given that opencv is a cross-language library, and that working with an image / texture in different solutions looks about the same, I think that you can easily translate the algorithm that will be written here into any language you need

First of all we will consider the full size qr code, Micro-qr will probably be considered after the full size qr is completed

Also, I want to note that the ready-made QrCodeDetector class is already available inside opencv. Maybe you don’t need to reinvent the wheel 🙂

Discovery

Obviously, before deciphering the qr-code, you first need to find it in the picture. How do our smartphones do it? Everything is very simple, especially for this, there are these three squares on the Qr-code:

How does a QR code work?

Writing code

As mentioned above, we will use opencv and numpy. Import these libraries:

import cv2 as cv
import numpy as np

First of all we need to find the first black pixel in the image, which is a 3D array of the form:

So we iterate through the array until we find an element whose value is less than 50. (black = 0, but there may be noise in the image, so we just look for dark pixels):

By the way, for the sake of debugging, I use the cv read mode. IMREAD_COLOR, in fact, it is completely unnecessary here, so I advise you to replace it with cv. IMREAD_GRAYSCALE

We found a black pixel, now we need to check that it is part of a square:

Here in the get_square_length function, we first look for the length of the square, traversing it to here:

How does a QR code work?

And then, using the _is_black_point function, we check two regions:

How does a QR code work?

We check exactly two regions, not two points, because, as mentioned earlier, there is an error when working with the image

Also, it’s worth checking the presence of this little square inside:

How does a QR code work?

To do this, we write one more function in our class:

Now, in a similar way, we need to check the remaining two squares, for this we add our detect function:

As a result, we get the following code:

Conclusion

In this article, we wrote a simple qr detector that detects a qr code on a white background. In the following articles, we will learn how to detect a qr-code on more complex images, and then translate it into a format that we (humans) understand

The code for all parts of this cycle can be found in this repository

If you need to get complete information about qr codes without waiting for the release of all parts of this cycle, I advise you to read this documentation: ISO/IEC JTC 1/SC 31 N (arscreatio.com). The essence of the qr-code has not changed much since its inception, so do not look at the fact that the documentation is from 2004

*found a version in Russian from our GOST: GOST R ISO/IEC 18004-2015. Information Technology. Technologies for automatic identification and data collection. Specification of bar code symbols QR Code (internet-law.ru)

Also, for a quick understanding of the basic principles of reading a qr-code, I advise you to pay attention to this article.

Hi Habr! In the blog on our website, we regularly publish articles about data and everything connected with it. Some materials from there are published here.

In 2020, many Russians encountered QR codes for the first time – first they were needed to register leaving the house, then to enter a bar or club. The technology is easy to use, but interesting from the inside, and it was not invented for control and isolation at all. The Quick Response Code was born as an alternative to the barcode, it can transmit up to 4296 letters and numbers and takes the form of a juniper hedge if desired. We present a comprehensive guide to QR codes.

How does a QR code work?

How did you come up with it?

The creator of the first bar code, Norman Woodland, was inspired by Morse code: he explained that he simply expanded the dots and dashes, turning them into wide and narrow strokes. To read them, it was supposed to use the technology of optical sound recording. Due to technical difficulties, the implementation of the idea took twenty years: the first product with a barcode (a pack of Wrigley chewing gum) was sold in 1974.

How does a QR code work?

Barcodes quickly found application in industry: it was convenient to mark parts and components with them. But this was not enough for all companies. At Denso Wave, a Japanese car parts manufacturer, workers asked management to develop a more efficient system, and in 1994 it appeared – in the form of a matrix (two-dimensional) code. It was called the Quick Response Code – a quick response code or a QR code.

Although Denso has registered the term “QR Code” as a trademark, the source code of the system itself is open source, and there is no royalty to be paid for using the codes. All this allowed QR codes to take over the world.

Where is it used?

How does a QR code work?

Now even those who have never actively used online services know about QR codes: in the spring in Moscow they were needed in order to leave the house and not earn a fine, and now, according to the decree of the Mayor of Moscow, for registration of visitors to nightclubs. Everyone must scan such a code (or send an SMS, but this is longer and not so convenient), thus leaving their phone number. If it turns out that one of the visitors was a carrier of the coronavirus, all other visitors will receive a warning about possible contact after the fact.

Why does it look like this and how does it encrypt?

Each QR code can contain:

If you have less information, it doesn’t matter, the code will just have empty modules. Here, for example, is a coded phrase of 178 characters:

How does a QR code work?

If you point the camera at the code, then most likely your browser will open the search page. In the search bar you will find our message.

Most popular QR code applications allow you to recognize letters, numbers and special characters. Purely technically, images and sounds can be transmitted using QR codes, but such formats are rarely used: the data will have to be highly compressed, and applications capable of recognizing them are not widely used. Giving a link to a picture or song using a QR code is much easier.

Creation of a QR code takes place in several stages

All this is not done manually: there are programs and services for encoding information. Denso Wave, where QR codes were created, offers to use QRdraw Ad and QR Maker Ad. For those who do not want to do coding from scratch, there are free and paid services, including those with templates, for example: QR coder, QR Code generator, Online QR generator – yes, thousands, thousands of them.

How does a QR code work?

How is it recognized?

For the application, in most cases there are no big difficulties either: black and white fields are easily recognized, squares in the corners suggest what exactly needs to be read and where the system information is located. Then, in the main part of the code, the white fields turn into zeros, the black ones into ones. It turns out a data stream, from which the original information is then restored.

What’s the problem?

QR code as art

Although Denso Wave warns that 2D color codes, picture codes and other creative finds are not up to standard, this does not prevent them from being used – or at least “drawing them.” There is room for imagination here: from Lebedev’s colored Christmas tree and generators that allow you to insert text or a picture into a QR code while maintaining readability, to codes laid out in colors in British Marks & Spencer stores or planted with juniper in China.

How does a QR code work?

Alternatives

Codes that are not related to Denso Wave are also used. This, for example, Aztec Code (it is easy to recognize by the square in the center) on air and railway tickets, MaxiCode in cargo transportation, DataMatrix in industry, rectangular PDF417 for documents.

The Russian national marking system “Honest Sign” uses DataMatrix. An individual code allows you to track the movement of all goods from the supplier to the buyer and eliminates the possibility of fakes in retail chains. In addition, a special mobile application allows any buyer to verify the authenticity of the product.

Linear barcodes, by the way, are still quite alive. They are used where it is not necessary to transfer a large amount of information or transfer the user online. In retail chains, libraries and warehouses, encoding 20-30 characters is enough. Often the advantage of a linear barcode is its compactness: it can be applied both to a pack of chewing gum and to a computer board. But the point is also that GS1, an international organization that creates and implements standards for business, allocates EAN linear codes for basic information, and QR codes for additional information. Therefore, the presence of a registered EAN barcode is necessary to work with all major retail chains.

In case you are thinking of changing your field or improving your skills, we have a New Year’s promotion with discounts up to 60%.

How does a QR code work?

Leave a Reply

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