[Numpy-discussion] subsampling

Charles G Waldman cgw at alum.mit.edu
Fri Feb 15 12:36:56 EST 2002


John J. Lee writes:

 > I think -- correct me if I'm wrong -- he was asking about interpolation.

I think that only Mr Yeates knows for sure!  I read the query a few
times and I think he's looking for straight-ahead subsampling
without interpolation.

 > If a Python loop is too slow, you can probably do it with the standard
 > numpy functions, with some experimentation.

If interpolation is desired, it might also be worthwhile looking at
the Python Imaging Library (PIL), I believe it has routines for
resizing images with bilinear interpolation.  Since PIL supports many
different data formats (even floating point) and it's fairly easy, if
inelegant, to inter-convert PIL images and NumPy arrays using
"fromstring/tostring" methods (there should be tighter integration
between these packages, maybe somebody has done this since last I
looked), you might find that the PIL image resizing does what you're
looking for.




More information about the NumPy-Discussion mailing list