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

3 次查看(过去 30 天)
I want a MATLAB code that will resize a given image into 50x50 image

回答(4 个)

maha lakshmi
maha lakshmi 2013-2-2
编辑:Walter Roberson 2017-10-22
>> x1 =imread('pears.jpeg');
>> x =imresize(x1,[50 50]); %see your answer in workspace

Youssef  Khmou
Youssef Khmou 2013-2-2
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 2013-3-1
warning!!!!!!1 Undefined function 'imresize' for input arguments of type 'uint8'.
  1 个评论
Walter Roberson
Walter Roberson 2013-3-1
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.

请先登录,再进行评论。


Youssef  Khmou
Youssef Khmou 2013-3-1
编辑:Youssef Khmou 2013-3-1
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

类别

Help CenterFile Exchange 中查找有关 Image Processing Toolbox 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by