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.