title: Split image into smaller blocks with the built-in 'reshape' function
body: <p>I am trying to break down an image into smaller images (like a grid), process those blocks and join them back up for display, using the <code>reshape</code> function. </p>
  
  <p>I am currently doing this by means of a nested for loop as shown in the code. However, as built-in functions like <code>reshape()</code>/<code>np.reshape()</code> are faster compared to <code>for-loops</code>, I want to achieve the same result by using the <code>reshape()</code> function. I am dealing with a 3-channel BGR image and would like several smaller 3-channel BGR images, that are pieces of the grid that splits the big one.</p>
  
  <pre class="lang-py prettyprint-override"><code>import numpy as np
  
  roi_ht = 2
  roi_wd = 2
  
  parent_array = np.array([[1,10,2,20],
                          [100,1000,200,2000],
                          [3,30,4,40],
                          [300,3000,400,4000]])
  
  smaller_images = [parent_array[x*roi_ht:(x+1)*roi_ht, y*roi_wd:(y+1)*roi_wd] for x in range(0,2)  for y in range(0,2)]
  </code></pre>
  
  <p>This is the desired result to be achieved using 'reshape' or any other function built-in to python/numpy  (smaller images) : </p>
  
  <pre><code>[array([[   1,   10], [ 100, 1000]]), 
   array([[   2,   20], [ 200, 2000]]), 
   array([[   3,   30], [ 300, 3000]]), 
   array([[   4,   40], [ 400, 4000]])]
  
  </code></pre>