怎么用MATLAB把多张图片合成AVI动画
发布网友
发布时间:2022-05-07 07:09
我来回答
共4个回答
热心网友
时间:2023-04-28 04:31
哈哈,我基于楼上的,做了一个
注意,你改一下你的路径,就是pic=dir('.\*.jpg')
你把第一个点改成你的路径。
另外图片命名规则为
1.jpg
2.jpg
3.jpg
……
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
clear
pic=dir('.\*.jpg');
%取文件的数量:num
a=size(pic);
num=a(1);
for i=1:num
im(:,:,:,i)=imread(strcat(num2str(i),'.jpg'));
imshow(im(:,:,:,i))
M(i) = getframe;
end
movie2avi(M,'out.avi','FPS',1)%输出视频
热心网友
时间:2023-04-28 04:32
用movie2avi
你可以模仿下面的程序
clear;clc;
for j=1:20
f=@(x,y)sin(x+j)+cos(y-j);
ezmesh(f);
M(j) = getframe; %记录每一祯
end
movie2avi(M,'out.avi')%输出视频
热心网友
时间:2023-04-28 04:32
>> clear
pic=dir('C:\Users\YangCao\Desktop\Animation\kfxview0001.jpg', 'C:\Users\YangCao\Desktop\Animation\kfxview0003.jpg','C:\Users\YangCao\Desktop\Animation\kfxview0004.jpg','C:\Users\YangCao\Desktop\Animation\kfxview0005.jpg','C:\Users\YangCao\Desktop\Animation\kfxview0006.jpg','C:\Users\YangCao\Desktop\Animation\kfxview0007.jpg','C:\Users\YangCao\Desktop\Animation\kfxview0008.jpg','C:\Users\YangCao\Desktop\Animation\kfxview0009.jpg','C:\Users\YangCao\Desktop\Animation\kfxview0010.jpg','C:\Users\YangCao\Desktop\Animation\kfxview0011.jpg','C:\Users\YangCao\Desktop\Animation\kfxview0012.jpg','C:\Users\YangCao\Desktop\Animation\kfxview0013.jpg','C:\Users\YangCao\Desktop\Animation\kfxview0014.jpg','C:\Users\YangCao\Desktop\Animation\kfxview0015.jpg','C:\Users\YangCao\Desktop\Animation\kfxview0016.jpg','C:\Users\YangCao\Desktop\Animation\kfxview0017.jpg','C:\Users\YangCao\Desktop\Animation\kfxview00181.jpg','C:\Users\YangCao\Desktop\Animation\kfxview0019.jpg','C:\Users\YangCao\Desktop\Animation\kfxview0020.jpg','C:\Users\YangCao\Desktop\Animation\kfxview0021.jpg','C:\Users\YangCao\Desktop\Animation\kfxview0022.jpg','C:\Users\YangCao\Desktop\Animation\kfxview0023.jpg','C:\Users\YangCao\Desktop\Animation\kfxview0024.jpg','C:\Users\YangCao\Desktop\Animation\kfxview0025.jpg','C:\Users\YangCao\Desktop\Animation\kfxview0026.jpg','C:\Users\YangCao\Desktop\Animation\kfxview0027.jpg','C:\Users\YangCao\Desktop\Animation\kfxview0028.jpg','C:\Users\YangCao\Desktop\Animation\kfxview0029.jpg','C:\Users\YangCao\Desktop\Animation\kfxview0030.jpg','C:\Users\YangCao\Desktop\Animation\kfxview0031.jpg','C:\Users\YangCao\Desktop\Animation\kfxview0032.jpg','C:\Users\YangCao\Desktop\Animation\kfxview0033.jpg','C:\Users\YangCao\Desktop\Animation\kfxview0034.jpg','C:\Users\YangCao\Desktop\Animation\kfxview0035.jpg','C:\Users\YangCao\Desktop\Animation\kfxview0036.jpg','C:\Users\YangCao\Desktop\Animation\kfxview0037.jpg','C:\Users\YangCao\Desktop\Animation\kfxview0038.jpg','C:\Users\YangCao\Desktop\Animation\kfxview0039.jpg','C:\Users\YangCao\Desktop\Animation\kfxview0040.jpg','C:\Users\YangCao\Desktop\Animation\kfxview0041.jpg','C:\Users\YangCao\Desktop\Animation\kfxview0042.jpg','C:\Users\YangCao\Desktop\Animation\kfxview0043.jpg','C:\Users\YangCao\Desktop\Animation\kfxview0044.jpg','C:\Users\YangCao\Desktop\Animation\kfxview0045.jpg','C:\Users\YangCao\Desktop\Animation\kfxview0046.jpg','C:\Users\YangCao\Desktop\Animation\kfxview0047.jpg','C:\Users\YangCao\Desktop\Animation\kfxview0048.jpg','C:\Users\YangCao\Desktop\Animation\kfxview0049.jpg','C:\Users\YangCao\Desktop\Animation\kfxview0050.jpg','C:\Users\YangCao\Desktop\Animation\kfxview0051.jpg','C:\Users\YangCao\Desktop\Animation\kfxview0052.jpg','C:\Users\YangCao\Desktop\Animation\kfxview0053.jpg','C:\Users\YangCao\Desktop\Animation\kfxview0054.jpg','C:\Users\YangCao\Desktop\Animation\kfxview0055.jpg','C:\Users\YangCao\Desktop\Animation\kfxview0056.jpg','C:\Users\YangCao\Desktop\Animation\kfxview0057.jpg','C:\Users\YangCao\Desktop\Animation\kfxview0058.jpg','C:\Users\YangCao\Desktop\Animation\kfxview0059.jpg','C:\Users\YangCao\Desktop\Animation\kfxview0060.jpg','C:\Users\YangCao\Desktop\Animation\kfxview0061.jpg','C:\Users\YangCao\Desktop\Animation\kfxview0062.jpg',);
%取文件的数量:num
a=size(pic);
num=a(1);
for i=1:mun
im(:,:,:,i)=imread(strcat(num2str(i),'.jpg'));
imshow(im(:,:,:,i))
M(i) = getframe;
end
movie2avi(M,'out.avi','FPS',1)%输出视频
pic=dir('C:\Users\YangCao\Desktop\Animation\kfxview0001.jpg', 'C:\Users\YangCao\Desktop\Animation\kfxview0003.jpg',........);
错误: 表达式无效。调用函数或对变量进行索引时,请使用圆括号。否则,请检查不匹配的分隔符。
请大神指导一下!谢谢!
热心网友
时间:2023-04-28 04:33
movie2avi