Color Tracking
Finds regions of a specified color range in real time from the camera video and provides their position, size, area, and average color.
Commands
| Command | Description |
|---|---|
| Color Detected? | Checks whether the specified color range is detected. |
| Count Colors | Writes the number of detected color regions. |
| Get Color Info | Writes the center point, width and height, area, and average color of one color region chosen by Select By. |
| Get All Colors | Writes every detected color region as JSON. |
When a Detection Zone is set, only color regions inside it are considered.
Settings
| Setting | Description |
|---|---|
| Start Color / End Color | The color range to detect. Colors between the two are detected. Defaults are #FF0000 to #FF5555. |
| Min Area (px²) | Regions smaller than this are ignored, which filters out small noise. 1 to 100000, default 300. |
| Detection Zone | See Common Items. |
| Select By | Largest (default), Closest, By Index. |
| Reference Point | See Common Items. |
| Index (0-based) | 0 to 100, default 0. Ordered from the largest area. |
Output Variables
| Field | Type | Value |
|---|---|---|
| Detected | Digital | True when a color region is detected. |
| Count | Number | Number of detected color regions. |
| Center Point X / Center Point Y | Number | Pixel coordinates of the selected region's center; 0 when not detected. |
| Width (Pixels) / Height (Pixels) | Number | Size of the selected region; 0 when not detected. |
| Area | Number | Area of the selected region in px²; 0 when not detected. |
| Avg Color | Color | Average color of the selected region. |
| Output (JSON Text) | Text | Array of every detected color region. |
JSON Output
An array with, per region, the center x and y, width, height, area, and the average color as a hex string.
[
{ "x": 320, "y": 240, "width": 50, "height": 60, "area": 3000, "color": "#FF5733" },
{ "x": 500, "y": 300, "width": 40, "height": 45, "area": 1800, "color": "#33FF57" }
]