问题
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