title: How can I calculate standard deviation for every block in an image
body: <p>I'm trying to use <a href="http://www.mathworks.com/help/images/ref/blockproc.html" rel="nofollow">this example from the docs</a> to calculate standard deviation for every 8x8 pixel block in the image but I can't use it well in this case , so can anybody help me  to compute std for each block.</p>
  
  <pre><code> fun = @(block_struct) std2(block_struct.data) * ones(size(block_struct.data))
   I2 = blockproc('moon.tif',[8 8],fun);
   figure;
   imshow('moon.tif');
   figure;
   imshow(I2 , []);
  </code></pre>