unwrap_phase_2d — 3D structured_light op

• 数据种类:image2d → image2d

• 调用: import fullseye as fs; fs.ledger.unwrap_phase_2d(wrapped, mask=None) -> 'np.ndarray'(要直接调用实现,import fringe; fringe.unwrap_phase_2d(wrapped, mask=None) -> 'np.ndarray';从台账取用则 ops3d.get("unwrap_phase_2d"))

用法

用 skimage.restoration.unwrap_phase 把卷绕相位展开为连续相位。

wrapped:wrapped_phase 的输出(2D)。可以含 NaN(作为无效像素处理)。

mask: 可省略。True = 有效像素(与 numpy masked array 的惯例相反的直观方向)。

NaN 像素和 mask=False 像素视为无效,从解包裹中排除,输出中返回 NaN。

返回值:连续相位(2D float)。无效像素为 NaN。全局偏移(+2πm)的不确定性仍然存在。

步骤:若没有无效像素(wrapped 的非有限值 ∪ mask == False),则直接调用 skimage.restoration.unwrap_phase(arr)。若有,则把无效像素用 0 填充后作为 numpy.ma 的 masked array 传入(skimage 会把 masked 像素从展开中排除),再把输出的无效像素恢复为 NaN。

校验:在无法 import scikit-image 的环境中抛出 RuntimeError(而不是 ImportError)。wrapped 不是 2-D、mask 形状不同、全部像素无效 (没有可解包裹的像素)时抛出 ValueError。

前提(Itoh 条件):相邻有效像素的真实相位差小于 π。在陡峭阶跃、深孔、遮挡边界处会误判 2π 跳变,其后的整个区域偏移 2πm。被掩模分成孤岛的区域之间的相对级次无法确定(每个孤岛有独立的偏移)。需要绝对性时,请使用 graycode_decode → absolute_phase 的逐像素独立级次确定。

用法:wrapped_phase → 本 op → phase_to_height(同模块的函数,height = k (phase - ref_phase))。用相同步骤展开参考面并相减, 全局偏移即被抵消。decode_fringe 以 1 次调用完成这一链条。

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

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

参考(示例数据、文献)

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

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

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

• structured_light — py -3.11 examples_3d/structured_light.py

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

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

同类别(structured_light)

wrapped_phase · graycode_decode · decode_fringe · synthesize_fringes · absolute_phase · triangulate_column


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

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