[SciPy-user] Equivalent in Scipy of Matlab resize

David Warde-Farley dwf@cs.toronto....
Wed Mar 25 12:13:40 CDT 2009


On 25-Mar-09, at 10:43 AM, Nicolas ROUX wrote:

> Hi,
>
> I am looking for the equivalent of Matlab resize in Scipy.
> Matlab's resize is able to upscale/downscale an array with 'linear',  
> 'bilinear', 'bicubic'.
> Giving a scale factor or the required output shape.
> I can't find the equivalent function in Scipy.
> Does it exist ?

As far as I know, it doesn't; I thought something like that existed in  
scipy.ndimage.interpolation, but apparently I was wrong.

This functionality definitely exists in PIL:

In [63]: import Image

In [64]: x = Image.fromarray(randn(50,50))

In [65]: y = x.resize((500,500),Image.BICUBIC)

However, you probably lose a lot of precision this way.

David


More information about the SciPy-user mailing list