MATLAB: Can any one provide me the code for dividing the image 306×204 into blocks of size i,e windows of size 17×17

digital image processing

i want to know the code for dividing the image into blocks or windows of size 17×17

Best Answer

im=rand(306,204)
[n,m]=size(im)
[ii,jj]=ndgrid(1:17:n,1:17,m)
out=arrayfun(@(x,y) im(x:x+16,y:y+16),ii,jj,'un',0)