QR Code Recognition Example
HUSKYLENS 2 QR blocks let Mind+ read QR IDs, text and position, like giving Arduino a visual barcode scanner. It’s like a smart camera that locks onto the nearest code, counts all visible codes, filters by specific ID, and streams each tag’s decoded content and coordinates via serial.
1.QR Code Recognition Blocks
Before You Start:
1.1 Recognize QR Codes and Output Related Data
Under QR Code Recognition, HUSKYLENS 2 can recognize QR codes. The program retrieves data of the QR code closest to the crosshair and prints via serial ID, name, decoded content, width, height, center X/Y coordinates.
The sample program is as follows.
Click Upload in Mind+ and enter QR Code Recognition by touchscreen.
After the QR code is recognized, the HukyLens 2 screen will frame the QR code and display the parsed QR code content in the upper left corner of the frame. Open the Mind+ serial port and observe the serial port output the relevant data of the QR code closest to the crosshairs.
Result:ID=0 for unlearned; decoded content matches display.
Result:Learned QR code ID matches display.
1.2 Output Data of a Specified QR Code
When multiple QR codes appear, count them and output data for a specified ID.
Result:When multiple QR codes appear on the screen, HUSKYLENS 2 can recognize all QR codes (both unlearned and learned), and the total number of QR codes on the current screen can be observed and counted through the serial port. At the same time, the serial port prints the relevant data of the QR code with the specified ID 1.
1.3 Count of a Specific ID and Output Related Data
When multiple QR codes with the same ID appear on the screen (the IDs of learned QR Codes are assigned in the order of learning, and the IDs of unlearned tags are all 0), you can use the following sample program to count the number of QR codes with the same ID on the screen and obtain the relevant data of a specified ID QR code.
Result:When multiple identical QR codes appear on the screen, HUSKYLENS 2 can recognize all QR codes with ID 1 (assuming a QR code has been learned and assigned ID 1, and unlearned QR codes are assigned ID 0). The total number of QR codes with ID 1 on the current screen can be observed and counted through the serial port. The serial port also outputs the data related to the first QR code with ID 1.
1.4 QR Code Recognition Block Description
| block | description |
|---|---|
|
Acquire QR code recognition data once. |
|
Determine whether a QR code is detected. |
|
Get data of the closest QR code: ID, name, center X/Y coordinates, width, height, decoded content. |
|
Get total number of detected QR codes, including unlearned and learned QR codes. |
|
Get data of a specified QR code. |
|
Determine whether a specified ID exists. |
|
Get number of QR codes with a specified ID. |
|
Get data of QR codes with a specified ID. |
|
Get data of one specified QR code when multiple shares the same ID. |
Was this article helpful?
