<>%source code filename: PrettyGirl_TO_Beast.m
%create a AVI file by using morphing technique
%load two image(s) for morphing
%f -- image before morfhing('lenna.bmp')
%g -- image after morpfing('mandril.bmp')
f = imread('lenna.bmp');
g = imread('mandril.bmp');</P>
<>% create a AVI file</P>
<>mov = avifile('PrettyGirl_TO_Beast.avi');
mov.Quality = 100; %high quality
mov.Fps = 25; %25 frame(s) per second</P>
<P>%make morphing image and add it to AVI file as a frame</P>
<P>t = 0.00;
while(t <= 1.00)
h = imlincomb(1-t,f,t,g); %linear combination of two images - morphing techique
mov = addframe(mov,h); %add image to AVI as frame
t = t + 0.01;
end;</P>
<P>%close AVI stream file and write AVI file</P>
<P>mov = close(mov);</P>
<P>注:lenna 和 mandril 都是典型的 图象处理图片 只要在Google上搜索就可以(点“图象搜索”)</P>