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

5 ビュー (過去 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 Center および File ExchangeImages についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by