Vectorize Moving Window Grid Operations on NumPy Arrays

preview_player
Показать описание
Moving (or sliding) windows are used for many different operations. They are especially common in photography and topographic analysis. This tutorial will show you how to implement moving windows on numpy arrays. Two methods are shown. An implementation with a double python loop, which can be slow. The preferred method is to vectorize the moving window, which is quite simple to do. Basic code implementation code is available at the link below.

Рекомендации по теме
Комментарии
Автор

wow, i really needed some time to completely understand the vectorization thing, but when i did it really blew my mind! this is really usefull!

thanks so much for this and all your other content!

klobrot
Автор

Hi, thanks. My problem is that in many cases of neighborhood analysis I don't need moving window with square shape, but as a circle of given radius (e.g. in cells).
Would you mind provide example for those kind of situations?
Thanks

Lieti