fit_bspline_surface — 3D freeform op

• Data kinds: image2d × image2d × image2d → bspline_surface

• Call: import fullseye as fs; fs.ledger.fit_bspline_surface(x, y, z, kx=3, ky=3, smooth=None) (implementation को सीधे call करना हो तो import bspline_surf; bspline_surf.fit_bspline_surface(x, y, z, kx=3, ky=3, smooth=None), registry से लेना हो तो ops3d.get("fit_bspline_surface"))

उपयोग

बिखरे (x, y, z) पर bicubic (default) B-spline surface का least squares fit (bisplrep)।

Parameters

x, y, z : array_like

बराबर संख्या के scattered sample coordinates और ऊँचाइयाँ। कोई भी shape दी जा सकती है, भीतर 1-dimensional बना दिया जाता है।

kx, ky : int

x/y दिशा में B-spline degree (1=linear, 3=cubic)। points की संख्या (kx+1)*(ky+1) से

कम हो तो अपने-आप घटा दी जाती है (degeneracy से बचने के लिए)।

smooth : float or None

smoothing factor s। None पर points की संख्या पर आधारित automatic मान (_auto_surface_smooth)।

0.0 पर सभी points से गुज़रता है (interpolation की ओर = overfitting की आशंका), जितना बड़ा उतना smooth।

Returns

tck : list

[tx, ty, c, kx, ky]। eval_bspline_surface / surface_residual को दें।

Raises

ValueError

जब points linear surface के लिए भी कम हों (m<4), x/y/z की लंबाई मेल न खाए, non-finite मान हों,

या collinear या duplicate points से FITPACK degeneracy के कारण approximation न मिले।

अतिरिक्त (implementation से पुष्टि):

• coordinate system स्वतंत्र है: x, y कोई भी planar coordinates (row/col या वास्तविक माप), z ऊँचाई। 3 arrays ravel से 1-dimensional बनते हैं, इसलिए grid input और scattered input एक जैसे संभाले जाते हैं।

• degree का automatic घटाव (kx+1)*(ky+1) > m रहने तक बड़े वाले को (बराबर हो तो kx को) 1-1 करके घटाता है, और दोनों 1 हो जाने पर रुकता है। घटाव exception के बजाय चुपचाप होता है, इसलिए वास्तविक degree लौटे tck[3], tck[4] में देखी जा सकती है।

• smooth=None का automatic मान max(0, m - sqrt(2m)) है (FITPACK की सिफ़ारिश)। यह सूत्र मानता है कि z के noise का variance लगभग 1 है, इसलिए छोटी z unit और छोटे residual sum of squares वाले data में over-smoothing आसानी से होता है। ऐसे में स्पष्ट रूप से छोटा smooth दें।

• FITPACK की warnings (iteration cut-off आदि) दबा दी जाती हैं और tck लौटाया जाता है। सभी exceptions ValueError में बदले जाते हैं, coefficients ख़ाली हों तब भी ValueError।

• deterministic (कोई random नहीं)।

• आगे के चरण eval_bspline_surface (evaluation) और surface_residual (deviation) हैं। केवल global low-order waviness चाहिए तो fit_poly_surface / eval_poly_surface हैं, पर tck और polynomial dict आपस में compatible नहीं हैं।

संदर्भ (sample data, साहित्य)

• Sample data catalog (DL URL / license) — 2-D के लिए skimage.data (BSD/public) + synthetic, 3-D के लिए real data sources (Stanford/PDS आदि) के DL URL।

• Operators का स्रोत और संदर्भ — इस op family के मूल research/methods के स्रोत।

चलाए जा सकने वाले उदाहरण (verified samples जो सच में यह op call करते हैं)

• bspline_freeform — py -3.11 examples_3d/bspline_freeform.py

वे अगले ops जिनसे type जुड़ता है (bspline_surface को input के रूप में लेते हैं)

fuse_to_voxel · eval_bspline_surface · surface_residual

इसी category के (freeform)

eval_bspline_surface · surface_residual · fit_bspline_curve · eval_bspline_curve


*Provenance: bspline_surf.py — 3D operator registry. यह per-op note tools/opdocs.py md से अपने-आप generate होता है (हाथ से edit न करें)।*

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