[Image-SIG] PIL vs Numpy in raster calculations
lubensch.proletariat.inc at gmail.com
Wed May 27 17:00:52 CEST 2009
Christopher Barker <Chris.Barker <at> noaa.gov> writes:
> In general, I'm not sure there's any reason to expect better performance
> from numpy for things that are built in to (and done in C code) in PIL.
> numpy does give you access to more full featured manipulation, though.
That's right and that's exactly why I tried numpy in the first place.
> Interesting results, just the same.
> For more ideas, try the numpy list.
I will try the code you proposed and post the updated code to the numpy list as
well and see what comes up.
> what that does is reshape (without copying) the array into WxHx3 array
I have just one question considering importing the PIL image with asarray.
Suppose my initial image is an RGB image with 1600 pixels height and 1900 width.
In numpy syntax I would expect the last one to be (3,1900,1600). Now the
returned array seems to have 1600 layers and not one for each color channel,
leading to the reshape function you propose. Any idea why is that?
More information about the Image-SIG