How to insure spline goes through points

时光怂恿深爱的人放手 提交于 2019-12-13 21:19:30

问题


I am trying to make a spline to compute the derivative of a contour of a part of an image. The catch is that I don't seem to know how to make the spline go through a certain point. I am using the scipy.interpolate library with the UnivariateSpline method.


回答1:


For UnivariateSpline use s=0 to force interpolation: UnivariateSpline(x, y, s=0). Or use InterpolatedUnivariateSpline, which is exactly equivalent.




回答2:


I suppose that your 'contour' can be arbitrary curve not necessarily a graph of a function. Then you need splprep which interpolate B-spline parametric curve, i.e. (x,y) = spline(t). UnivariateSpline is just for function splines, i.e. y = spline(x).



来源:https://stackoverflow.com/questions/31381406/how-to-insure-spline-goes-through-points

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!