Quickly Build A Color Recognition App with AI Edge Computing
Color Recognition Action Execution Based on HuskyLens
Tip: Ambient lighting greatly affects color recognition. For similar colors, HuskyLens may sometimes misidentify them. It is recommended to maintain stable ambient lighting and use this function in a moderately lit environment.
Wiring Diagram
HuskyLens is connected to Raspberry Pi via serial port, with HuskyLens's Tx to Rx and Rx to Tx, and a baud rate of 9600. Connect the RGB light's R to GPIO17, G to GPIO27, and B to GPIO22.
Specific Steps
Operation Settings
-
Toggle the "Function Button" left or right until "Color Recognition" is displayed at the top of the screen.
-
Long press the "Function Button" to enter the secondary menu parameter settings interface for the color recognition function.
-
Toggle the "Function Button" left or right to select "Learn Multiple," then briefly press the "Function Button." Next, toggle the "Function Button" to the right to turn on the "Learn Multiple" switch, indicated by the progress bar turning blue and the square on the progress bar moving to the right. Briefly press the "Function Button" again to confirm this parameter.
-
Toggle the "Function Button" to the left to select "Save and Return," then briefly press the "Function Button." The screen will prompt "Save parameters?" with the default selection being "Confirm." Briefly press the "Function Button" to save the parameters and automatically return to the color recognition mode.
Learning and Recognition
-
Detect Color.
-
Aim the "+" at the center of the HuskyLens screen at the target color block. A white box will appear on the screen, automatically framing the target color block. Adjust the angle and distance between the HuskyLens and the color block so that the white box encloses the entire target color block as much as possible.
-
Learn Color.
-
After detecting the color, press the "Learning Button" to learn the first color, then release the "Learning Button" to end learning. The screen will display a message: "Press again to continue, press another button to end." To continue learning the next color, press the "Learning Button" again before the countdown ends to continue learning the next color. If no further colors need to be learned, press the "Function Button" before the countdown ends, or do nothing and wait for the countdown to end. The color IDs displayed by HuskyLens will correspond to the order in which the colors were learned, meaning the IDs will be sequentially labeled as "ID1," "ID2," "ID3," and so on. The boxes for different colors will also have different colors.
-
Recognize Color.
-
When HuskyLens encounters the same or similar colors, a colored border will frame the color block on the screen and display the color's ID. The border size will change with the area of the color block, and it will automatically track the color block. Multiple different colors can be recognized and tracked simultaneously, and the borders for different colors will have different colors.
-
In firmware versions below V0.5.1, when multiple color blocks of the same color appear, separated color blocks cannot be recognized simultaneously; only one color block can be recognized at a time. As shown in the figure below:
-
In firmware version V0.5.1 and above, this feature has been optimized. When multiple color blocks of the same color appear, these blocks can be recognized simultaneously. This feature can be used to count color blocks.
DEMO Code
Experimental Phenomenon
Leave a comment
All blog comments are checked prior to publishing