[ptx] Cubic Spline Interpolation

Yili Zhao ylzhao at vip.sina.com
Wed Jun 29 00:40:23 BST 2005


Hi,
  I want to use Cubic Spline Interpolation, so I read some code from resample.c.
>From the "http://www.path.unimelb.edu.au/~dersch/interpolator/interpolator.html",it says that Spline16 of Panorama Tools is a cubic-spline, with derivative set to 0 at the edges (4x4 pixels). The weight function thus becomes: 
  weight  = ((x - 9.0 / 5.0) * x - 1.0 / 5.0) * x + 1.0;                                      0<x<1    (1)
  weight  = ((-1.0 / 3.0 * (x - 1) + 4.0 / 5.0) * ( x - 1) - 7.0 / 15.0) * ( x - 1) ;         1<x<2    (2)
It also uses 16 pixels in 2 dimensions.
  In resample.c,  
  #define		SPLINE16( x, a, NDIM )
    a[3] = (( 1.0/3.0  * x - 1.0/5.0 ) * x - 2.0/15.0 ) * x;
	a[2] = (( 6.0/5.0 - x ) * x + 4.0/5.0 ) * x;	
	a[1] = (( x - 9.0/5.0 ) * x - 1.0/5.0) * x + 1.0;
	a[0] = (( -1.0/3.0 * x + 4.0/5.0 ) * x - 7.0/15.0 ) * x;

  a[1] is (1), and a[0] is (2), but how to compute a[3] and a[2]?
  Another question, why resample.c defines most interpolation in #define statements?	

  Thanks!

Sincerely
Yili Zhao






More information about the ptx mailing list