edit: it's an image so the suggested ([How can I efficiently process a numpy array in blocks similar to Matlab's blkproc (blockproc) function](https://stackoverflow.com/questions/5073767/how-can-i-efficiently-process-a-numpy-array-in-blocks-similar-to-matlabs-blkpro)) isn't really working for me

I have the following matlab code

```
fun = @(block_struct) ...
std2(block_struct.data) * ones(size(block_struct.data));

B=blockproc(im2double(Icorrected), [4 4], fun);

```

I want to remake my code, but this time in Python. I have installed Scikit and i'm trying to work around it like this

```
b = np.std(a, axis = 2) 

```

The problem of course it's that i'm not applying the std for a number of blocks, just like above.

How can i do something like this? Start a loop and try to call the function for each X\*X blocks? Then i wouldn't keep the size the it was.

Is there another more efficient way?