Unable to Save Multiple plot images

17 ビュー (過去 30 日間)
Gova ReDDy
Gova ReDDy 2011 年 10 月 13 日
Got struck with this can u please help ..
xyloObj = mmreader('Movie.avi');
nFrames = xyloObj.NumberOfFrames;
folder = fullfile('path');
movieFullFileName = fullfile(folder, 'Movie.avi');
[folder, baseFileName, extentions] = fileparts(movieFullFileName );
folder = pwd;
outputFolder = sprintf('%s/Movie Frames from %s', folder, baseFileName);
mkdir(outputFolder);
for k=1:nFrames
mov(k).cdata = read(xyloObj, k);
Frame = read(xyloObj, k);
caluclating Fourier transform of Each Frame
taking Frequency plot of each frame
freqz2(Frame,[32 32]);%Frequency plot of the FFT frame
saveas(gcf,'freqplot ','png');%saving freq plot
pp= imread('freqplot','png'); %reading it
outputBaseFileName= sprintf('freqplot%d.png',k);
outputFullFileName = fullfile(outputFolder,outputBaseFileName);
imwrite(pp, outputFullFileName,'png');
end;
It is storing freqzplots with the different names like freqplot1,freqplot2,freqplot3,......so on
But the same figure is present in each plot but with different names ..
How to get the correct plot figure of the frames

採用された回答

Jan
Jan 2011 年 10 月 13 日
saveas(gcf, 'freqplot ', 'png');%saving freq plot
pp= imread('freqplot', 'png'); %reading it
You save the file with a trailing space, but read another file without this space.
BTW. I do not see the reason for SAVEAS->IMREAD->IMWRITE You could save it under the correct path directly.
  3 件のコメント
Jan
Jan 2011 年 10 月 13 日
outputBaseFileName = sprintf('freqplot%d.png',k);
outputFullFileName = fullfile(outputFolder, outputBaseFileName);
saveas(gcf, outputFullFileName, 'png');
Gova ReDDy
Gova ReDDy 2011 年 10 月 24 日
thanks..this is working good

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeRead, Write, and Modify Image についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by