Skip to content Skip to sidebar Skip to footer

How To Insure Spline Goes Through Points

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.

Solution 1:

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


Solution 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).


Post a Comment for "How To Insure Spline Goes Through Points"