美文网首页
使用matlab制作gif动画

使用matlab制作gif动画

作者: 冬风十里Y | 来源:发表于2018-10-13 16:30 被阅读32次
    for i =1:16
       [I,map] = gray2ind(img,256);%rgb2ind()
       if(i==1)
           imwrite(I,map,'movefig.gif','DelayTime',1,'LoopCount',Inf)
     % 将索引图像保存为movefig.gif,LoopCount表示重复动画的次数,Inf的LoopCount值可使动画连续循环,DelayTime为1,表示第一帧图像显示的时间
       else
           imwrite(I,map,'movefig.gif','WriteMode','append','DelayTime',0.3)
    % 将索引图像保存为movefig.gif,WriteMode表示写入模式,与append(或overwrite)配合使用,append模式下,imwrite会向现有文件添加单个帧
         % DelayTime为1,表示后续图像的播放时间间隔为0.3秒
       end
    end
    

    参考文献:
    https://blog.csdn.net/qq_15971883/article/details/79698836
    http://www.ilovematlab.cn/thread-71698-1-1.html
    https://blog.csdn.net/zhenhang525099/article/details/50993242?locationNum=14&fps=1

    相关文章

      网友评论

          本文标题:使用matlab制作gif动画

          本文链接:https://www.haomeiwen.com/subject/dhwoaftx.html