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