swarmflow op• 資料種類:any × scalar × scalar → table
• 呼叫: import fullseye as fs; fs.ledger.swarm_field_from_tracks(frames, res: 'float', frame_dt: 'float', center=(0.0, 0.0), grid_step=None, h=None, threshold: 'float' = 0.3, max_disp_px=None, min_count: 'int' = 3, outlier_k: 'int' = 12, outlier_threshold: 'float' = 3.0) -> 'dict'(要直接呼叫實作,import swarmflow; swarmflow.swarm_field_from_tracks(frames, res: 'float', frame_dt: 'float', center=(0.0, 0.0), grid_step=None, h=None, threshold: 'float' = 0.3, max_disp_px=None, min_count: 'int' = 3, outlier_k: 'int' = 12, outlier_threshold: 'float' = 3.0) -> 'dict';從台帳取用則 opsdrive.get("swarm_field_from_tracks"))
俯視影格序列 → 偵測個體(blob2d 的連通元件 + 亮度質心)→ 與相鄰影格依互為最近鄰連接 → 以 SPH 核將速度映射到網格。
連接條件: A 中某點的最近鄰是 B 中的點,且該 B 點的最近鄰也是這個 A 點(相互),並且位移不超過 max_disp_px (預設 = 偵測到的點之間最近鄰間距中位數的 0.45 倍。一幀內的移動超過此值就會配錯 = 追蹤的極限)。將所有幀的配對速度匯成一個母體求平均(定常流的前提)。配錯的配對速度會差一個數量級(實測: 均勻撒布 1300 個時,2 % 的配對偏差 1~3 m/s,網格的 rms 誤差達到 U 的 16 %),因此在轉移到網格之前以 正規化中位數檢驗(PIV 的慣例,與最近 outlier_k 個速度的中位數的偏差 / 該鄰域偏差的中位數 > outlier_threshold) 剔除。
Args:
frames: 相同尺寸的 (H, W) 幀序列(2 幀以上)。
res: 像素尺寸 [m/px]。
frame_dt: 幀間隔 [s]。
center: 影像中心的世界座標 [m]。
grid_step: 網格間距 [m] (預設 = 個體間距的估計值)。
h: 轉移到網格的核的 h [m] (預設 = grid_step)。
threshold: 二值化閾值(最小~最大之間的比例)。
max_disp_px: 一幀移動的上限 [px]。
min_count: 網格支撐內所需的速度個數。
outlier_k: 中位數檢驗所用的近鄰數(0 表示不檢驗)。
outlier_threshold: 檢驗的閾值。
Returns:
速度場 dict(module 的約定)+ points (M, 2) / point_velocity (M, 2)(連接配對的中點與速度)、
n_detected(每幀)、n_linked、n_outliers(被中位數檢驗剔除的配對)、n_rejected_blobs、
spacing(個體間距的估計 [m])。
• 範例資料目錄(下載 URL / 授權) —— 2-D 用 skimage.data(BSD/公有領域)加合成圖,3-D 給出真實資料源(Stanford/PDS 等)的下載 URL。
• 運算子來歷與參考文獻 —— 該運算子族所依據的研究/方法出處。
• 演算法的正典(作者、年份)與用途見上面的族使用指南。
• poc_swarm_obstacle_from_flow — py -3.11 examples/poc_swarm_obstacle_from_flow.py
table 作為輸入)course_layout · course_occupancy · course_contains · world_build · world_camera · world_move · lidar_scan · rss_longitudinal_same
swarmflow)sph_kernel · sph_density_pressure · swarm_simulate · swarm_render_overhead · swarm_field_from_piv · potential_flow_cylinder · velocity_deficit_map · stagnation_from_centerline
*Provenance: swarmflow.py — DRIVE 運算子登記表。本條目由 tools/opdocs.py md 自動產生(請勿手動編輯)。*
© 2026 Kazufumi Furuse — Fullseye operator documentation. Licensed under Apache-2.0.