Get Started
Color Tracking
On this page
  1. Commands
  2. Settings
  3. Output Variables
  4. JSON Output

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

CommandDescription
Color Detected?Checks whether the specified color range is detected.
Count ColorsWrites the number of detected color regions.
Get Color InfoWrites the center point, width and height, area, and average color of one color region chosen by Select By.
Get All ColorsWrites every detected color region as JSON.

When a Detection Zone is set, only color regions inside it are considered.

Settings

SettingDescription
Start Color / End ColorThe 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 ZoneSee Common Items.
Select ByLargest (default), Closest, By Index.
Reference PointSee Common Items.
Index (0-based)0 to 100, default 0. Ordered from the largest area.

Output Variables

FieldTypeValue
DetectedDigitalTrue when a color region is detected.
CountNumberNumber of detected color regions.
Center Point X / Center Point YNumberPixel coordinates of the selected region's center; 0 when not detected.
Width (Pixels) / Height (Pixels)NumberSize of the selected region; 0 when not detected.
AreaNumberArea of the selected region in px²; 0 when not detected.
Avg ColorColorAverage color of the selected region.
Output (JSON Text)TextArray 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" }
]