[Numpy-discussion] nd_image.affine_transform edge effects

Stefan van der Walt stefan@sun.ac...
Fri Mar 16 17:15:28 CDT 2007


On Fri, Mar 16, 2007 at 11:49:56AM -0400, James Turner wrote:
> Hi Stefan,
> 
> > I'd like to confirm that you see the same results when running your
> > script:
> >
> > [[ 4.  3.  2.  1.]
> >  [ 4.  3.  2.  1.]]
> > [[-1.          3.12520003  2.11439991  1.01719999  1.87479997 -1.        ]
> >  [-1.          3.12520003  2.11439991  1.01719999  1.87479997 -1.        ]]
> > [[-1.          3.0996666   2.0999999   1.34300005  1.90033329 -1.        ]
> >  [-1.          3.0996666   2.0999999   1.34300005  1.90033329 -1.        ]]
> 
> Yes, I get exactly the same numbers with numarray on a PC running Linux.
> I just rounded the numbers off in my explanatory text to simplify the
> discussion; sorry if that was confusing.

Not at all, just wanted to make sure.  I am starting to form an idea
of what is happening here.  Check out the following result:

In [25]: import numpy as N

In [26]: x = N.array([[4,3,8,1],[4,3,8,1.]])

In [27]: ndi.geometric_transform(x,shift,output_shape=(2,6),prefilter=False,order=0,cval=-1)
Out[27]: 
array([[-1.,  3.,  8.,  1.,  8., -1.],
       [-1.,  3.,  8.,  1.,  8., -1.]])

Looks like the spline fit is done on mirrored input data, instead of
padding the input with the cval.

Regards
Stéfan


More information about the Numpy-discussion mailing list