[SciPy-user] Numarray image processing

Jeremy Sanders jeremy at jeremysanders.net
Wed May 11 12:54:57 EDT 2005


On Tue, 10 May 2005, Todd Miller wrote:

> I'm not an astronomer,  so take this with a grain of salt,  but this is
> what comes to mind for me:

That's quite a nice way of doing it. Thanks. The problem is that I need to 
do this for all radii (integerizing the radius). This is to show the 
deviations away from spherical symmetry.

I can do it in two iterations over my image, iterating over each pixel, 
calculating its radius, and collecting the total value and number at each 
radius in an array. I can then go back over the image and subtract the 
mean value. I also had to ignore NaN pixels.

Unfortunately it was taking over 15 minutes for my 3000x3000 image using 
numarray. I was able to code up a quick C++ program which did it in two 
seconds. This was with an Athlon 64 3400+.

Numarray is obviously great if you can write the computation in a matrix 
form, but it's quite slow addressing individual pixels (or maybe it's the 
python around it). Quite often I find it hard to think in non pixel 
terms...

Thanks

Jeremy

-- 
Jeremy Sanders <jeremy at jeremysanders.net>
http://www.jeremysanders.net/                Cambridge, UK
Public Key Server PGP Key ID: E1AAE053




More information about the SciPy-User mailing list