Simplest way to resize an image-like array

Jon Clements joncle at googlemail.com
Fri Sep 30 22:51:43 CEST 2011


On Sep 30, 5:40 pm, John Ladasky <lada... at my-deja.com> wrote:
> Hi folks,
>
> I have 500 x 500 arrays of floats, representing 2D "grayscale" images,
> that I need to resample at a lower spatial resolution, say, 120 x 120
> (details to follow, if you feel they are relevant).
>
> I've got the numpy, and scipy, and matplotlib. All of these packages
> hint at the fact that they have the capability to resample an image-
> like array.  But after reading the documentation for all of these
> packages, none of them make it straightforward, which surprises me.
> For example, there are several spline and interpolation methods in
> scipy.interpolate.  They seem to return interpolator classes rather
> than arrays.  Is there no simple method which then calls the
> interpolator, and builds the resampled array?
>
> Yes, I can do this myself if I must -- but over the years, I've come
> to learn that a lot of the code I want is already written, and that
> sometimes I just have to know where to look for it.
>
> Thanks!

Is something like http://docs.scipy.org/doc/scipy/reference/generated/scipy.misc.imresize.html#scipy.misc.imresize
any use?



More information about the Python-list mailing list