SlideShare a Scribd company logo
1 of 9
Download to read offline
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.
  – Blowing up an image.




                                           1
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) + x*f(1) = f(0) + x(f(1)-f(0))
• This is equation for line with slope f(1)-
  f(0).




                                                   2
Linear Interpolation of 2D Points
• Interpolate between p1, p2.
• Intermediate points are weighted averages.
• p = (1-t)*p1 + t*p2 for 0 < t < 1.
  – p goes from p1 to p2 as t goes from 0 to 1.
• p = p1 + t(p2-p1), ie. equation for a line,
  restricted to 0 < t < 1.
• This is convex combination of p1 and p2.
• Application: Interpolate location for morphing
  (move position of nose from face 1 to face 2)
  or motion synthesis.




Bilinear Interpolation - triangle
• Given value of function at vertices of
  triangle, interpolate values inside.
• Example, given z values at corners,
  determine z values for whole triangle.




                                                   3
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 = a*p1 + b*p2 + c*p3, a+b+c=1 and find
f(p) = a*f(p1) + b*f(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.




                                                                 4
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 – 3d2 + 2|d|3
    •Smooth
    •Symmetric




                                                                                               5
Suppose 0<= x <= 1, and a function f is defined on f(0), f(1). We want to
 define it for f(x) so that f(x) is smooth.
 If we do this by averaging neighbors, we have:
 f(x) = g(x)*f(0) + g(1-x)f(1). Then we want a function g that is smooth, and
 in which g(0) = 1 and g(1) = 0, and in which g is symmetric so that g(x) +
 g(1-x) = 1.
 With linear interpolation g(x) = 1-x. This fits the second two criteria, but
 this g is not smooth. There is a discontinuity at f(0), since we suddenly
 switch between averaging f(0) and f(1) and averaging f(0) and f(-1)
 So instead, we want f(x) near f(0) to be based mostly on the value of f(0),
 and only to gradually average in f(1) as we get closer to it.
 A nice function that does this is 1 – 3*d*d +2*|d*d*d|
 Note that g(1-x) = 1 – 3*(1-x)(1-x) +2(1-x)(1-x)(1-x)
 = 1 – 3 + 6x –3x*x + 2 – 6x + 6x*x – 2x*x*x = 3x*x – 2*x*x*x
 = 1 – (1 – 3x*x + 2x*x*x)
 Also, we can see that when x -> 0, g(x) -> 1 – 3x*x + 2*x*x*x -> 1, and that
 g(1-x) similarly goes to 0. This means that (g(x)f(0) + g(1-x)f(1))-f(0) / x ->
 0, which shows that the tangent at f(0) on the right side of the curve is 0.
 Similarly, the tangent on the other side is also zero, so two interpolating
 curves meet at x=0 with the same tangent, ie., smoothly.




 Application: Image Resizing
• When we enlarge an image, we need
  values for the new pixels.
• Common methods:
  – Nearest neighbor
  – Bilinear interpolation
  – Bicubic interpolation




                                                                                   6
Nearest
~.007 secs




Bilinear
~.43 secs




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




                                                8
Interpolation of end vertices




                           Interpolation of angles and
                           lengths.




                                                         9

More Related Content

What's hot

Lesson 27: Evaluating Definite Integrals
Lesson 27: Evaluating Definite IntegralsLesson 27: Evaluating Definite Integrals
Lesson 27: Evaluating Definite IntegralsMatthew Leingang
 
Lesson 8 the definite integrals
Lesson 8 the definite integralsLesson 8 the definite integrals
Lesson 8 the definite integralsLawrence De Vera
 
Numerical Integration: Trapezoidal Rule
Numerical Integration: Trapezoidal RuleNumerical Integration: Trapezoidal Rule
Numerical Integration: Trapezoidal RuleVARUN KUMAR
 
The Definite Integral
The Definite IntegralThe Definite Integral
The Definite IntegralSilvius
 
Limits And Derivative
Limits And DerivativeLimits And Derivative
Limits And DerivativeAshams kurian
 
Lecture 4 the limit of a function
Lecture 4   the limit of a functionLecture 4   the limit of a function
Lecture 4 the limit of a functionnjit-ronbrown
 
AP Calculus AB Theorems and Definitions
AP Calculus AB Theorems and DefinitionsAP Calculus AB Theorems and Definitions
AP Calculus AB Theorems and Definitionsmbailey1974
 
application of partial differentiation
application of partial differentiationapplication of partial differentiation
application of partial differentiationeteaching
 
Application of derivatives
Application of derivativesApplication of derivatives
Application of derivativesindu thakur
 
Limit of Function And Its Types
Limit of Function And Its TypesLimit of Function And Its Types
Limit of Function And Its TypesAdeel Rasheed
 
Lesson 19: The Mean Value Theorem (slides)
Lesson 19: The Mean Value Theorem (slides)Lesson 19: The Mean Value Theorem (slides)
Lesson 19: The Mean Value Theorem (slides)Matthew Leingang
 
Lecture 6 limits with infinity
Lecture 6   limits with infinityLecture 6   limits with infinity
Lecture 6 limits with infinitynjit-ronbrown
 

What's hot (16)

Lesson 27: Evaluating Definite Integrals
Lesson 27: Evaluating Definite IntegralsLesson 27: Evaluating Definite Integrals
Lesson 27: Evaluating Definite Integrals
 
azEssay2
azEssay2azEssay2
azEssay2
 
Lesson 8 the definite integrals
Lesson 8 the definite integralsLesson 8 the definite integrals
Lesson 8 the definite integrals
 
Limits
LimitsLimits
Limits
 
Numerical Integration: Trapezoidal Rule
Numerical Integration: Trapezoidal RuleNumerical Integration: Trapezoidal Rule
Numerical Integration: Trapezoidal Rule
 
The Definite Integral
The Definite IntegralThe Definite Integral
The Definite Integral
 
Application of derivatives
Application of derivativesApplication of derivatives
Application of derivatives
 
Limits And Derivative
Limits And DerivativeLimits And Derivative
Limits And Derivative
 
Lecture 4 the limit of a function
Lecture 4   the limit of a functionLecture 4   the limit of a function
Lecture 4 the limit of a function
 
AP Calculus AB Theorems and Definitions
AP Calculus AB Theorems and DefinitionsAP Calculus AB Theorems and Definitions
AP Calculus AB Theorems and Definitions
 
application of partial differentiation
application of partial differentiationapplication of partial differentiation
application of partial differentiation
 
Application of Derivative 3
Application of Derivative 3Application of Derivative 3
Application of Derivative 3
 
Application of derivatives
Application of derivativesApplication of derivatives
Application of derivatives
 
Limit of Function And Its Types
Limit of Function And Its TypesLimit of Function And Its Types
Limit of Function And Its Types
 
Lesson 19: The Mean Value Theorem (slides)
Lesson 19: The Mean Value Theorem (slides)Lesson 19: The Mean Value Theorem (slides)
Lesson 19: The Mean Value Theorem (slides)
 
Lecture 6 limits with infinity
Lecture 6   limits with infinityLecture 6   limits with infinity
Lecture 6 limits with infinity
 

Similar to Interpolation

5.3 areas, riemann sums, and the fundamental theorem of calaculus
5.3 areas, riemann sums, and the fundamental theorem of calaculus5.3 areas, riemann sums, and the fundamental theorem of calaculus
5.3 areas, riemann sums, and the fundamental theorem of calaculusmath265
 
3 d scaling and translation in homogeneous coordinates
3 d scaling and translation in homogeneous coordinates3 d scaling and translation in homogeneous coordinates
3 d scaling and translation in homogeneous coordinatesKRIPA SHNAKAR TIWARI
 
Pshs 3rd yr_functions_young_einstein
Pshs 3rd yr_functions_young_einsteinPshs 3rd yr_functions_young_einstein
Pshs 3rd yr_functions_young_einsteinRenee Tan
 
Pshs 3rd yr_functions
Pshs 3rd yr_functionsPshs 3rd yr_functions
Pshs 3rd yr_functionsRenee Tan
 
ppt.pptx fixed point iteration method no
ppt.pptx fixed point iteration method noppt.pptx fixed point iteration method no
ppt.pptx fixed point iteration method noseidnegash1
 
Linear approximations and_differentials
Linear approximations and_differentialsLinear approximations and_differentials
Linear approximations and_differentialsTarun Gehlot
 
Quadraticsportfoliopowerpoint 100325142401-phpapp02
Quadraticsportfoliopowerpoint 100325142401-phpapp02Quadraticsportfoliopowerpoint 100325142401-phpapp02
Quadraticsportfoliopowerpoint 100325142401-phpapp02nurliyanazakaria
 
Chap7 2 Ecc Intro
Chap7 2 Ecc IntroChap7 2 Ecc Intro
Chap7 2 Ecc IntroEdora Aziz
 
1050 text-ef
1050 text-ef1050 text-ef
1050 text-efsupoteta
 
TIU CET Review Math Session 6 - part 2 of 2
TIU CET Review Math Session 6 - part 2 of 2TIU CET Review Math Session 6 - part 2 of 2
TIU CET Review Math Session 6 - part 2 of 2youngeinstein
 
Cs229 cvxopt
Cs229 cvxoptCs229 cvxopt
Cs229 cvxoptcerezaso
 
Algebric Functions.pdf
Algebric Functions.pdfAlgebric Functions.pdf
Algebric Functions.pdfMamadArip
 

Similar to Interpolation (20)

Quadrature
QuadratureQuadrature
Quadrature
 
5.3 areas, riemann sums, and the fundamental theorem of calaculus
5.3 areas, riemann sums, and the fundamental theorem of calaculus5.3 areas, riemann sums, and the fundamental theorem of calaculus
5.3 areas, riemann sums, and the fundamental theorem of calaculus
 
parabola class 12
parabola class 12parabola class 12
parabola class 12
 
Unit v
Unit vUnit v
Unit v
 
3 d scaling and translation in homogeneous coordinates
3 d scaling and translation in homogeneous coordinates3 d scaling and translation in homogeneous coordinates
3 d scaling and translation in homogeneous coordinates
 
Notes 3-4
Notes 3-4Notes 3-4
Notes 3-4
 
2d transformation
2d transformation2d transformation
2d transformation
 
Pshs 3rd yr_functions_young_einstein
Pshs 3rd yr_functions_young_einsteinPshs 3rd yr_functions_young_einstein
Pshs 3rd yr_functions_young_einstein
 
Pshs 3rd yr_functions
Pshs 3rd yr_functionsPshs 3rd yr_functions
Pshs 3rd yr_functions
 
Derivatie class 12
Derivatie class 12Derivatie class 12
Derivatie class 12
 
ppt.pptx fixed point iteration method no
ppt.pptx fixed point iteration method noppt.pptx fixed point iteration method no
ppt.pptx fixed point iteration method no
 
Bfpt
BfptBfpt
Bfpt
 
Es272 ch5b
Es272 ch5bEs272 ch5b
Es272 ch5b
 
Linear approximations and_differentials
Linear approximations and_differentialsLinear approximations and_differentials
Linear approximations and_differentials
 
Quadraticsportfoliopowerpoint 100325142401-phpapp02
Quadraticsportfoliopowerpoint 100325142401-phpapp02Quadraticsportfoliopowerpoint 100325142401-phpapp02
Quadraticsportfoliopowerpoint 100325142401-phpapp02
 
Chap7 2 Ecc Intro
Chap7 2 Ecc IntroChap7 2 Ecc Intro
Chap7 2 Ecc Intro
 
1050 text-ef
1050 text-ef1050 text-ef
1050 text-ef
 
TIU CET Review Math Session 6 - part 2 of 2
TIU CET Review Math Session 6 - part 2 of 2TIU CET Review Math Session 6 - part 2 of 2
TIU CET Review Math Session 6 - part 2 of 2
 
Cs229 cvxopt
Cs229 cvxoptCs229 cvxopt
Cs229 cvxopt
 
Algebric Functions.pdf
Algebric Functions.pdfAlgebric Functions.pdf
Algebric Functions.pdf
 

More from Tarun Gehlot

Materials 11-01228
Materials 11-01228Materials 11-01228
Materials 11-01228Tarun Gehlot
 
Continuity and end_behavior
Continuity and  end_behaviorContinuity and  end_behavior
Continuity and end_behaviorTarun Gehlot
 
Continuity of functions by graph (exercises with detailed solutions)
Continuity of functions by graph   (exercises with detailed solutions)Continuity of functions by graph   (exercises with detailed solutions)
Continuity of functions by graph (exercises with detailed solutions)Tarun Gehlot
 
Factoring by the trial and-error method
Factoring by the trial and-error methodFactoring by the trial and-error method
Factoring by the trial and-error methodTarun Gehlot
 
Introduction to finite element analysis
Introduction to finite element analysisIntroduction to finite element analysis
Introduction to finite element analysisTarun Gehlot
 
Finite elements : basis functions
Finite elements : basis functionsFinite elements : basis functions
Finite elements : basis functionsTarun Gehlot
 
Finite elements for 2‐d problems
Finite elements  for 2‐d problemsFinite elements  for 2‐d problems
Finite elements for 2‐d problemsTarun Gehlot
 
Error analysis statistics
Error analysis   statisticsError analysis   statistics
Error analysis statisticsTarun Gehlot
 
Introduction to matlab
Introduction to matlabIntroduction to matlab
Introduction to matlabTarun Gehlot
 
Local linear approximation
Local linear approximationLocal linear approximation
Local linear approximationTarun Gehlot
 
Interpolation functions
Interpolation functionsInterpolation functions
Interpolation functionsTarun Gehlot
 
Propeties of-triangles
Propeties of-trianglesPropeties of-triangles
Propeties of-trianglesTarun Gehlot
 
Gaussian quadratures
Gaussian quadraturesGaussian quadratures
Gaussian quadraturesTarun Gehlot
 
Basics of set theory
Basics of set theoryBasics of set theory
Basics of set theoryTarun Gehlot
 
Applications of set theory
Applications of  set theoryApplications of  set theory
Applications of set theoryTarun Gehlot
 
Miscellneous functions
Miscellneous  functionsMiscellneous  functions
Miscellneous functionsTarun Gehlot
 
Dependent v. independent variables
Dependent v. independent variablesDependent v. independent variables
Dependent v. independent variablesTarun Gehlot
 
Intervals of validity
Intervals of validityIntervals of validity
Intervals of validityTarun Gehlot
 

More from Tarun Gehlot (20)

Materials 11-01228
Materials 11-01228Materials 11-01228
Materials 11-01228
 
Binary relations
Binary relationsBinary relations
Binary relations
 
Continuity and end_behavior
Continuity and  end_behaviorContinuity and  end_behavior
Continuity and end_behavior
 
Continuity of functions by graph (exercises with detailed solutions)
Continuity of functions by graph   (exercises with detailed solutions)Continuity of functions by graph   (exercises with detailed solutions)
Continuity of functions by graph (exercises with detailed solutions)
 
Factoring by the trial and-error method
Factoring by the trial and-error methodFactoring by the trial and-error method
Factoring by the trial and-error method
 
Introduction to finite element analysis
Introduction to finite element analysisIntroduction to finite element analysis
Introduction to finite element analysis
 
Finite elements : basis functions
Finite elements : basis functionsFinite elements : basis functions
Finite elements : basis functions
 
Finite elements for 2‐d problems
Finite elements  for 2‐d problemsFinite elements  for 2‐d problems
Finite elements for 2‐d problems
 
Error analysis statistics
Error analysis   statisticsError analysis   statistics
Error analysis statistics
 
Matlab commands
Matlab commandsMatlab commands
Matlab commands
 
Introduction to matlab
Introduction to matlabIntroduction to matlab
Introduction to matlab
 
Local linear approximation
Local linear approximationLocal linear approximation
Local linear approximation
 
Interpolation functions
Interpolation functionsInterpolation functions
Interpolation functions
 
Propeties of-triangles
Propeties of-trianglesPropeties of-triangles
Propeties of-triangles
 
Gaussian quadratures
Gaussian quadraturesGaussian quadratures
Gaussian quadratures
 
Basics of set theory
Basics of set theoryBasics of set theory
Basics of set theory
 
Applications of set theory
Applications of  set theoryApplications of  set theory
Applications of set theory
 
Miscellneous functions
Miscellneous  functionsMiscellneous  functions
Miscellneous functions
 
Dependent v. independent variables
Dependent v. independent variablesDependent v. independent variables
Dependent v. independent variables
 
Intervals of validity
Intervals of validityIntervals of validity
Intervals of validity
 

Interpolation

  • 1. 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. – Blowing up an image. 1
  • 2. 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) + x*f(1) = f(0) + x(f(1)-f(0)) • This is equation for line with slope f(1)- f(0). 2
  • 3. Linear Interpolation of 2D Points • Interpolate between p1, p2. • Intermediate points are weighted averages. • p = (1-t)*p1 + t*p2 for 0 < t < 1. – p goes from p1 to p2 as t goes from 0 to 1. • p = p1 + t(p2-p1), ie. equation for a line, restricted to 0 < t < 1. • This is convex combination of p1 and p2. • Application: Interpolate location for morphing (move position of nose from face 1 to face 2) or motion synthesis. Bilinear Interpolation - triangle • Given value of function at vertices of triangle, interpolate values inside. • Example, given z values at corners, determine z values for whole triangle. 3
  • 4. 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 = a*p1 + b*p2 + c*p3, a+b+c=1 and find f(p) = a*f(p1) + b*f(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. 4
  • 5. 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 – 3d2 + 2|d|3 •Smooth •Symmetric 5
  • 6. Suppose 0<= x <= 1, and a function f is defined on f(0), f(1). We want to define it for f(x) so that f(x) is smooth. If we do this by averaging neighbors, we have: f(x) = g(x)*f(0) + g(1-x)f(1). Then we want a function g that is smooth, and in which g(0) = 1 and g(1) = 0, and in which g is symmetric so that g(x) + g(1-x) = 1. With linear interpolation g(x) = 1-x. This fits the second two criteria, but this g is not smooth. There is a discontinuity at f(0), since we suddenly switch between averaging f(0) and f(1) and averaging f(0) and f(-1) So instead, we want f(x) near f(0) to be based mostly on the value of f(0), and only to gradually average in f(1) as we get closer to it. A nice function that does this is 1 – 3*d*d +2*|d*d*d| Note that g(1-x) = 1 – 3*(1-x)(1-x) +2(1-x)(1-x)(1-x) = 1 – 3 + 6x –3x*x + 2 – 6x + 6x*x – 2x*x*x = 3x*x – 2*x*x*x = 1 – (1 – 3x*x + 2x*x*x) Also, we can see that when x -> 0, g(x) -> 1 – 3x*x + 2*x*x*x -> 1, and that g(1-x) similarly goes to 0. This means that (g(x)f(0) + g(1-x)f(1))-f(0) / x -> 0, which shows that the tangent at f(0) on the right side of the curve is 0. Similarly, the tangent on the other side is also zero, so two interpolating curves meet at x=0 with the same tangent, ie., smoothly. Application: Image Resizing • When we enlarge an image, we need values for the new pixels. • Common methods: – Nearest neighbor – Bilinear interpolation – Bicubic interpolation 6
  • 8. 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. 8
  • 9. Interpolation of end vertices Interpolation of angles and lengths. 9