License Plate Recognition Example
HuskyLens 2 license plate recognition reads plate ID, text and position and streams them to micro:bit via blocks. It’s like a smart camera counting and labeling every car plate in view, including closest, nth or same‑ID plates.
1.License Plate Recognition Project Example
Before You Start:
1.1 License Recognition and Output Related Data
When license recognition is enabled, license plates appearing on the HuskyLens 2 screen will be detected and framed, allowing you to access key data: total detected license plates, total trained license plates, center-closest license plate, nth detected license plate, and specified ID license plate. This data includes the license plate's ID, name, license number, center coordinates (XY), width, and height.
Example program:
Connect to micro:bit and click Download to transfer the program. After successful download, click Show Data to activate data output mode. Align the HuskyLens 2 camera with a license plate to observe the output.
As shown, when HuskyLens 2 detects one previously trained license plates, the following data will display:
How to learn license plates, please refer to the License Plate Recognition.
Result: The serial port will output: total detected license plates, ID of the center-closest and first license plate.
There are 2 detected license plates, so the dot matrix display shows "2".
1.2 Obtaining License Recognition Feature Data
The system can capture detailed license plate feature data for any detected license plate. Key readable information includes: license plate ID, name, license number, width, height, and center coordinates (X/Y).
For instance, the sample program below retrieves license plate feature data positioned near the camera's center; this functionality works even for license plates not previously learned.
Result: As shown, click "Download" to transfer the program to micro:bit. After successful download, click "Show Device" to activate data output. Align HuskyLens 2 with a license plate, and the serial port will display the license plate ID along with its recognized license number and positional data.
1.3 Obtaining Data of a Specific License
When multiple license plates with the same ID appear simultaneously, the program can count their occurrences and retrieve data for the nth license plate in the detected sequence.
Example program:
Result: As shown, click "Download" to transfer the program. Align HuskyLens 2 with two license plates labeled ID 1. After activation, the serial port will output data statistics for these two license plates, including their individual ID, license plate numbers, and coordinates.
12.4 License Recognition Blocks Description
| block | Description |
|---|---|
|
Used to obtain one set of License Recognition data under the License Recognition function of HUSKYLENS 2. |
|
Determine if a license plate is present in the current frame. |
|
Retrieves data of the license plate closest to the screen cross cursor, including license ID, name, license number, center X/Y coordinates, width, and height. |
|
Get the total number of license plates detected on the screen, including both unregistered and registered license plates. |
|
When multiple license plates are detected, retrieves data for a specified license plate. |
|
Get the total number of learned license plates, regardless of whether they appear in the current frame. |
|
Determine if a license plate with the specified ID exists in the frame. Unlearned IDs are uniformly set to 0, and learned IDs are sorted in learning order. |
|
Gets the total number of detected license plates with a specified ID on the screen. |
|
When multiple license plates are detected, retrieve the relevant data of a specified license plate. |
|
When multiple license plates with the same ID are detected, retrieve the relevant data of a specified license plate. |
Was this article helpful?
