QR code creation and identification

 

5.1、QR code

5.1.1、Introduction of QR code

QR code is a two-dimensional bar code, QR from the English "Quick Response" abbreviation, that is, rapid response meaning, from the inventor hopes that the QR code can make its content quickly decoded. QR code not only has large information capacity, high reliability and low cost, but also can represent a variety of text information such as Chinese characters and images, and its security is strong and it is very convenient to use. What's more, the QR code technology is open source.

5.1.2、Structure of QR codes

image-20230426101118368

5.1.3. Features of QR codes

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

5.2. Description of program function

After running the QR code creation program, input the contents of the QR code, you can generate a QR code picture and save it locally.

After running the QR code recognition program, the QR code image created will be read and recognized, the recognition result will be output and the image will be saved to the local.

After VSCode is configured to connect with the car, the image can be visualized.

5.3. Program Code Reference paths

After SSH connection car, the location of the function source code is located at.

The commands to install the required packages, as following.

The factory system image has been installed.

5.4. Program Startup

5.4.1. Create QR codes

After SSH connects to the car, open the terminal input.

After the program is run, it will prompt you to enter the generated content. Enter to confirm the content. As an example of creating a "yahboom" string.

1684982462181

The saved path of the created QR code.

Remotely connect the car in VSCode, enter the directory /userdata/yahboomcar_ws/src/yahboomcar_astra/qrcode_examples/figures, you can click the image to view the QR code.

1684983567408

Take out your phone and try to scan the QR code displayed. The scan results in the characters yahboom.

5.4.2. Identify QR code

After SSH connects to the car, open the terminal input,

1684983031885

The program will print out the identified content in the terminal, and save the identification result picture to the path.

The program will print out the identified content in the terminal, and save the identification result picture to the path.

1684983749286

5.5 Core source code parsing

5.5.1. QRcode_Create.py

5.5.2、QRcode_Parsing.py