Moves sliding window around the image and gets a subwindow of it. If index exceeds the image dimensions, returns 'error'. So to get sliding window is very easy, just use a while cycle with condition over the control variable ~= 'error' counting from 1 and you will get nice function to get sliding window.
It is free for any use. If you use it, please cite: http://ieeexplore.ieee.org/xpl/articleDetails.jsp?arnumber=6310525
Change of name to more relevant one.