フィルターのクリア

how to make a video out of sequenced images in order

4 ビュー (過去 30 日間)
Srinidhi Bindiganavile Ramadas
Srinidhi Bindiganavile Ramadas 2018 年 10 月 18 日
I have this code to make video file from a set of images. I have a folder with 1240 images numbered in order from 1 to 1240. But the video from the code does not start from the image1 but from the image numbered 1000 and goes till 1240 and starts from 1 to 999 again. I know that the reading of images from folder to matlab is going wrong somehow, but how to correct that?
What should I change in order for the video to start from image1 and go till the end. Appreciate the help.
if true
% % Make an avi movie from a collection of PNG images in a folder.
% Specify the folder.
myFolder = 'H:\My Documents\windowbanktests\tudMAT50M\images';
if ~isdir(myFolder)
errorMessage = sprintf('Error: The following folder does not exist:\n%s', myFolder);
uiwait(warndlg(errorMessage));
return;
end
% Get a directory listing.
filePattern = fullfile(myFolder, '*.PNG');
pngFiles = dir(filePattern);
% Open the video writer object.
writerObj = VideoWriter('YourAVI.avi');
writerObj.FrameRate = 10;
open(writerObj);
% Go through image by image writing it out to the AVI file.
for frameNumber = 1 : length(pngFiles)
% Construct the full filename.
baseFileName = pngFiles(frameNumber).name;
fullFileName = fullfile(myFolder, baseFileName);
% Display image name in the command window.
fprintf(1, 'Now reading %s\n', fullFileName);
% Display image in an axes control.
thisimage = imread(fullFileName);
imshow(thisimage); % Display image.
drawnow; % Force display to update immediately.
% Write this frame out to the AVI file.
writeVideo(writerObj, thisimage);
end
% Close down the video writer object to finish the file.
close(writerObj);
end

採用された回答

Image Analyst
Image Analyst 2018 年 10 月 18 日
  2 件のコメント
YT
YT 2018 年 10 月 18 日
+1 this is actually pretty useful
Srinidhi Bindiganavile Ramadas
Srinidhi Bindiganavile Ramadas 2018 年 10 月 18 日
thank you @Image Analyst. very helpfull. Solved my problem

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

その他の回答 (1 件)

カテゴリ

Help Center および File ExchangeStartup and Shutdown についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by