Image resize image in matlab

4 visualizaciones (últimos 30 días)
Mehwish
Mehwish el 13 de Jun. de 2013
Hi, I am facing a blurring issue in the below code:
I = imread('waterframe-1.png');
I=imresize(I,[16 16]);
I=rgb2ycbcr(I);
I=ycbcr2rgb(I);
I=imresize(I,[256 256]);
I=ycbcr2rgb(I);
imshow(I);
Any help in this will be very highly appreciated
Thanks Mehwish
  1 comentario
Jan
Jan el 13 de Jun. de 2013
You forgot to mention any dteilas about the problem. What exactly do you see and what do you expect?

Iniciar sesión para comentar.

Respuesta aceptada

Benoît THOUY
Benoît THOUY el 13 de Jun. de 2013
Hi,
When upsampling, you have to deal with interpolation in order to predict missing pixels. As you do not know all 256*256 pixels with only 16*16 pixels, it uses some kind of "averaging" closest pixels to compute all pixels.
imresize uses bilinear interpolation by default. You can change to bicubic interpolation to have more "sharp" edges, but it will be blurred anyway. Nearest-neighbor interpolation will give you a "block" effect so no blur but big [16 16] squares. It is up to your choice. See documentation of imresize: www.mathworks.com/help/images/ref/imresize.html
  1 comentario
Mehwish
Mehwish el 14 de Jun. de 2013
Thanks a lot. It clears up a lot of mess in my head.
Regards
Mehwish

Iniciar sesión para comentar.

Más respuestas (3)

Chandra Shekhar
Chandra Shekhar el 13 de Jun. de 2013
Editada: Chandra Shekhar el 13 de Jun. de 2013
dont resize original image to [16 16] make it as it is.
follow following code to get more info
I = imread('waterframe-1.png');
I=imresize(I,[256 256]);
I=rgb2ycbcr(I);
I=ycbcr2rgb(I);
I=imresize(I,[256 256]);
I=ycbcr2rgb(I);
figure;imshow(I);

Mehwish
Mehwish el 13 de Jun. de 2013
Yup. I know it works. Thanks for the quick response. This is a short version of the algorithm which I am implementing. And the whole algorithm revolves around resizing the image to 16X16 and the conversion to ycbcr. So not resizing is out of question.

Mehwish
Mehwish el 13 de Jun. de 2013
@ Jan I see blurring of the image and I expect to resolve it with some filter maybe....

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by