background_subtraction_window — VIDEOSTREAM window op

• Data kinds: video → video

• Call: import fullseye as fs; fs.ledger.background_subtraction_window(video, window: 'int' = 5, threshold: 'float' = 0.1) -> 'np.ndarray' (to call the implementation directly, import videostream; videostream.background_subtraction_window(video, window: 'int' = 5, threshold: 'float' = 0.1) -> 'np.ndarray'; from the registry, opsvideostream.get("background_subtraction_window"))

Usage

Causal window-median background → per-frame 0/1 foreground masks (T, H, W) (video).

For each frame t, the per-pixel median of the most recent window frames (max(0, t-window+1) .. t, including that frame itself) is taken as the background bg, and |frame_t - bg| > threshold is set to 1, everything else to 0. Future frames are not looked at (causal), so at the start the window is shorter by the number of frames that are missing.

• video: a (T, H, W) array, or a list of 2-D frames of the same shape and same dtype. uint8/uint16 is mapped to [0, 1] by the dtype maximum, float is clipped to [0, 1] as is. Colour (T, H, W, C) is not accepted. NaN/Inf gives ValueError.

• window: int from 1 to 4096 (not bool). With 1 the background = the frame itself, so all pixels are 0. For an even number of frames the median is the mean of the 2 middle values.

• threshold: in intensity units of [0, 1] (for uint8, converted as /255).

• Returns: (T, H, W) float64 of 0 / 1.

• Failure: ValueError (shape, dtype, range, non-finite).

Slowly moving objects melt into the background within window frames; in that case use running_gaussian_foreground (selective update) or exponential_foreground. If you need the background itself, temporal_median_window.

Detailed usage guide

• video_streaming family guide

Background guides (the physics and conventions behind this op)

• mv_cables — Cables (standards, speed, power delivery, robot cables)

• mv_frame_grabbers — Frame grabber boards (not optics, but they decide whether you can capture at all)

• mv_standards — Camera interface standards and the bodies behind them

References (sample data, literature)

• Sample-data catalog (download URLs / licences) — 2-D uses skimage.data (BSD/public domain) plus synthetic images; 3-D lists download URLs for real data sources (Stanford, PDS, …).

• Operator provenance and references — the sources of the research/methods this op family came from.

• The canonical algorithm (author, year) and its uses are named in the family usage guide above.

Runnable examples (verified samples that actually call this op)

• video_streaming — py -3.11 examples/video_streaming.py

Ops the type connects to (they accept video as input)

temporal_median_window · moving_average_window · frame_difference_causal · exponential_background · exponential_foreground · running_mean_std · optical_flow_magnitude_stream · motion_history_image

Same category (window)

temporal_median_window · moving_average_window


*Provenance: videostream.py — VIDEOSTREAM operator registry. This per-op note is generated by tools/opdocs.py md (do not hand-edit).*

© 2026 Kazufumi Furuse — Fullseye operator documentation. Licensed under Apache-2.0.