You can easily use blockproc for this: http://www.mathworks.com/help/toolbox/images/ref/blockproc.html
But if this does not work for you, what mistakes do you get?
If you want to do this manually (for example, extracting the central pixel value of each block), you can simply use two loops for this. But keep in mind that this is a rather inelegant and not very fast way to do this ...
image = imread('image.png'); s = size(image); for i=2:3:s(1)-1 for j=2:3:s(2)-1 %% here you have the midpoint of each 3x3 block... %% you could then easily crop the image around it if you %% really need separated blocks... end end
This is not a very fast way, but ... but it works ...
Hope this helps ...
evident
source share