Histogram

Histogram

Introduction

The Histogram operator analyses the colour and brightness distribution of the picture and reports whether a colour you care about is present — and how much of the frame it fills. You define a slice of the colour wheel (a hue range, plus saturation and brightness limits), and the operator continuously measures how many pixels fall inside that window.

Despite the name, this is not a photographic RGB-curve display: it is a colour detector and tracker. Its real job is to turn "is this colour on screen right now?" into a true/false flag and a set of numbers that scripts and automation can react to — while optionally highlighting the matching pixels in the output so you can see exactly what it found.

How it works

The operator examines each pixel in HSV terms — hue (which colour), saturation (how vivid), and value (how bright) — rather than raw red/green/blue. Working in HSV makes it easy to describe a colour the way a person would: "a vivid red, not too dark," regardless of small lighting variations.

A pixel qualifies when it falls inside all of the configured limits at once:

  • Hue range — a minimum and maximum position on the colour wheel (0°=red, 60°=yellow, 120°=green, 180°=cyan, 240°=blue, 300°=magenta). Set both ends close together for an exact colour, or widen the range to accept variations. The range can wrap across the wheel for colours like red that straddle 0°.
  • Saturation limits — exclude near-grey, washed-out pixels (raise the minimum) or ignore over-saturated ones (set a maximum).
  • Minimum brightness — ignore shadows and dark areas so only well-lit colour counts.

Each frame the operator then compares the share of qualifying pixels against the minimum detect percentage: 0 means a single matching pixel is enough, while higher values require the colour to fill a substantial part of the area before the frame counts as a match. The instantaneous result is published as Qualified.

Steadying the trigger

A raw per-frame match flickers on noisy footage or when a colour drifts in and out at the edge of the threshold. The Temporal filter debounces it: the colour must qualify for a configurable number of consecutive frames before Temporal Qualified turns on, and must be absent for a configurable number of frames before it turns off. This is the value most scripts should trigger on — set the qualify count higher to ignore brief glitches, and the un-qualify count higher to ride through momentary drop-outs.

A script can read these flags whenever it needs them, or have the operator call one of its functions each time a flag turns on or off. Reacting from a script, further down this page, has an example of each.

Limiting the area

By default the whole frame is analysed, but the Processing area crop controls (left / right / top / bottom) let you restrict the analysis to a region of interest — for example excluding a lower-third, a scoreboard, or letterbox bars so they don't pollute the measurement. Only the cropped-in region is considered when counting qualifying pixels.

Seeing and reading the result

While dialling in a colour, the Visualization options make the match visible: tint the qualifying pixels so they stand out, hide the disqualifying pixels to leave only the matched colour, or hide all output entirely and use the operator purely as a measurement. Video pass-through outputs the original picture untouched while still analysing it, so the operator can sit silently in a chain as a sensor.

Alongside the trigger flags, the operator reports read-only statistics about the analysed area — the most common hue and saturation, how many distinct hue/saturation values are present, and the total and matching pixel counts (with a percentage). These give scripts a richer picture than a simple yes/no, useful for logging the dominant colour of a feed or judging how varied an image is.

Common use cases

  • Colour-cue automation — fire an action when a flag, a coloured light, a vest, or a sponsor colour is shown to the camera, using Temporal Qualified as a debounced trigger.
  • Team or branding detection — watch for a known team colour or brand palette appearing on screen and switch graphics or overlays accordingly.
  • Exposure and content monitoring — track the dominant hue and saturation of a live feed for editorial or QC purposes.
  • Region-of-interest sensing — crop to a corner of the frame and react only to colour changes inside that zone (a signal lamp, a status panel, a portion of a set).
  • Silent measurement — combine pass-through (or hide-all-output) with the read-only results so the operator reports on the picture without ever altering it.

Histogram - Settings

Configuration

Configuration — define which colours and brightnesses count as qualifying pixels.

