Optical Character Recognition Example

HUSKYLENS 2 optical char recognition finds, frames and reads text blocks in view, then outputs ID, name, content and position data. It’s like a smart magnifier that labels every word you point at. Mind+ example code counts all detected text areas, focuses on the block nearest the crosshair, and shows its text at the top left. Blocks let users check if any text exists, get total text count, fetch data by index or ID, count blocks with the same ID, and query how many texts have been learned, supporting classroom projects and precise STEM experiments.

1.Optical Char Recognition Blocks

Before You Start:

1.1 Optical Char Recognition - Output Relevant Data

Under the Optical Char Recognition function, HUSKYLENS 2 can recognize and frame the areas where text blocks appear in its field of view, and display the recognized text on the screen. The following example program can be used to count the total number of recognizable text blocks in the frame and acquire data for the text block closest to the crosshair. Readable data includes: the text block's ID, Name, Content, center X and Y coordinates, and the text block's Width and Height.

Example Program:

Interface Diagram

Click 'Run' in Mind+ and wait for the program to upload.

Point the HUSKYLENS 2 camera at any optical characters and observe the results displayed on the M10 (User provided K10, but document context is M10) screen.

Output Result: As shown below, the default output ID for unlearned text blocks is 0.

Interface Diagram

You can aim it at a learned text block. For detailed instructions on how to learn optical characters, refer to: Optical Character Recognition.

Output Result: As shown below, the output ID for a learned text block matches the ID displayed on the HUSKYLENS 2 screen.

Note: Under the Optical Char Recognition function, HUSKYLENS 2 can detect and frame all areas where text blocks appear in the frame, but it only recognizes the content of the single text block area where the crosshair is located and displays the text content at the top left of the frame.

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