Barcode Recognition Example
HUSKYLENS 2 barcode blocks let you detect, count and query barcodes in view, returning ID, learned status, position and content. It’s like giving your robot eyes to read product labels. You can check if any barcode exists, get the nearest one, total detected, total learned, and filter or iterate by a specific ID, even when several barcodes share that same ID.
1. Barcode Recognition Blocks
Before You Start:
1.1 Recognizing Barcodes and Outputting Related Data
HUSKYLENS 2 can recognize barcodes appearing in the frame. Through programming, you can obtain related data of the detected barcodes in the frame. The readable barcode data include: the total number of detected barcodes, and data of a specified barcode, including its ID, content, width, height, and the X/Y coordinates of the barcode center point.
The example program is shown below.
Upload the program and wait for the upload to complete. Point the Camera of HUSKYLENS 2 at the barcode in the frame to perform learning. For detailed instructions on how to learn barcodes, please refer to the Barcode Recognition.
Point the Camera of HUSKYLENS 2 at the barcode and observe the results displayed on the UNIHIKER K10 screen.
Running Result: As shown in the figure, the total number of detected barcodes can be output (regardless of whether the barcode has been learned). The specified barcode ID can also be output; for an unlearned barcode, the ID is 0.
1.2 Barcode Blocks Description
| block | Description |
|---|---|
|
Retrieve barcode recognition data once. |
|
Determine whether any barcode is detected. |
|
Get data of the barcode closest to the crosshair: ID, name, center X/Y coordinates, width, height, decoded content.. |
|
Get the total number of detected barcodes, including learned and unlearned. |
|
Get data of a specified barcode when multiple are detected. |
|
Get the total number of barcodes that have been learned by HuskyLens 2, regardless of whether they appear in the current frame. |
|
Determine whether a barcode with a specified ID exists. (ID=0 for unlearned). |
|
Get the number of barcodes with the specified ID. |
|
Get related data of barcodes with the specified ID. |
|
When multiple barcodes share the same ID, get related data for one of them. |
Was this article helpful?
