Extracting patches of a certain size from the image in python efficiently

image, image-processing, python

Solution

I think you are looking for something like this:

http://scikit-image.org/docs/0.9.x/api/skimage.util.html#view-as-windows

Problem

I have an image and I want to extract square patches of different sizes from it. I need dense patches, that is, I need a patch at every pixel in the image. For example if the image is `100x100` and the patch size is `64`. The result will be `10000` patches of size `64x64` These are the same patches which we use for filtering operations for example. In case there is a boundary I would like to mirror the image. What is the most efficient way of extracting patches using python? Thanks

Original source