Configuration
Property Description
Minimum hue value Lowest hue (in degrees) that counts as a qualifying colour. [min=0, max=360, default=0]. Hue runs around the colour wheel: 0=red, 60=yellow, 120=green, 180=cyan, 240=blue, 300=magenta. Combine with ConfigurationHueValueMax to pick a slice of the wheel.
Maximum hue value Highest hue (in degrees) that counts as a qualifying colour. [min=0, max=360, default=360]. Set the same as ConfigurationHueValueMin for an exact hue match, or widen the range to accept variations.
Minimum saturation Minimum colour saturation (%). [min=0, max=100, default=20]. Pixels less saturated than this are ignored. Raise this to exclude near-grey pixels and only react to vivid colours.
Maximum saturation Maximum colour saturation (%). [min=0, max=100, default=100]. Pixels more saturated than this are ignored. Lower it to exclude over-saturated pixels, or set both minimum and maximum to 0 to accept only colourless pixels: white, grey and black.
Minimum value Minimum brightness (value, %) of qualifying pixels. [min=0, max=100, default=10]. Pixels darker than this are ignored. Raise this to exclude shadows and only react to well-lit colour.
Minimum detect percentage Percentage of the area that must qualify before Qualified becomes true. [min=0, max=100, default=0]. 0 means any single matching pixel qualifies the frame. Raise this to ignore tiny patches and only fire on substantial coverage (for example, a flag filling a sizeable part of the frame).

Visualization

Visualization — control how qualifying and non-qualifying pixels appear in the output image.

Visualization
Property Description
Show qualifying pixels Tint qualifying pixels in the output so they stand out. [default=false]. Useful while dialing in the colour range. Turn off in production unless the visualisation is part of the show.
Hide disqualifying pixels Hide pixels that do not qualify, leaving only the matching colour visible. [default=false]. Combine with Show qualifying pixels for a clear "matched-only" look.
Hide all output Hide all visual output and use the operator only as a measurement. [default=false]. The Qualified properties are still updated. Use this when the histogram is just a trigger and shouldn't change the picture.

Temporal filter (time)

Temporal filter — require qualification across several frames to avoid flicker.

Temporal filter (time)
Property Description
Consecutive Qualify Frames Number of consecutive frames the colour must qualify before TemporalQualified becomes true. [min=1, max=300, default=1]. Higher values smooth out single-frame glitches but delay the trigger. 1 means react immediately.
Consecutive Un-qualify Frames Number of consecutive frames without a match before TemporalQualified resets to false. [min=1, max=300, default=1]. Higher values keep the trigger high through brief drop-outs.

Results

Results — read-only outputs reporting what was found in the most recent frame.

Results
Property Description
Qualified True when the current frame matches the configured colour (read-only). Reflects the raw, instantaneous match. Use TemporalQualified for a debounced version.
Temporal Qualified True after enough consecutive frames have qualified (read-only). The recommended trigger for scripts — debounced via ConfigurationMinFramesToQualify/ConfigurationMinFramesToNotQualify.
Most common hue Hue (degrees) that appears most often in the analysed area (read-only).
Count How many pixels share the most common hue (read-only).
Number of hue values Number of distinct hue values present (read-only). A low number suggests a flat colour palette; a high number suggests a busy/varied image.
Most common saturation Saturation level that appears most often, 0–255 (read-only).
Number of saturation values Number of distinct saturation values present (read-only).

Summary

Summary — overall pixel counts for the analysed area.

Summary
Property Description
Total number of pixels analyzed Total number of pixels considered, before colour filtering (read-only).
Total number of pixels processed Number of pixels that matched the configured colour rules (read-only).
Percent processed Matching pixels as a percentage of the analysed area, formatted as text (read-only).

Processing area

Processing area — choose which part of the image is analysed.

