Object Recognition Example
HUSKYLENS 2 object recognition lets Mind+ read how many objects are in view and detailed data for each one, like ID, name and position. It’s like a smart camera that tags every item in its sight so your code can quickly check if a target object exists, count similar IDs, and track the coordinates and size of the closest or specified object in real time.
1. Object Recognition Blocks
Before You Start:
1.1 Object Recognition outputs relevant data.
In the Object Recognition function, HUSKYLENS 2 can recognize objects within its field of view (covering 80 fixed categories). It prints the related data through the serial port, including the total number of recognizable objects in the frame, the ID number of the object closest to the center of the HUSKYLENS 2 camera view, and the first detected object.
The example program is as follows.
Click “Upload” in Mind+ and wait for the upload to complete.Use the touchscreen to enter the Object Recognition function of HUSKYLENS 2.
Point the HUSKYLENS 2 camera at the objects in the frame to learn them one by one. For detailed learning steps, read Object Recognition.
After learning is complete, open the serial port in Mind+ and observe the output results.
Result:The output includes the total number of recognized objects and the corresponding object ID numbers as required.
1.2 Obtain Data of Specified Object in Image
After HUSKYLENS 2 recognizes objects, you can obtain data of a specific object in the frame. For example, determine whether a learned object is present in the frame, identify the name of a specified object, or obtain the number of similar objects in the frame. When multiple similar objects appear, you can specify one object to get its related parameters, including name, X/Y coordinates, width, and height.
Example program is as follows:
Result: As shown in the figure, you can obtain the total number of objects in the frame, the number and name of ID2 objects, and the coordinate position of the first detected ID2 object.
1.3 Object Recognition Blocks 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. |
|
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?
