Video Detection Background Subtraction

Separates what appears or moves in front of a background learnt from a fixed camera: a person, a hand, an object. Outputs the video keyed by the mask, the mask in black and white, and the part of the frame in the foreground. For installations without a green screen, before Video Mix Over or Video Detection Blob.

Example: a dancer filmed by a fixed camera (1280 x 720), running average, learning rate 0.004, clean 2, fill 6, feather 3, 22 s after learn: the mask; then video out 1 laid by Video Mix Over on a still of a lake, without a green screen.

Each frame is compared with a model of the background (model); the difference gives the mask through threshold and softness, then clean, fill and feather tidy it. The first frame, learn, a change of frame size and the activation of the patch take the current frame as the background: the mask of that frame is black. Use a fixed camera: with a moving one, most of the frame is foreground. Frames up to 4096 x 2160 are analysed; larger ones pass through with a black mask and a foreground of 0. A frame costs 2.5 ms at 1280 x 720, 4 to 5 ms at 1920 x 1080 and 17 to 22 ms at 3840 x 2160 (the model takes 8 bytes per pixel): prefer a camera of 1920 x 1080 or less.

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).

mask

The mask as an opaque gray picture: white on the foreground, black on the background. video out 1 is the input with this mask as its alpha: the subject opaque, the background transparent.

process time

Total time used for the calculation of the module.

model

The background each frame is compared with (default running average).

  • running average: an average of the frames, which follows slow changes (light, shadows) at the learning rate. With update everywhere, a subject that stops fades into the background after a while.
  • previous frame: the previous frame: only what moves is detected.
  • learned: the frame taken by learn (or the first frame), never updated: a subject that stops stays detected.

learning rate

Share of each new frame in the running average, from 0.001 to 1 (default 0.01). It applies per processed frame: at 0.01 a 25 fps camera absorbs a change in about 4 seconds, a faster source sooner. Used by running average only.

learn

Takes the current frame as the background, with every model, when the button is pressed (not when it is released).

hold

When ON, the background is frozen: running average and previous frame stop learning.

update

Where the running average learns (default everywhere).

  • everywhere: in the whole frame.
  • background only: only where no foreground is detected: a still subject never fades into the background. But what stood in the frame at learn and then leaves stays foreground, a ghost that never fades: learn on the empty scene, or press learn again.

distance

How the difference between the frame and the background is measured (default color).

  • color: the largest of the red, green and blue differences.
  • luma: the difference of luma: a change of color at the same brightness is ignored.

threshold

Difference at and below which a pixel is background, from 0 to 1 (default 0.1, about 26 levels of 255). At 1 nothing is detected.

softness

Width of the ramp above threshold, from 0 to 1 (default 0.05): the mask goes from black at the threshold to white at threshold + softness. 0 gives a hard black and white mask.

threshold = 0.1, softness = 0.05
difference = 26 levels or less: mask = 0
difference = 32 levels: mask = 118
difference = 39 levels or more: mask = 255

clean

Radius of an opening, from 0 to 20 pixels (default 1): removes the white specks and lines narrower than 2 x clean + 1 pixels.

fill

Radius of a closing, from 0 to 20 pixels (default 2): fills the black holes and gaps narrower than 2 x fill + 1 pixels.

feather

Width of the soft edge of the mask, from 0 to 50 pixels (default 0).

foreground

Part of the frame in the foreground, from 0 (nothing) to 1 (the whole frame): the mean of the mask. A white square of 200 x 200 pixels on a 1920 x 1080 frame gives 0.0193.

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