tps_fit — 3D deform op

• 数据种类:points × points → deformation

• 调用: import fullseye as fs; fs.ledger.tps_fit(src_ctrl, dst_ctrl, lam=0.0)(要直接调用实现,import deform3d; deform3d.tps_fit(src_ctrl, dst_ctrl, lam=0.0);从台账取用则 ops3d.get("tps_fit"))

用法

由控制点对应拟合 3D Thin-Plate-Spline。

将移动侧的控制点 src_ctrl 映射到固定侧 dst_ctrl 的 TPS 系数,通过对鞍点系统做最小二乘(numpy.linalg.lstsq)求解得到。λ=0 时在控制点上严格插值(tps_warp(model, src_ctrl) == dst_ctrl),λ>0 时进行平滑。

参数:

src_ctrl: (K,3) 控制点(变形的起点,TPS 的核中心 p_i)。

dst_ctrl: (K,3) 对应的目标点(变形的终点 v_i)。

lam: 正则化系数 λ≥0。将 λ 加到核矩阵 K 的对角线上。越大

变形越平滑(对控制点的拟合越宽松)。

返回值:

model: dict。键为

"ctrl" (K,3) 核中心 p_i,

"w" (K,3) 非线性(弯曲)系数,

"a" (4,3) 仿射系数([平移; 线性部分],a[0]=c, a[1:4]=Aᵀ),

"lam" 所用的 λ。

异常:

ValueError: 形状不一致、控制点数不足、非有限值,或控制点数

超过 TPS_MAX_CTRL(10,000)(稠密的 (K+4)² 系统为 O(K³)。

请先对对应点抽稀再传入 — TPS 本来的用法是用稀疏控制点

表示平滑的变形)。

参考(示例数据、文献)

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

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

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

• nonrigid_deform — py -3.11 examples_3d/nonrigid_deform.py

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

fuse_to_voxel · tps_warp

同类别(deform)

tps_warp · register_nonrigid · register_cpd_rigid


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

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