※ 引述《taylorp (smallpp)》之銘言:
: 請教版上的高手
: 我有數張.jpg的圖檔,想要做成動畫
: 請問該如何讀檔並播放
: 煩請指教,謝謝
: ꄊ以下的程式碼是出於
http://www.mathworks.com/matlabcentral/fileexchange/loadFile.do?objectId=7900
為方便精華區收錄 所以將其原始程式碼po出來
若有網友需引用 請確實註明出處 (非PTT MATLAB版)
謝謝!
%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(name,filetype,number_of_frames,display_time_of_
frame)
mov = avifile('MOVIE.avi');
count=0;
for i=1:number_of_frames
name1=strcat(name,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);
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 140.135.12.39