Video Color Adaptive Threshold

Turns the video into a two-color mask with a threshold that follows the local brightness, or with a threshold chosen automatically for the whole frame (Otsu). Gives clean masks under uneven light, for example for Video Detection Blob or pixel mapping, and pencil-drawing or comic-ink looks.

Example: the street at night at the default settings; then with color mode source on background.

With mean and gaussian, a pixel is foreground when it is brighter than the mean of the pixels around it minus offset: the dark details of an area become lines whatever the lighting of the area. At the default settings a street scene gives a white pencil drawing with black lines (76 % of the pixels white).

Settings

bypass

Bypasses the module processing when activated (ON).

  • OFF (0): Module processes normally
  • ON (1): Input passes directly to output without processing

video in

Video input flow(s).

video out

Video output flow(s).

process time

Total time used for the calculation of the module.

method

How the threshold is chosen (mean by default).

  • mean: the mean of the square of 2 x radius + 1 pixels around each pixel, minus offset. About 2.4 ms per frame at 1920 x 1080 and 8.6 ms at 3840 x 2160.
  • gaussian: a smoother local mean (three box means in a row, close to a Gaussian weighting), minus offset. The picture is close to mean; about 3.2 ms and 12.7 ms.
  • otsu: one threshold for the whole frame, chosen to best separate the dark and the bright pixels and given by level; radius and offset are not used. About 3 ms and 9.2 ms.

With mean and gaussian a flat area is foreground when offset is positive, since its local mean equals its pixels: to separate a flat object from a flat background, use otsu.

radius

Half size of the neighborhood of mean and gaussian, from 1 to 500 pixels (default 15, logarithmic fader): the square is 2 x radius + 1 pixels wide. Take it larger than the details to bring out: 1 keeps only the finest texture (a nearly white frame), 100 separates large shapes. The time does not depend on it. Not used by otsu.

offset

Margin of the threshold of mean and gaussian, from -0.5 to 0.5 (default 0.03), as a fraction of full brightness (0.1 is about 26 levels of 255): a pixel is foreground when it is brighter than its local mean minus the offset. A positive offset makes the flat areas foreground, so that only the dark details stand out; a negative one keeps only what is clearly brighter than its surroundings (-0.1 left 6.6 % of a street scene white). 0.5 makes the whole frame foreground, -0.5 the whole frame background. Not used by otsu.

smooth

Radius of a box blur applied to the image before the threshold, from 0 to 10 pixels (default 1), against noise and speckle: 5 leaves about 5 times fewer isolated pixels than 0. 0 means no blur.

channel

Value compared with the threshold (luma by default).

  • luma: the brightness of each pixel.
  • red: the red channel. With otsu, a red object on a blue background becomes foreground.
  • green: the green channel.
  • blue: the blue channel. With otsu, the blue background of the example above becomes foreground.

invert

Swaps foreground and background (off by default).

color mode

How the mask is drawn (colors by default).

  • colors: foreground where the mask is set, background elsewhere.
  • source on background: the source where the mask is set, background elsewhere: a cut-out, or a comic-ink look at the default settings.
  • foreground on source: foreground where the mask is set, the source elsewhere.

foreground

Color of the pixels above the threshold with colors and foreground on source (white by default). A transparent color gives a frame with alpha.

background

Color of the other pixels with colors and source on background (black by default). A transparent background ($00000000) gives a frame with alpha, transparent where the mask is not set.

level

Output: the threshold otsu chose for the last frame, from 0 to 1, as a fraction of full brightness; 0 with mean and gaussian. A horizontal gradient from black to white gives about 0.5: its left half background, its right half foreground.

Common Settings

info

show manual

Button. Opens the manual page of the selected object (or of its parent module for a control) in the web browser. If no page exists for this object, an error is traced in the trace panel.

For more details about information/help creation, see create-help-file.

description

Free multi-line text attached to the module, saved with the patch. When it is not empty, it is shown as the hint of the module (mouse over the module header in the patch) in place of the default module hint, even when the module hints are disabled.

ID's

visible only in god mode, see setup-panel-tab-expert.

unique ID

Read-only, not saved. Current private numeric ID of the object, used internally to identify it (for example as the target of a bind ID).

preset ID

Read-only, not saved. Private ID used to store and recall the values of this control in presets.

recreate ID

Button. Generates a new unique ID, original ID and preset ID for the object. Use it if you experience difficulties in Polyphonic mode or if two objects share the same ID. Preset values and binds referring to the old IDs are lost.

Object Remote Address

absolute

Read-only, not saved. Absolute address of the object in the Usine objects tree, built from the workspace root. This is the address to use to reach the object from scripts, the objects panel or remote messages. Only shown for objects that are registered in the objects list. See objects-address.

local

Read-only, not saved. Address of the object relative to the current patch, valid inside that patch only. See objects-address.

user addr

Free user-defined address for the object (empty by default). When set, the object is also registered in the objects tree under this name, so it can be reached independently of its position in the workspace (the value is also reported in the mouse-over and mouse-down chunks). Changing it rebuilds the objects list. Only available on objects that support a user address. See objects-address.

See also

version 7.0.250921

Edit All Pages