fit_poly_surface — 3D surface_fit op

• 数据种类:image2d × image2d × image2d → poly_surface

• 调用: import fullseye as fs; fs.ledger.fit_poly_surface(x, y, z, degree=2)(要直接调用实现,import match3d; match3d.fit_poly_surface(x, y, z, degree=2);从台账取用则 ops3d.get("fit_poly_surface"))

用法

散布 (x,y,z) → z=f(x,y) 多项式最小二乘。返回 model(coef/powers/degree/rms/pv)。

用 lstsq 拟合基 {x^i·y^j : i + j <= degree}(项数 (degree+1)(degree+2)/2。degree=1 为 3 项的平面, 2 为 6 项的 2 次曲面)。x, y, z 只要元素数相同,形状不限(内部 ravel。网格可直接传入 np.mgrid 的输出)。返回 dict: coef (T,) 系数,powers 为各系数的 (i, j)(项 x**i * y**j), degree,rms 为残差 RMS,pv 为残差的 peak-to-valley(max − min)。单位同 z。

• 点数少于项数时会静默返回最小范数解。x, y 的数量级大时高次会病态

(先将坐标中心化、归一化)。不检查 NaN。

后续: 用 eval_poly_surface(model, x, y) 在任意点求值。网格上的高度场由 surface_form_error / background_flatten 在内部调用本函数。

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

• blas_threads_and_memory — 矩阵分解为何慢 —— BLAS 线程、缓存、内存布局

参考(示例数据、文献)

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

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

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

• contours_to_terrain — py -3.11 examples_3d/contours_to_terrain.py

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

fuse_to_voxel · eval_poly_surface

同类别(surface_fit)

eval_poly_surface · surface_form_error · background_flatten


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

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