background_subtraction_window — VIDEOSTREAM window op

Data kinds: videovideo

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

> The detailed description below is the original text — the summary and the headings are translated.

フレーム `t ごとに、直近 window 枚(max(0, t-window+1) .. t`、**そのフレーム

自身を含む**)の画素ごとの中央値を背景 `bg とし、|frame_t - bg| > threshold`

を 1、それ以外を 0 にする。未来のフレームは見ない(因果的)ので、先頭では

枚数が足りないぶん窓が短い。

• `video: (T, H, W)` の配列、または同形・同 dtype の 2-D フレームの list。

uint8/uint16 は dtype の最大値で `[0, 1] に、float はそのまま [0, 1]` に

クリップ。カラー `(T, H, W, C) は受けない。NaN/Inf は ValueError`。

• `window`: 1〜4096 の int(bool 不可)。1 だと背景 = 自分なので全画素 0。

偶数枚のときの中央値は中間 2 値の平均。

• `threshold: [0, 1] の強度単位(uint8 なら /255` 換算)。

• 返り値: `(T, H, W)` float64 の 0 / 1。

• 失敗: `ValueError`(形・dtype・範囲・非有限)。

ゆっくり動く物体は `window` 枚以内に背景へ溶けるので、その場合は

`running_gaussian_foreground(選択的更新)か exponential_foreground` を。

背景そのものが要るなら `temporal_median_window`。

Detailed usage guide

video_streaming family guide

Background guides (the physics and conventions behind this op)

mv_cables — ケーブル(規格・速度・給電・ロボットケーブル)

mv_frame_grabbers — フレームグラバーボード(光学系ではないが、撮れるかを決める)

mv_standards — カメラインターフェースの規格と団体

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