As we know that moving window on 1d array has answered by Jaime,moving_average
How can I apply mean function or sum function on 2d array using the moving window?
Like in picture, apply mean function on the red box, and arrow point to result should be.