Processing area
Property Description
Video pass-through Output the original picture untouched while still analysing it. [default=false]. Useful when the histogram is purely a measurement and the visualization options would interfere with the show.
Left Pixels to ignore from the left of the image. [min=0, max=4096, default=0]. Use to limit analysis to a region of interest, for example excluding lower-thirds, scoreboards or letterbox bars.
Right Pixels to ignore from the right of the image. [min=0, max=4096, default=0].
Top Pixels to ignore from the top of the image. [min=0, max=4096, default=0].
Bottom Pixels to ignore from the bottom of the image. [min=0, max=4096, default=0].

Script Engine Functions (optional)

Script Engine Functions (optional) — names of script functions called when a Qualified flag changes.

Property Description
On Qualified change (advanced) Name of a script function to call when Qualified changes, from false to true or from true to false. It is given the new value as the text true or false, so test it with value === 'true': the text false counts as true in an if. Each run starts with Qualified false, and a change made while the script is still loading is given to the function once the script runs. It is called while the frame renders, so keep it short. Leave empty to call nothing. [default=empty].
On Temporal Qualified change (advanced) Name of a script function to call when TemporalQualified changes, from false to true or from true to false. It is given the new value as the text true or false, so test it with value === 'true': the text false counts as true in an if. Debounced like TemporalQualified itself, so this is the function to drive automation from. Each run starts with TemporalQualified false, and a change made while the script is still loading is given to the function once the script runs. It is called while the frame renders, so keep it short. Leave empty to call nothing. [default=empty].

Inherits from: AbstractOperator, AbstractAudioMetering, NamedModel.

See also: Histogram in Script Engine Objects.

Reacting from a script

A Script Engine script can follow the colour in two ways:

  • The operator calls your script. Name a function in On Qualified change or On Temporal Qualified change, both under Show advanced options, and the operator calls it each time that flag turns on or off. Nothing is called on the frames in between.
  • Your script reads the operator. Look the operator up by scene, layer and name, and read Qualified or TemporalQualified whenever you need it.

The operator calls your script

Set On Temporal Qualified change to OnFlagChanged, and add this function to the project's script:

// Called by the Histogram operator when Temporal Qualified turns on or off.
function OnFlagChanged(value) {
    if (value === 'true') {
        Logger.Info('Flag is on screen');
    } else {
        Logger.Info('Flag has left the screen');
    }
}

The function receives one argument: the flag's new value, as the text true or false. Compare it with === 'true' as above. Testing it on its own, as in if (value), does not work: the text false counts as true there.

Things to know:

  • On Temporal Qualified change is the one to drive automation from. It changes only once the colour has been there, or been gone, for the frames the Temporal filter asks for. On Qualified change follows every frame's match, so it can be called on frame after frame when the colour flickers at the edge of the range.
  • Each function is told about its own flag only. To react to both, name a function in each.
  • When one frame changes both flags, the On Qualified change function is called first. Both flags already have their new values by then, so either function can read the other one.
  • Each time the project starts, both flags start off. The script loads a moment after the picture starts, and a flag that changes in that moment is given to the function as soon as the script is running. So a colour that is already in the picture when the project starts is reported too, and the function ends up with the current value. A flag that turns on and off again before the script is running calls nothing.
  • With Enable auto reload of script on, Composer loads the script again when you edit it while the project runs. The reloaded script hears about the next change, not about the value the flag has at that moment.
  • It runs as part of rendering the frame, so keep it short. Slow script code slows the output.
  • In a module script, export the function, or the operator can't find it.

Your script reads the operator

Look the operator up by the names shown in the project: the scene, the layer, and the operator's name on that layer. The names must match exactly, including upper and lower case.

var VindralEngine = importNamespace('VindralEngine');
var Project = VindralEngine.Project.RunningInstance;

function FlagIsOnScreen() {
    const histogram = Project.GetLayerOperatorByName('Scene', 'Camera', 'Histogram');
    return histogram != null && Project.GetObjectProperty(histogram, 'TemporalQualified');
}

Call it from wherever the script needs the answer, for example from a connector's function. Read this way, TemporalQualified and Qualified are true or false rather than text.