Object Recognition Example

HUSKYLENS 2 object recognition reads IDs, names and positions for up to 80 categories, like giving each item a digital name tag in view, and lets you count total objects, check learned vs unlearned ones, and query data for any specified ID in the frame.

1. Object Recognition Project Example

Before You Start:

1.1 Recognizing Objects and Outputting Related Data

Under the Object Recognition function, HUSKYLENS 2 can acquire object-related data. (which supports recognition of 80 fixed object categories; for details, refer to the Object Recognition.
The readable data include: the total number of recognizable objects in the frame, the object closest to the center of the HUSKYLENS 2 camera view, and the ID, name, center point coordinates, width, and height of the detected object.

The example program is shown below.

Interface Diagram

After the program is successfully uploaded, HUSKYLENS 2 switches to the Object Recognition function. Point the Camera of HUSKYLENS 2 at the objects in the scene and learn them one by one.

After learning is completed, point the camera at the object, and you can observe the output results as below.

Interface Diagram

Running Result: The corresponding object ID, name, and other data are output as required. If the target object has not been learned, the ID will be 0. When one learned object and one unlearned object appear at the same time, both can be recognized, and the number of recognized objects displayed is 2.

Interface Diagram

1.2 Obtaining Related Data of a Specified Object

After HUSKYLENS 2 recognizes objects, it can obtain related data of an object with a specified ID in the frame. For example, you can determine whether a specific object appears in the frame, read the name of the specified object, and obtain the number of objects of the same category in the scene. When multiple objects of the same category appear, you can specify and retrieve the related parameters of an object with a designated ID, including its name, X/Y coordinates, width, and height.

The example program is shown below:

Interface Diagram

Running Result: As shown in the figure, the total number of objects in the frame, the number of objects with ID 1, their name, and the center point coordinates of the first detected object with ID 1 can be obtained.

Interface Diagram

1.3 Object Recognition Description

block Description
Used to obtain one set of object recognition data under the Object Recognition function of HUSKYLENS 2.
Determines whether there are recognizable objects in the current frame.
Obtains data for the object closest to the crosshair on the screen, including object ID, name, center X coordinate, center Y coordinate, width, and height.
Gets the number of all detectable objects in the screen.
When multiple recognizable objects appear,obtains the relevant data of a specified object.
Detect the number of objects that have been learned by HuskyLens 2, regardless of whether they appear in the current frame.
Determines whether an object with a specified ID exists in the frame. (After HUSKYLENS 2 learns objects, it assigns ID numbers according to the learning order.)
Obtains the number of objects with the specified ID in the current frame.
Obtains the related data of a specified object.
When multiple similar objects appear,obtains the related data of a specified object.

Was this article helpful?

TOP