GETFRAME関数で取得したデータからアニメーションGIFを作成するにはどうすればよいですか?
10 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
GETFRAME関数で取得したデータからアニメーションGIFを作成する方法を教えてください。
Akzeptierte Antwort
MathWorks Support Team
am 29 Jan. 2010
RGB2INDでRGBデータをインデックス付きデータに変更し、IMWRITEの'WriteMode'を'append'にすることでアニメーションGIFを作成することができます。
Z = peaks;
surf(Z)
axis tight
set(gca,'nextplot','replacechildren');
for k = 1:20
surf(sin(2*pi*k/20)*Z,Z)
F = getframe;
% RGBデータをインデックス付きデータに変更
[X,map] = rgb2ind(F.cdata,256);
if k==1
% GIFファイルに書き出し
imwrite(X,map,'output.gif')
else
% 2回目以降は'append'でアニメーションを作成
imwrite(X,map,'output.gif','WriteMode','append')
end
end
0 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu アニメーション finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!