Color Recognition Example
HUSKYLENS 2 color recognition blocks let Mind+ users detect, count and locate learned and unknown color blocks in real time. It’s like a smart highlighter that boxes each color, reports IDs, positions and sizes, and returns stats for specific colors or the block nearest the crosshair.
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 total number of detected color blocks, the total number of learned color blocks, the ID of the color block closest to the center of the HUSKYLENS 2 camera frame, and the ID of the first detected color block.
Example Program:
Click 'Run' in Mind+ and wait for the program to upload.
Point the HUSKYLENS 2's crosshair at a color block to learn it. For detailed instructions on how to learn colors, refer to: 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 corresponding data as required, such as the second line, which outputs the total number of learned color blocks. The third and fourth lines output the specified color block ID. The color block near the center of the frame is outlined in a white box, indicating it is an unlearned color block, so the "ID of color block near center" 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".
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?
