Turning a sequence of images into a gif directly

5 visualizzazioni (ultimi 30 giorni)
Etienne Leclerc
Etienne Leclerc il 30 Lug 2018
Commentato: KSSV il 31 Lug 2018
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 Commenti
Aquatris
Aquatris il 31 Lug 2018
You are missing some code. Take a look at the answer to this question and modify your code accordingly.
KSSV
KSSV il 31 Lug 2018
YOur A is of class matlab.graphics.primitive.Image. YOu cannot write this using imwrite.

Accedi per commentare.

Risposte (0)

Community Treasure Hunt

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

Start Hunting!

Translated by