1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
| %This function makes a simple avi movie from a sequence of frames
%The user can control the display time of each frame. The movie is created
%in the same folder where this function is run.
%
%Usage:
% Inputs:
% name: root name of the framse
% filetype: '.bmp' , '.jpg' , '.jpeg' , '.tif' ,,,,
% number_of_frames: number of the frames
% display_time_of_frame: it is the display time of each frame
%
% Output:
% it creates a file named as Movie.avi in the same folder of this function
%
% Usage: Try the simple provided example
% Movie_from_frames('image','.bmp',4,10)
%This function is written by :
% Nassim Khaled
% American University of Beirut
% Research Assistant and Masters Student
function Movie_from_frames(filetype,number_of_frames,display_time_of_frame)
mov = avifile('MOVIE.avi');
count=0;
for i=1:number_of_frames
name1=strcat(num2str(i),filetype);
a=imread(name1);
while count<display_time_of_frame
count=count+1;
imshow(a);
F=getframe(gca);
mov=addframe(mov,F);
end
count=0;
end
close all
mov=close(mov); |
Partager