GETFRAME関数​で取得したデータから​アニメーションGIF​を作成するにはどうす​ればよいですか?

조회 수: 8 (최근 30일)
MathWorks Support Team
MathWorks Support Team 2010년 1월 29일
GETFRAME関数で取得したデータからアニメーションGIFを作成する方法を教えてください。

채택된 답변

MathWorks Support Team
MathWorks Support Team 2010년 1월 29일
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개)

카테고리

Help CenterFile Exchange에서 アニメーション에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!