Fast way to calculate block deviation of image

Hello,

I want to find the block from an image, of which the texture or the gradient is the most abundant or sharpest or richest of all block in this image. Maybe deviation is a choice to show this property. To do this, it could be working with a mask operation on image matrix. But I don’t know if this is the fastest way to do.

maybe you ought to show what you mean.

I found it. Thanks @crackwitz.