📄 immovie.m
字号:
function mov = immovie(X,map,debug)
%IMMOVIE Make movie from multiframe indexed image.
% MOV = IMMOVIE(X,MAP) returns the movie matrix MOV from the
% images in the multiframe indexed image X. As it creates the
% movie matrix, it displayes the movie frames on the
% screen. You can play the movie using the MATLAB MOVIE
% function.
%
% X comprises multiple indexed images, all having the same size
% and all using the colormap MAP. X is an M-by-N-by-1-by-K
% array, where K is the number of images.
%
% Class Support
% -------------
% X can be of class uint8 or double. MOV is of class double.
%
% Example
% -------
% load mri
% mov = immovie(D,map);
% movie(mov,3)
%
% See also GETFRAME, MONTAGE, MOVIE.
% Clay M. Thompson 5-12-93
% Revised for IPT v2 by Steven L. Eddins, September 1996
% Copyright 1993-1998 The MathWorks, Inc. All Rights Reserved.
% $Revision: 5.11 $ $Date: 1997/11/24 15:35:26 $
error(nargchk(2,3,nargin))
if (nargin > 2)
debug = 1;
system_dependent(7);
else
debug = 0;
end
if (isequal(size(map), [1 3]) & (prod(map) == prod(size(X))))
% old style syntax
% immovie(D,siz)
X = reshape(X,[map(1) map(2) 1 map(3)]);
map = colormap;
if (debug)
mov = immovie(X,map,'debug');
else
mov = immovie(X,map);
end
else
figure(gcf) % Make sure the current figure is in front
imshow(X(:,:,:,1), map);
if (debug)
fprintf('\n\nFrame 1:\n');
fprintf(' axes position = %s\n', mat2str(get(gca,'position')));
end
% Initialize movie matrix and get first frame.
mov = moviein(size(X,4));
tmp = getframe;
if (debug)
fprintf(' movie size = %s\n', mat2str(size(mov)));
fprintf(' getframe size = %s\n', mat2str(size(tmp)));
end
mov(:,1) = tmp;
% Get the rest of the frames.
for i=2:size(X,4)
imshow(X(:,:,:,i), map);
tmp = getframe;
if (debug)
fprintf('\nFrame %d:\n', i);
fprintf(' axes position = %s\n', mat2str(get(gca,'position')));
fprintf(' getframe size = %s\n', mat2str(size(tmp)));
end
mov(:,i) = tmp;
end
end
if (debug)
system_dependent(7);
end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -