freeform op• 数据种类:image2d × image2d × image2d → bspline_surface
• 调用: import fullseye as fs; fs.ledger.fit_bspline_surface(x, y, z, kx=3, ky=3, smooth=None)(要直接调用实现,import bspline_surf; bspline_surf.fit_bspline_surface(x, y, z, kx=3, ky=3, smooth=None);从台账取用则 ops3d.get("fit_bspline_surface"))
对散布 (x, y, z) 最小二乘拟合双三次(默认)B 样条曲面(bisplrep)。
x, y, z : array_like
数量相同的散布样本坐标和高度。可以任意形状给出,内部展平为 1 维。
kx, ky : int
x/y 方向的 B 样条次数(1=线性, 3=三次)。点数不足 (kx+1)*(ky+1)
时自动降低(避免退化)。
smooth : float or None
平滑系数 s。None 为基于点数的自动值(_auto_surface_smooth)。
0.0 时通过全部点(偏向插值=容易过拟合),越大越平滑。
tck : list
[tx, ty, c, kx, ky]。传给 eval_bspline_surface / surface_residual。
ValueError
点数连线性曲面都不够(m<4)、x/y/z 长度不一致、非有限值,
或因共线、重复导致 FITPACK 退化而无法得到逼近时。
补充(已对照实现核实):
• 坐标系自由:x, y 为任意平面坐标(row/col 或实际尺寸均可),z 为高度。3 个数组用 ravel 展平为 1 维,因此网格输入和散布输入同样处理。
• 次数的自动降级在 (kx+1)*(ky+1) > m 期间把较大的一方(相等时为 kx)每次降 1,两者都为 1 时停止。降级不抛异常而是静默进行,实际次数可通过返回值 tck[3], tck[4] 确认。
• smooth=None 的自动值为 max(0, m - sqrt(2m))(FITPACK 的推荐)。该式以 z 的噪声方差约为 1 为前提,因此 z 单位小、残差平方和小的数据容易过度平滑。此时请显式传入较小的 smooth。
• FITPACK 的警告(迭代截断等)被忽略并返回 tck。异常全部转换为 ValueError,系数为空时也为 ValueError。
• 确定性(无随机数)。
• 后级为 eval_bspline_surface(求值)和 surface_residual(偏离量)。只需要全局低阶波纹度时有 fit_poly_surface / eval_poly_surface,但 tck 与多项式 dict 不兼容。
• 示例数据目录(下载 URL / 许可证) —— 2-D 用 skimage.data(BSD/公有领域)加合成图,3-D 给出真实数据源(Stanford/PDS 等)的下载 URL。
• 算子来历与参考文献 —— 该算子族所依据的研究/方法出处。
• bspline_freeform — py -3.11 examples_3d/bspline_freeform.py
bspline_surface 作为输入)fuse_to_voxel · eval_bspline_surface · surface_residual
freeform)eval_bspline_surface · surface_residual · fit_bspline_curve · eval_bspline_curve
*Provenance: bspline_surf.py — 3D 算子登记表。本条目由 tools/opdocs.py md 自动生成(请勿手工编辑)。*
© 2026 Kazufumi Furuse — Fullseye operator documentation. Licensed under Apache-2.0.