[SciPy-User] how can I create B-splines of mutidimensional values?
Mon Nov 28 05:38:55 CST 2011
scipy.ndimage.map_coordinates() performs b-spline interpolation of regularly-spaced data (spline order 0-5, with several options for boundary conditions). The syntax can seem a bit tricky at first, and you need to watch out for ringing artifacts at sharp transitions (as these are interpolating splines), but it should do the trick.
On Nov 28, 2011, at 6:30 AM, Kay F. Jahnke wrote:
> Hi group!
> I have the following problem: I have multidimensional values which I have
> sampled over a 2D grid. Now I want to interpolate the values (using B-spline
> interpolation) for arbirary (x,y) locations.
> Obviously this can be done by creating a separate B-spline for each dimension of
> of the values, interpolating at (x,y) and putting the results of the
> interpolations together, forming the multidimensional result.
> For performance reasons, this approach isn't optimal, though. Since the splines
> are evaluated at the same location, a fair deal of the calculations would be
> identical. But I haven't found a way to create a B-spline of the
> multidimensional values to exploit the fact that I'm evaluating several splines
> at the same position.
> I suppose my problem would be quite common - one typical case would be RGB image
> data: it would be silly to have separate splines for the R,G and B channels and
> triplicate the part of the calculation which only depends on the position where
> a value is interpolated. What I'm missing is a mechanism to calculate the spline
> with n-dimensional coefficients and interpolation routines yielding
> multidimensional values when used with these n-dimensional spline coefficients.
> Am I missing something? I'm not very proficient with numpy/scipy, so maybe I
> just can't see the obvious...
> Helpful hints welcome.
> SciPy-User mailing list
More information about the SciPy-User