warp_by_plane — 3D plane_sweep_stereo op

• 数据种类:image2d → image2d

• 调用: import fullseye as fs; fs.ledger.warp_by_plane(img: 'np.ndarray', H: 'np.ndarray', order: 'int' = 1, cval: 'float' = nan) -> 'np.ndarray'(要直接调用实现,import plane_sweep; plane_sweep.warp_by_plane(img: 'np.ndarray', H: 'np.ndarray', order: 'int' = 1, cval: 'float' = nan) -> 'np.ndarray';从台账取用则 ops3d.get("warp_by_plane"))

用法

用单应 H 对 img 做逆向 warp。→ out[y,x] = img(H·(x,y,1))(bilinear)。

H 是输出(ref)像素 → 输入(src)像素的映射。视场外为 cval(默认 NaN)。

对每个输出像素 (x=列, y=行) 求 q = H @ (x, y, 1)、(sx, sy) = (q0/q2, q1/q2),用 scipy.ndimage.map_coordinates 对输入图像的 (行 sy, 列 sx) 插值填充(因为是逆向扭曲,不会出现空洞)。输出形状与输入相同,为 (h,w)。将同一模块的 plane_homography 返回的 H (ref 像素 → src 像素)直接传入,即得到“把 src 带到 ref 视点的图像”。

• img:(H,W) 的 2-D 灰度(转换为 float)。空、非 2-D 时 ValueError。

• H:非 (3,3) 时 ValueError。

• order:插值阶数(默认 1 = bilinear)。由于以 prefilter=False 调用,即使指定 2 以上,也是省略样条预处理的近似(偏向平滑)。

• cval:映射到输入范围外的像素,以及 |q2| < 1e-12(飞向无穷远的像素)所填入的值。默认为 NaN,因此后续可以用 np.isfinite 区分“未能取得对应的像素”。

plane_sweep_depth 对每个候选深度用本函数扭曲 src,并以 |I_ref - warp(I_src)| 作为 photo-consistency 代价。

背景知识指南(该算子背后的物理与约定)

• depth_sensors — 深度传感器知识 —— 测距原理、实机数值、缺测的表现

参考(示例数据、文献)

• 示例数据目录(下载 URL / 许可证) —— 2-D 用 skimage.data(BSD/公有领域)加合成图,3-D 给出真实数据源(Stanford/PDS 等)的下载 URL。

• 算子来历与参考文献 —— 该算子族所依据的研究/方法出处。

可运行的示例(实际调用该算子并已验证的样例)

• motion_scene — py -3.11 examples_3d/motion_scene.py

类型可衔接的下一个算子(可接受 image2d 作为输入)

fuse_to_voxel · fit_poly_surface · eval_poly_surface · surface_form_error · background_flatten · polar_unwrap · fit_zernike · matcap_shade

同类别(plane_sweep_stereo)

plane_sweep_depth


*Provenance: plane_sweep.py — 3D 算子登记表。本条目由 tools/opdocs.py md 自动生成(请勿手工编辑)。*

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