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

3 次查看(过去 30 天)
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 中查找有关 Convert Image Type 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by