[Numpy-discussion] nd_image.affine_transform edge effects
Mon Mar 19 14:05:52 CDT 2007
> In : import numpy as N
> In : x = N.array([[4,3,8,1],[4,3,8,1.]])
> In :
> array([[-1., 3., 8., 1., 8., -1.],
> [-1., 3., 8., 1., 8., -1.]])
Your example seems to be missing a definition for "shift", but I see
shift = lambda (y, x): (y, x-xoff)
reproduces your result for any 0. < xoff <= 0.5.
> Looks like the spline fit is done on mirrored input data, instead of
> padding the input with the cval.
Yes, that makes sense. I suppose the idea is to *avoid* creating edge
effects due to an artificial sharp cut-off(?). That is fine for
calculating the interpolant, but it seems like a mistake to include
the mirrored values in the output result, doesn't it?
Do people agree that points outside the bounds of the original data
should be blank, such that the correct result in the above case would
be [-1., 3., 8., 1., -1., -1.]? If so, I can go ahead and file a
bug report (should it be a scipy-ticket, an email to STScI or both?).
I would offer to have a go at changing the nd_image code, but I think
I might be well out of my depth at this point...
More information about the Numpy-discussion