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' (implementation को सीधे call करना हो तो import videostream; videostream.background_subtraction_window(video, window: 'int' = 5, threshold: 'float' = 0.1) -> 'np.ndarray', registry से लेना हो तो opsvideostream.get("background_subtraction_window"))

उपयोग

causal window-median background → हर frame का 0/1 foreground mask (T, H, W) (video)।

हर frame t के लिए, पिछले window frames (max(0, t-window+1) .. t, उस frame को भी शामिल करके) का pixel-wise median background bg माना जाता है, और |frame_t - bg| > threshold को 1, बाकी सबको 0 किया जाता है। भविष्य के frames नहीं देखे जाते (causal), इसलिए शुरुआत में जितने frames कम हैं उतना window छोटा होता है।

• video: (T, H, W) array, या समान shape और समान dtype के 2-D frames की list। uint8/uint16 को dtype के अधिकतम मान से [0, 1] में, float को सीधे [0, 1] में clip किया जाता है। colour (T, H, W, C) स्वीकार नहीं है। NaN/Inf पर ValueError।

• window: 1 से 4096 तक का int (bool नहीं)। 1 होने पर background = स्वयं frame, इसलिए सभी pixel 0। frames की संख्या सम होने पर median बीच के 2 मानों का औसत है।

• threshold: [0, 1] की intensity इकाई में (uint8 के लिए /255 से बदलें)।

• return value: (T, H, W) float64 के 0 / 1।

• विफलता: ValueError (shape, dtype, range, non-finite)।

धीरे चलने वाली वस्तुएँ window frames के भीतर background में घुल जाती हैं, उस स्थिति में running_gaussian_foreground (selective update) या exponential_foreground लें। background स्वयं चाहिए तो temporal_median_window।

उपयोग की विस्तृत guide

• video_streaming family guide

पृष्ठभूमि guides (इस op के पीछे की physics और conventions)

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

• mv_frame_grabbers — Frame grabber boards (optics नहीं, पर यही तय करते हैं कि capture हो भी सकता है या नहीं)

• mv_standards — Camera interface standards और उनके पीछे की संस्थाएँ

संदर्भ (sample data, साहित्य)

• Sample data catalog (DL URL / license) — 2-D के लिए skimage.data (BSD/public) + synthetic, 3-D के लिए real data sources (Stanford/PDS आदि) के DL URL।

• Operators का स्रोत और संदर्भ — इस op family के मूल research/methods के स्रोत।

• Algorithm का मानक स्रोत (लेखक, वर्ष) और उपयोग ऊपर की family usage guide में दिए गए हैं।

चलाए जा सकने वाले उदाहरण (verified samples जो सच में यह op call करते हैं)

• video_streaming — py -3.11 examples/video_streaming.py

वे अगले ops जिनसे type जुड़ता है (video को input के रूप में लेते हैं)

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

इसी category के (window)

temporal_median_window · moving_average_window


*Provenance: videostream.py — VIDEOSTREAM operator registry. यह per-op note tools/opdocs.py md से अपने-आप generate होता है (हाथ से edit न करें)।*

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