I want a MATLAB code that will resize a given image into 50x50 image

2 visualizaciones (últimos 30 días)
Niraj Rajput
Niraj Rajput el 2 de Feb. de 2013
Editada: Walter Roberson el 22 de Oct. de 2017
I want a MATLAB code that will resize a given image into 50x50 image

Respuestas (4)

maha lakshmi
maha lakshmi el 2 de Feb. de 2013
Editada: Walter Roberson el 22 de Oct. de 2017
>> x1 =imread('pears.jpeg');
>> x =imresize(x1,[50 50]); %see your answer in workspace

Youssef  Khmou
Youssef Khmou el 2 de Feb. de 2013
Use "reshape" function, Warn : the number of elements must not change means for your initial image I of size(n,p), the number p*n=2500 :
Resized=reshape(I,50,50);
if n*p!=2500, try to truncate elements ,
Is that what you mean?

ali ebrahimi
ali ebrahimi el 1 de Mzo. de 2013
warning!!!!!!1 Undefined function 'imresize' for input arguments of type 'uint8'.
  1 comentario
Walter Roberson
Walter Roberson el 1 de Mzo. de 2013
imresize() is part of the Image Processing Toolkit. Do you have access to that? It is optional (extra cost) for the Academic and Professional version, but is included in the Student Version, but might not be installed by default.

Iniciar sesión para comentar.


Youssef  Khmou
Youssef Khmou el 1 de Mzo. de 2013
Editada: Youssef Khmou el 1 de Mzo. de 2013
hi, did you try my first answer using reshape ?
You can try other methods , such as down_sampling like if you have an Image I of size 400x400 you can downsample it :" I=I(1:8:end,1:8:end)"
% Given your image I of size(m,n)
m=250;
n=250;
I=rand(m,n);
mm=floor(m/50);
nn=floor(n/50);
J=I;
J=J(1:mm:end,1:nn:end);
% Now you new image J is of size 50x50
  2 comentarios
Walter Roberson
Walter Roberson el 1 de Mzo. de 2013
Note that the original poster of the question has not responded.
Youssef  Khmou
Youssef Khmou el 1 de Mzo. de 2013
Editada: Youssef Khmou el 1 de Mzo. de 2013
hi, i thought that the poster said he does not have imresize function but its was another user .

Iniciar sesión para comentar.

Categorías

Más información sobre Image Processing Toolbox en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by