[Numpy-discussion] nd_image.affine_transform edge effects

James Turner jturner at gemini.edu
Fri Mar 9 18:44:34 EST 2007


Last year I wrote a program that uses the affine_transform()
function in numarray to resample and co-add datacubes with WCS
offsets in 3D. This function makes it relatively easy to handle
N-D offsets and rotations with a smooth interpolant, which is
exactly what I wanted. However, I am finding that the results
contain edge effects which translate into artefacts in the
middle of the final mosaic.

As a test, I tried resampling only a single input cube onto the
original output grid. In the result, it looks like there is a
reflection around the boundary of the input data. Counting from
the top, for example, the first and second rows from the input
image more-or-less map to the second and third rows in the
output, but the top row in the output looks the same as the
second row of the input or the third row of the output. I can
send a couple of 12k JPEGs illustrating this problem if someone
wants to see what I mean.

I have tried altering the affine_transform() parameters, such as
order or cval, but without managing to improve this behaviour.
Does anyone know whether this is a known problem? Given the
reflection-like behaviour, I'm wondering whether it is a local
property of the interpolant symmetry, an issue with calculating
array indices or something like that. These are just quick ideas
off the top of my head.

I'll be grateful if someone (especially the developers) can
comment on what can be done about this, since the artefacts will
limit my program's usefulness for science-quality work and it is
otherwise ready for use.

Thanks a lot!

James.




More information about the NumPy-Discussion mailing list