Turning a sequence of images into a gif directly

5 ビュー (過去 30 日間)
Etienne Leclerc
Etienne Leclerc 2018 年 7 月 30 日
コメント済み: KSSV 2018 年 7 月 31 日
The process whereby one converts a figure to an image to a GIF is well-documented, but what if I instead have a sequence of images (actually, just a sequence of square arrays I would like to graphically represent in some way) and I want to turn them into a gif?
This is the process which I guessed would give me some success, and indeed the program doesn't spit out any errors. It also, as far as I'm aware, doesn't spit out any output (I've searched my computer for testAnimated.gif and it appears to not exist).
filename = 'testAnimated.gif';
for idx = 1:length(t)
Smap= [AN ARRAY OBTAINED IN SOME WAY]
A=image(Smap*20);
map=colormap(gray);
%[A,map] = rgb2ind(image(X); colormap(map));
if idx == 1
imwrite(A,map,filename,'gif','LoopCount',Inf,'DelayTime',1);
else
imwrite(A,map,filename,'gif','WriteMode','append','DelayTime',1);
end
end
Any help would be appreciated.
  2 件のコメント
Aquatris
Aquatris 2018 年 7 月 31 日
You are missing some code. Take a look at the answer to this question and modify your code accordingly.
KSSV
KSSV 2018 年 7 月 31 日
YOur A is of class matlab.graphics.primitive.Image. YOu cannot write this using imwrite.

サインインしてコメントする。

回答 (0 件)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by