Color Recognition Example
HUSKYLENS 2 color recognition reads learned and unknown color blocks, returning IDs, count, and position data. It’s like a smart camera that tags colored objects so Mind+ projects can detect, count, and track specific colors in the frame.
1.Color Recognition Blocks
Before You Start:
1.1 Color Recognition - Output Relevant Data
It can recognize color blocks within the HUSKYLENS 2 field of view and output color block-related data. Readable data includes: the ID of the color block closest to the center of the HUSKYLENS 2 camera frame, the total number of detected color blocks, and the ID of the first detected color block.
Example Program:
Click to upload the program to the device in Mind+, and wait for the upload to complete.
Point the HUSKYLENS 2‘s crosshair at a color block to learn it. For detailed instructions on how to learn colors, refer to the Color Recognition.
Once learning is complete, aim the HUSKYLENS 2 camera at the color blocks and observe the output results.
Output Result: It can output the total number of detected color blocks. All color blocks framed by a box will be counted, whether they have been learned or not. It can output the corresponding color block ID as required. The color block near the center of the frame is outlined in a white box, indicating it is an unlearned color block, so its output ID is 0.
1.2 Get Data for a Specific Color
After HUSKYLENS 2 recognizes a color, it can acquire data for a specific color in the frame. For example, it can determine if a specific color is in the frame, get the name of a specific color, or get the count of color blocks of the same specific color in the frame. When multiple color blocks of the same color appear, it can be set to acquire parameters for a specific one, including its name, X/Y coordinates, width, and height.
Example Program:
Output Result: As shown, it can acquire the total count and name of color block ID 1 in the frame, and the coordinate position of the first detected ID 1 color block. (Color names can be customized; the default is "color". For details on setting names, seeColor Recognition.
1.3 Color Recognition Blocks Description
| block | Description |
|---|---|
|
Used to obtain one set of color recognition data in the Color Recognition function of HUSKYLENS 2. |
|
Determines whether recognizable color blocks exist in the current frame. |
|
Obtains data for the color block closest to the crosshair on the screen, including ID, name, center X/Y coordinates, width, and height. |
|
Gets the total number of detected color blocks in the screen. |
|
When multiple color blocks are detected, obtaining the data of a specified block. (If the block is unlearned, its ID is 0.) |
|
get the number of colors that have been learned by HuskyLens 2, regardless of whether they appear in the current frame. |
|
Determines whether a color with a specified ID exists in the image. (After HUSKYLENS 2 learns colors, IDs are assigned sequentially.) |
|
Obtains the number of color blocks for a learned color in the current frame.. |
|
Obtains the data of a learned color. |
|
When multiple color blocks of the same color appear,they obtain the data of a specified block. |
Was this article helpful?
