title: fast computation of histogram on a grid
body: <p>I have a greyscale 200x200 image and I would like to compute the histogram of the intensity for each 8x8 window in the image. How can I compute that fast? I use for loops now but it is so slow. My current code looks like:</p>
  
  <pre><code>I = imread('image.jpg');
  for i=1:8:height-7
      for j=1:8:width-7
         patch = I(i:i+7,j:j+7);
         % compute histogram for the patch
      end
  end
  </code></pre>