[Numpy-discussion] nd_image.affine_transform edge effects

Stefan van der Walt stefan@sun.ac...
Thu Mar 22 20:47:44 CDT 2007


On Thu, Mar 22, 2007 at 04:33:53PM -0700, Travis Oliphant wrote:
> >I would rather opt for changing the spline fitting algorithm than for
> >padding with zeros.
> >  
> >
>  From what I understand, the splines used in ndimage have the implicit 
> mirror-symmetric boundary condition which also allows them to be 
> computed rapidly.  There may be ways to adapt other boundary conditions 
> and maintain rapid evaluation, but it is not trivial as far as I know.  
> Standard spline-fitting allows multiple boundary conditions because 
> matrix inversion is used.  I think the spline-fitting done in ndimage 
> relies on equal-spacing and mirror-symmetry to allow simple IIR filters 
> to be used to compute the spline coefficients very rapidly.

Thanks, Travis.  I wasn't aware of these restrictions.

Would it be possible to call fitpack to do the spline fitting?  I
noticed that it doesn't exhibit the same mirror-property:

In [24]: z = scipy.interpolate.splrep([0,1,2,3,4],[0,4,3,2,1])

In [25]: scipy.interpolate.splev([0,1,2,3,4,5],z)
Out[25]: 
array([ -1.32724622e-16,   4.00000000e+00,   3.00000000e+00,
         2.00000000e+00,   1.00000000e+00,  -1.25000000e+00])

Regards
Stéfan


More information about the Numpy-discussion mailing list