title: How to find mode in a numpy array with images?
body: <p>Assume we have a np.array containing set of grayscale images. How to find the mode of each pixel position? Normally numpy have np.mean() and np.median() but mode is not included. I tried out stats.mode() of scipy but its slow. I also get bit confused with <strong><em>axis</em></strong> term. Hope someone can explain that also (Eg: axis=0, axis=1 etc.)</p>
  
  <pre><code>Input:
  [[ [[1,2][3,2]] [[4,3][5,3]] [[9,5][4,6]] ],
   [ [[1,3][3,3]] [[2,7][1,4]] [[4,1][1,7]] ],
   [ [[1,5][3,3]] [[4,3][1,6]] [[6,4][5,6]] ]
  ]
  
  Output:
  [[ [[1,2][3,3]] [[4,3][1,3]] [[4,1][1,6]] ]]
  </code></pre>