Optical Character Recognition Example

HUSKYLENS 2 Optical Char Recognition detects all text regions but only decodes the block under the crosshair, returning ID, name, content, position and size; it can also count total blocks, query by ID, and check whether specific learned text appears on screen, like a smart camera that tags and tracks printed words.

1. Optical Char Recognition Example

Before You Start:

1.1 Recognizing Text and Outputting Related Data

Under the Optical Char Recognition function, HUSKYLENS 2 can recognize and frame text blocks within its field of view and display the recognized text on the screen. Using the following example program, you can count the total number of recognizable text blocks in the frame and obtain related data of the text block closest to the crosshair. The readable data include: the text block ID, name, content, center point X/Y coordinates, as well as the width and height of the text block.

The example program is shown below.

Interface Diagram

Upload the program and wait for the upload to complete.

Align the crosshair on the HUSKYLENS 2 screen with any optical characters to learn a text block. For detailed instructions on how to learn optical characters, please refer to the Optical Character Recognition.

Running Result: As shown below, the total number of text blocks in the frame can be counted, and the text block indicated by the crosshair is recognized and its related data are output.

Note: Under the Optical Char Recognition function, HUSKYLENS 2 can detect all text block regions in the frame and mark them with bounding boxes. However, only the content of the single text block located at the crosshair position is recognized, and the recognized text is displayed at the upper-left corner of the bounding box.

Interface Diagram

1.2 Optical Char Recognition Blocks 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.
Get the number of text blocks with a specified ID.
Get data of a specific text block by its ID.
When multiple identical text blocks appear, get related data of one specified text block.
Determine whether a text block with a specified ID exists in the screen.
Get the number of text areas that have been learned by HuskyLens 2, regardless of whether they appear in the current frame.

Was this article helpful?

TOP