imresize is blurring my image!

Hello
I have a 128x128 matrix and I want to scale it down to 32x32. 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 4x4 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

 Respuesta aceptada

Thorsten
Thorsten el 20 de Feb. de 2013

1 voto

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

3 comentarios

Michael
Michael el 20 de Feb. de 2013
Thanks, this is nearly a solution but it's not as mathematically sound as I'd like; since the scaling is 1:4, the new pixel centres are equally distant from the four old pixel centres, and MATLAB seems to arbitrarily select one pixel (the upper-right) of the four. I don't know how to justify this selection, because essentially 15 of every 16 pixels are being ignored.
Thorsten
Thorsten el 20 de Feb. de 2013
T = blkproc(I, [4 4], @mean2);
Michael
Michael el 20 de Feb. de 2013
Perfect, thanks very much.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Etiquetas

Preguntada:

el 20 de Feb. de 2013

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by