[Numpy-discussion] "moving window" in numpy

Vincent Schut schut@sarvision...
Mon Nov 26 03:59:47 CST 2007


Matthew Perry wrote:
> Hi all,
> 
>  I'm not sure if my terminology is familiar but I'm trying to do a
> "moving window" analysis (ie a spatial filter or kernel) on a 2-D
> array representing elevation. For example, a 3x3 window centered on
> each cell is used to calculate the derivate slope of that cell.
> 
>  Can this easily be implemented using numpy?
> 

If I understand you correctly, scipy.ndimage does exactly what you ask
for. See http://www.scipy.org/SciPyPackages/Ndimage.

Cheers,
VS.



More information about the Numpy-discussion mailing list