MATLAB: Imresize is blurring the image!

imresize

Hello
I have a 128×128 matrix and I want to scale it down to 32×32. MATLAB's algorithm "imresize" seems to involve a smoothing filter. My original image has sharp gradients across pixel edges which will remain pixel edges in the new image, but these gradients are being lost by a seemingly overenthusiastic filtering step.
Is there a simple way of simply saying "see this 4×4 box? well that's going to be a single pixel in the new image, so take the mean of these 16 values and ignore everything else around it"?
I could try to code this manually but I'm checking that there isn't a quicker alternative, since it'll take me a while.
Regards, Michael

Best Answer

I = imresize(I, [32 32], 'nearest');