3、QR code creation and recognition

1、QR code

1.1、Introduction to QR codes

QR code is a type of two-dimensional barcode, which comes from the abbreviation of "Quick Response" in English, meaning "quick response". It originates from the inventor's hope that QR code can quickly decode its content. QR codes not only have large information capacity, high reliability, and low cost, but also can represent various textual information such as Chinese characters and images. They have strong confidentiality and anti-counterfeiting capabilities, and are very convenient to use. More importantly, the QR code technology is open source.

1.2、Structure of QR codes

pictureParse
imgPositioning markings indicate the direction of the QR code.
imgAlignment markings If the QR code is large, these additional elements help with positioning.
imgpattern With these lines, the scanner can identify how big the matrix is.
imgVersion information (Version information) here specifies the version number of the QR code in use. There are currently 40 different version numbers of the QR code. Version numbers for the sales industry are usually 1-7.
imgFormat information Format patterns contain information about fault tolerance and data mask patterns and make scanning codes easier.
imgData and error correction keys These modes hold the actual data.
imgQuiet zone This zone is very important for the scanner, its role is to separate itself from the surrounding.

 

1.3、Characteristics of QR codes

The data value in the QR code contains duplicate information (redundant values).Therefore, even if up to 30% of the QR code structure is destroyed without affecting the readability of the QR code. The QR code has a storage space of 7089 bits or 4296 characters, including Punctuation and special characters, which can be written into the QR code. In addition to numbers and characters, words and phrases (such as web addresses) can also be encoded. As more data is added to the QR code, the code size increases and the code structure becomes more complex.

1.4、QR code creation and recognition

1)、Source code path
2)、Installation package

NOTE:The factory Docker image has been installed.

3)、Create QRcode_ Create. py

Raspberry Pi PI5 master control needs to enter the docker container first, Orin master control does not need to enter,

open Terminal Input,

After the program runs, you will be prompted to enter the generated content, and the Enter key key will confirm the content. Here, taking the creation of the "yahboom" string as an example,

image-20230426103227913

The QR code that appears on the right, take out your phone and try scanning it. The scanning result will be the characters of "yahboom".

Source code parsing,

4)、Identify QRcode_ Parsing.py

Enter Docker and open Terminal Input,

image-20230426105028406

After the program runs, we place the QR code in front of the camera. The program will recognize the content of the QR code, mark it on the image, and print the recognized content on the terminal。

Source code parsing,