int2struct.m

来自「基于MATLAB的媒体播放器」· M 代码 · 共 27 行

M
27
字号
function S=int2struct(R,G,B)
%INT2STRUCT Convert intensity movie frames to a movie structure.
%   INT2STRUCT(I) converts a 3-D intensity movie array, I, into a
%   standard MATLAB movie structure.
%
%   INT2STRUCT(R,G,B) converts separate 3-D intensity movies R, G,
%   and B, representing the red, green, and blue color planes of an
%   RGB video, respectively, into a standard MATLAB movie structure.

% Copyright 2003 The MathWorks, Inc.
% $Revision: $ $Date: $

if nargin==1,
    % Intensity input
    for j=1:size(R,3),
        S(j).cdata=R(:,:,j);
        S(j).colormap=[];
    end
else
    % RGB inputs
    error(nargchk(3,3,nargin));
    for j=1:size(R,3),
        S(j).cdata=cat(3,R(:,:,j),G(:,:,j),B(:,:,j));
        S(j).colormap=[];
    end
end

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?