当前位置: 首页>>代码示例 >>用法及示例精选 >>正文


Python skimage.measure.CircleModel用法及代码示例


用法:

class skimage.measure.CircleModel

基础:skimage.measure.fit.BaseModel

二维圆的总最小二乘估计量。

圆的函数模型为:

r**2 = (x - xc)**2 + (y - yc)**2

此估计器最小化从所有点到圆的平方距离:

min{ sum((r - sqrt((x_i - xc)**2 + (y_i - yc)**2))**2) }

求解参数最少需要 3 个点。

注意

使用 [1] 中给出的球形估计的 2D 版本进行估计。

参考

1

Jekel, Charles F. Obtaining non-linear orthotropic material models for pvc-coated polyester via inverse bubble inflation. Thesis (MEng), Stellenbosch University, 2016. Appendix A, pp. 83-87. https://hdl.handle.net/10019.1/98627

例子

>>> t = np.linspace(0, 2 * np.pi, 25)
>>> xy = CircleModel().predict_xy(t, params=(2, 3, 4))
>>> model = CircleModel()
>>> model.estimate(xy)
True
>>> tuple(np.round(model.params, 5))
(2.0, 3.0, 4.0)
>>> res = model.residuals(xy)
>>> np.abs(np.round(res, 9))
array([0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
       0., 0., 0., 0., 0., 0., 0., 0.])

属性

params元组

圆形模型参数按以下顺序 xc、yc、r。

相关用法


注:本文由纯净天空筛选整理自scikit-image.org大神的英文原创作品 skimage.measure.CircleModel。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。