Object Tracking Example

HuskyLens 2 object tracking lets you learn a target, draw a box, then continuously detect and follow it, streaming ID, name, center X/Y, width and height over serial to micro:bit. It’s like giving your camera a tag that it keeps locked on wherever it moves.

1. Object Tracking Project Example

Before You Start:

1.1 Track Objects and Output Related Data

When object tracking is enabled, objects appearing on the HuskyLens 2 screen will be detected, framed, and tracked, allowing you to access key data: tracked object ID, object name, center coordinates (XY), width,height,and confidence level will be displayed (confidence level cannot currently be retrieved via program. The system can continuously follow a learned object and provide real-time positional data.

Example program:

Interface Diagram

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 the object to be tracked. You must first define the target object by drawing a bounding box.
As shown, when HuskyLens 2 successfully tracks a previously learned object named "cell phone", the following data will display:
How to set up object tracking, please refer to the Object Tracking.

Result: The serial port will output: tracked object ID, X coordinate, Y coordinate, width, and height.

Interface Diagram

1.2 Object Tracking Blocks Description

block Description
Used to obtain one set of Object Tracking data under the Object Tracking function of HUSKYLENS 2.
Determine if a trackable object is present in the current frame.
Retrieves data of the tracked object, including object ID, custom object name, center X/Y coordinates, width, and height.

Was this article helpful?

TOP