QR code recognition

Note: The ROS-DOMAIN-ID of the virtual machine and ROS wifi image transmission module needs to be consistent and set to 20.

1、Gameplay Introduction

This course mainly utilizes the camera of a robot to obtain the image of the camera and recognize QR code information.

2、Program code reference path

The source code for this feature is located at,

3、Program startup

3.1、Start command

**If the image of the camera is inverted, you need to refer to the * * 3. Camera Image Change * * document and correct it yourself. This experiment will not be elaborated on further.

Successfully displayed camera screen

image-20240125120352568

Enable recognition of QR codes and execute commands. The currently recognizable QR code in the routine is QRCode, with information such as "forward" indicating forward, "back" indicating backward, "left" indicating left translation, "right" indicating right translation, and "stop" indicating stop. "Turnleft" represents left rotation, "turnright" represents right rotation, and "stop" represents stop.

image-20240125120532746

4、Core code

Import QR code parsing library pybar

If pybar is not installed in the system, please open the terminal and run the following command to install.

Virtual machines with data tape do not require operation

Analyze grayscale images, extract information about QR codes and image positions from the images. If there is no QR code in the image, the information is None.

Image processing program

appendix:

image-20240125121258228

 

 

image-20240125121323029

 

image-20240125121337768

 

 

image-20240125121351348

image-20240125121406344

image-20240201105814568

image-20240201105835754