divide the image into 3*3 blocks

Posted by Jayanth Silesh on Stack Overflow See other posts from Stack Overflow or by Jayanth Silesh
Published on 2012-04-02T07:54:28Z Indexed on 2012/04/02 11:28 UTC
Read the original article Hit count: 184

Filed under:
|
|
|

I have a matrix that does not happen to have dimensions that are multiples of 3 or it might. How can we divide the entire image into blocks of 3*3 matrices. (Can ignore the last ones which does not come under the 3*3 multiples. Also, the 3*3 matrices can be be saved in arrays.

a=3; b=3; %window size
x=size(f,1)/a; y=size(f,2)/b; %f is the original image
m=a*ones(1,x); n=b*ones(1,y);
I=mat2cell(f,m,n);

© Stack Overflow or respective owner

Related posts about matlab

Related posts about image-processing