Turning a sequence of images into a gif directly

조회 수: 3 (최근 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