[SciPy-User] Problem with ndimage.interpolation.zoom

Eric Emsellem eric.emsellem@eso....
Thu Mar 14 03:34:52 CDT 2013


Hi,

I have a problem with the zoom function in the ndimage module of scipy.

I am trying to "expand/zoom" an array by a factor of e.g., 3 or 4.

I noticed that when the input array has a shape with odd number of e.g. 
lines/rows etc, something odd happens.

When you take a random 3d array of 2x2x2 it works, and with a times-3 
zoom, it tri-plicates each value in the output array. However, with the 
following example you'll see that the border values are replicated only 
twice and the central value 4 times... What is happening and how can I 
just get an array with just n times each input value?

# Try:
test = random.random(9)
test3 = test.reshape((3,3))
test3z = scipy.ndimage.interpolation.zoom(test3, 3, mode='constant', 
prefilter=False, order=0)

# and look at the output test3z... the border values are only there 
twice. Not three times... The central value is there 4 times...

Thanks for any input.

Eric



More information about the SciPy-User mailing list