[Numpy-discussion] nd_image.affine_transform edge effects

Stefan van der Walt stefan at sun.ac.za
Thu Apr 5 06:15:30 EDT 2007


Hi James

On Wed, Apr 04, 2007 at 08:29:50PM -0400, James Turner wrote:
>  > It looks like the last output value is produced by reflecting the
>  > input and then interpolating, but presumably then the first value
>  > should be 3.9, for consistency, not 3.1? Does that make sense?
> 
> Aargh. I think I see what's happening now. The input is supposed to
> be interpolated and then reflected like this:
> 
>   [4  3  2  1]  ->  [3.1  3.1  2.1  1.1  1.1]
> 
> The problem is that there is still one value too many being
> "interpolated" here before the reflection takes place. Do the
> sections beginning at lines 168 & 178 need changing in a similar way
> to their counterparts at lines 129 & 139? I started looking into
> this, but I don't understand the code well enough to be sure I'm
> making the right changes...

Thanks for spotting that.  When I fix those lines, I see:

[[ 3.9000001   3.0999999   2.0999999   1.10000002  1.89999998  2.9000001 ]
 [ 3.9000001   3.0999999   2.0999999   1.10000002  1.89999998  2.9000001 ]]

I'll submit to SVN later today.  Note that I also enabled 'mirror'
mode, which works almost the same way as reflect:

Reflect: 1 2 3 4 -> 1 2 3 4 4 3 2 1
Mirror:  1 2 3 4 -> 1 2 3 4 3 2 1

Cheers
Stéfan



More information about the NumPy-Discussion mailing list