Download Interpolation: Discrete to Continuous Data | CMSC 427 and more Study notes Computer Graphics in PDF only on Docsity!
Interpolation
Interpolation: Discrete to
Continuous
• Given some values at some points,
determine continuous range of values.
• Uses:
- Synthesis
- Morph between two images
- Interpolate a curve between points
- Continuous range of values between
vertices.
Linear Interpolation in 1D
• Example: fading.
Linear Interpolation
• Given a function defined at two points,
f(0), f(1), we want to find values for
intermediate points, eg., f(x), 0 < x < 1.
• Can take weighted average:
f(x) = (1-x)f(0) + xf(1) = f(0) + x(f(1)-f(0))
• This is equation for line with slope f(1)-
f(0).
Interpolate between corners to get two points on sides collinear with middle point. Then interpolate between these.
Or, represent p as weighted average of p1, p2, p3, and take same weighted average of f(p1), f(p2), f(p3). Ie, find a, b, c so that
p = ap1 + bp2 + c*p3, a+b+c=1 and find
f(p) = af(p1) + bf(p2) + c*f(p3).
These produce the same result.
Bilinear Interpolation – 4 points
- Given values at (0,0), (1,0), (0,1), (1,1) find value at (x,y).
- Linearly interpolate (x,0), (x,1), then interpolate (x,y).
- Or, find (0,y) and (1,y) and interpolate.
- These produce same results.
If we interpolate to get f(x,0) = (1-x)f(0,0)+xf(1,0), f(x,1) = (1-x)f(0,1) + xf(1,1). Then f(x,y) = ((1-x)f(0,0)+xf(1,0))(1-y) + (f(x,1) = (1-x)f(0,1) + xf(1,1))y. If we interpolate to get f(0,y) = (1-y)f(0,0) + yf(0,1), f(1,y) = (1-y)f(1,0) + y(f(1,1). Then f(x,y) = ((1-y)f(0,0) + yf(0,1))(1-x) + ((1-y)f(1,0)+y(f(1,1)))x These are the same.
Cubic Interpolation
Instead of weighting by distance, d, weight by:
1 – 3d^2 + 2|d|^3
•Smooth
•Symmetric
Nearest
~.007 secs
Bilinear
~.43 secs
Bicubic
~ .75 secs
Interpolation of Angles
• Linear interpolation of angles, in 2D.
• In 3D, find the plane that contains two
vectors, and interpolate angle in that
plane.
• May interpolate lines by interpolating
angles and lengths, instead of end
points.