Browse docsvision.color
On this page
API method

vision.color

Configures a native color threshold tool and returns a color value.

Syntax

Atlas Script
vision.color(lower, upper, roi?, min_area?, enabled?)

Parameters

lower
Lower HSV threshold array for the accepted color range.
upper
Upper HSV threshold array for the accepted color range.
roi Optional
Optional region of interest: a four-value [x, y, width, height] array. Pass null when the method accepts a full-frame scan.
min_area Optional
Minimum detected area to retain. Smaller candidates are ignored.
enabled Optional
Optional boolean that turns this configured tool on or off. Use true to process it and false to keep its configuration without running it.

Return value

Returns color.

Remarks

Configures a native color threshold tool and returns a color value. Store it in a color variable; read/set color.enabled, color.overlay, color.roi, color.lower, color.upper, color.min_area to update the running detector, and read color.results, color.count, color.target for detections.

Examples

Find an HSV color target.atlas
color redPixels = vision.color([0, 90, 80], [15, 255, 255], null, 20, true);

event on_frame() {
    target redTarget = redPixels.target;
    if (redTarget != null) {
        ui.rect(redTarget.box.x, redTarget.box.y, redTarget.box.width, redTarget.box.height, rgb.red, 2, false);
    }
    ui.status(string.format("Red regions: {}", redPixels.count));
}
Reference details are generated from the Atlas Script schema in this documentation source snapshot. Confirm release-specific behavior in the Atlas for Windows build you use.