Why the image size changes after saving it to hard drive?

조회 수: 4 (최근 30일)
Sania Gul
Sania Gul 2022년 8월 29일
댓글: Sania Gul 2022년 8월 29일
During program run my image size was 256*64*3, but when i store it in my D:/ and retrieve it back from there, the size is not same as the one I have saved? Y it is so? Where am I making error? Please help.
Fs=16000;
samples = [1+opening,count*Fs*1.05];
audio=audioread('D:\Fazeel_Data\16KAll\TestNoisy.wav',samples);
%Destination folder for storing images
Dest = 'D:\Fazeel_Data\TestNoisyPics\';
[Q,F,T] = spectrogram(audio,hann(512),256,512,Fs,'yaxis');
% Taking the log of Z-Axis (Brightness)
Q=Q(1:256,:);
F=F(1:256);
figure(2)
D=surf(T,F,log(abs(Q).^2));
colormap parula
shading interp
view([0 90])
axis tight
set(gca,'xtick',[])
set(gca,'ytick',[])
% [a b c]=size(I)
export_fig AA.jpg -native -c[31 52 46 72]% https://www.mathworks.com/matlabcentral/fileexchange/23629-export_fig
% resizing the image
I=imread('AA.jpg');
outputImage = imresize(I, [256,64]);
export_fig AA.jpg -native -c[31 86 58 85]% clipping top right bottom left
[o p q]=size(outputImage)
************************************
The values of parameters shown in workspace are
o =256, p=64, q=3
but when I use the command [o p q]=size("AA.jpg), the values are
o=1, p=6, q=1, why it is so?????????

채택된 답변

Chunru
Chunru 2022년 8월 29일
[o p q]=size(outputImage)
% The above shows the size of the outputImage
o =256, p=64, q=3
[o p q]=size('AA.jpg')
% The above shows the size of the string 'AA.jpg' which is 1x6x1 (6
% characters)
o=1, p=6, q=1
In order to show the image size of the stored files. You need to read imge first and then show the size.
  댓글 수: 4
Chunru
Chunru 2022년 8월 29일
size('Lo') is the size of char array 'Lo' not the variable Lo.
Sania Gul
Sania Gul 2022년 8월 29일
Tnk u sooo much Chunru. It works now. Ur name sounds tooo good. ;-)

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Images에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by