Last modified: December 02, 2024
This article is written in: 🇺🇸
Thin Plate Spline Interpolation
Thin Plate Spline (TPS) Interpolation is a non-parametric, spline-based method for interpolating scattered data in two or more dimensions. Originally arising in the context of fitting a smooth surface through a set of points in R2, thin plate splines can be generalized to higher dimensions. The name "thin plate" comes from the physical analogy of bending a thin sheet of metal so that it passes through given points with minimal bending energy.
While polynomial methods or radial basis functions can also perform interpolation, TPS stands out by providing a minimal "bending energy" solution, leading to a surface that is not only guaranteed to pass through the given points but is also as flat (smooth) as possible away from these points. This makes thin plate splines particularly favored in fields like image warping, geometric modeling, and shape deformation.
Conceptual Illustration
Imagine you have a set of control points (xi,yi,zi) in 3D space, where (xi,yi) represent spatial coordinates and zi is the function value at that location. Thin plate spline interpolation finds a surface z=f(x,y) that exactly passes through all these points. If you imagine the surface as a thin metal sheet pinned at these points, the TPS solution is the shape the sheet would naturally take if it were free to bend but not stretch, minimizing the total bending energy:
The resulting surface is smooth, continuous in its derivatives, and tends to flatten out smoothly between data points.
Mathematical Formulation
Given a set of N data points (xi,yi,zi)Ni=1, where no two points coincide, we want to find a function:
f(x,y)=α0+α1x+α2y+N∑i=1wiϕ(‖(x,y)−(xi,yi)‖)
that interpolates the given data. Here:
- The α0,α1,α2 terms represent a polynomial of degree 1 (a plane) that gives the global trend.
- The function ϕ(r) is a radial basis function chosen as:
ϕ(r)=r2ln(r)
which is the fundamental solution associated with the thin plate spline bending energy in 2D.
- The wi are the coefficients for the radial basis part.
This f(x,y) must satisfy the interpolation conditions:
f(xi,yi)=zi,i=1,…,N.
Additionally, to ensure a unique solution and remove degeneracies, f(x,y) must satisfy:
N∑i=1wi=N∑i=1wixi=N∑i=1wiyi=0
This leads to a linear system for the unknown parameters α0,α1,α2,w1,…,wN.
Derivation
I. Energy Minimization:
Thin plate splines arise from minimizing a bending energy functional:
J[f]=∫∫(∂2f∂x2)2+2(∂2f∂x∂y)2+(∂2f∂y2)2dxdy, subject to the interpolation constraints f(xi,yi)=zi.
II. Variational Problem:
Solving the Euler-Lagrange equations associated with the energy minimization under the interpolation conditions yields the form of the TPS. The solution can be shown to be a polynomial of degree at most 1 plus a weighted sum of radial basis functions ϕ(r)=r2ln(r).
III. Linear System:
Substitute f(x,y) into the interpolation conditions. This produces a system of N+3 linear equations (for wi,α0,α1,α2):
[0P⊤ PK][α w]=[0 z]
where:
- P is the N×3 matrix with rows [1,xi,yi].
- K is the N×N matrix with entries Kij=ϕ(‖(xi,yi)−(xj,yj)‖).
- z is the vector of observed zi.
- α is [α0,α1,α2]⊤ and w=[w1,…,wN]⊤.
Solving this system yields the TPS coefficients.
Algorithm Steps
I. Input:
A set of points (xi,yi,zi), i=1,…,N
II. Form the Matrices:
- Compute the N×N kernel matrix K with Kij=ϕ(√(xi−xj)2+(yi−yj)2) and ϕ(r)=r2ln(r).
- Form the N×3 matrix P with rows [1,xi,yi].
- Construct the augmented block matrix and vector as described above.
III. Solve the Linear System:
- Solve the linear system for α and w.
- This gives all parameters needed for the TPS surface.
IV. Interpolation:
To find f(x,y) at a new point (x,y):
f(x,y)=α0+α1x+α2y+N∑i=1wiϕ(√(x−xi)2+(y−yi)2).
Example
Given Data: Suppose we have 4 points:
(0,0,0),(1,0,1),(0,1,1),(1,1,2).
I. Compute K:
For each pair of points, calculate distance r and then ϕ(r)=r2ln(r). Handle r=0 carefully (ϕ(0)=0 by definition).
II. Compute P:
P=[100110101111]
III. Form the linear system and solve for α0,α1,α2,wi.
IV. Once solved, you have a TPS surface that passes exactly through these four points. For any (x,y), use the formula to predict f(x,y).
(This is a simplified conceptual example; actual numbers require careful computation.)
Advantages
- TPS yields an infinitely differentiable surface, minimizing bending energy, and producing visually pleasing, smooth interpolants.
- The method exactly passes through all given data points.
- TPS works with scattered data without needing a regular grid.
- It generalizes easily to higher dimensions by changing the form of ϕ(r), making it extensible.
Limitations
- TPS requires solving a (N+3)×(N+3) linear system, which can be expensive for large N.
- The system matrix may become ill-conditioned with many close points, often necessitating regularization like TPS smoothing splines.
- Changing or adding one point affects the entire solution, as TPS is a global method, lacking local control like piecewise methods unless combined with domain decomposition techniques.