📄 compute_avi_file.m
字号:
function compute_avi_file(A, filename, fps)% compute_avi_file - create an avi file%% compute_avi_file(A, filename, fps);%% A can be a 3D array or a cell array of 2D matrices.% Each A{k} or A(:,:,k) is one frame in the animation.%% Copyright (c) 2007 Gabriel Peyre if nargin<3 fps = 10;endif not(iscell(A)) && not(isstr(A)) B = A; A = {}; for i=1:size(B,3) A{end+1} = B(:,:,i); endend% 'Indeo3', 'Indeo5', 'Cinepak', 'MSVC', 'RLE' or 'None'compressor = 'Cinepak';compressor = 'none';qual = 50;% close all;% figure;if iscell(A) nb = length(A);else nb = length( dir([A '*.png']) );endaviobj = avifile(filename, 'compression', compressor, 'quality', qual, 'fps', fps );% aviobj = avifile(filename, 'fps', fps );for j=1:nb progressbar(j,nb); if iscell(A) B = A{j}; else % A is a filename B = load_image( [A '-' num2string_fixeddigit(j-1,3)] ); end B = round(rescale( B, 1,256)); if size(B,3)==3 frame = im2frame( rescale(B) ); else frame = im2frame(B,gray(256)); end % imageplot(A{j}); % frame = getframe ( gca ); aviobj = addframe( aviobj, frame );endwarning off;aviobj = close( aviobj );warning on;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -