Optical Character Recognition Example
HUSKYLENS 2 OCR blocks let Mind+ users detect, count and read on screen text like labeling moving name tags, it’s like a smart highlighter that only reads the word closest to the crosshair and streams its ID, content and position via serial data for kid friendly AI vision projects
1.Optical Char Recognition Blocks
Before You Start:
1.1 Recognize char and Output Data Near the Center
Under the Optical Char Recognition function, HUSKYLENS 2 can detect and highlight text areas in the field of view, and display the recognized text in the upper-left corner. You can use the following sample program to count the total number of recognizable text areas on the screen, get the text block nearest to the crosshair, and output related data through the serial port. The readable data includes: text block ID, name, content, center X/Y coordinates, text block width and height.
The sample program is as follows.
Click “Upload” in Mind+ and wait for uploading to finish. Touch the screen to enter HUSKYLENS 2 Optical Char Recognition.
Aim the HUSKYLENS 2 camera at any Optical Character. Open the serial port in Mind+ and observe the output.
To align with a learned text block, use the auto-recognition function. For details on how to learn optical characters, please refer to: Optical Character Recognition - Learning Text:Optical Character Recognition
Result:As shown below, for unlearned text blocks, the output ID is 0 by default.
Note: Under the Optical Char Recognition function, HUSKYLENS 2 detects all text areas and highlights them, but only recognizes the content of the text block closest to the crosshair and displays it in the upper left corner.
1. 2 Optical Char Recognition Block Description
| block | description |
|---|---|
|
Used to acquire char recognition data once under HUSKYLENS 2 Optical Char Recognition. |
|
Determine whether any text is detected in the current screen. |
|
Get data of the text block nearest to the crosshair, including ID, name, center X/Y coordinates, width, and height. |
|
Get the total number of detected text areas on screen. |
|
When multiple text blocks are detected, get related data of a specified text block. |
|
Determine whether a text block with a specified ID exists in the screen. |
|
Determine whether a text block with a specified ID exists in the screen. |
|
Get the number of text blocks with a specified ID. |
|
When multiple identical text blocks appear, get related data of one specified text block. |
Was this article helpful?
