imageplot.m

来自「image denoising toolbox in matlab」· M 代码 · 共 85 行

M
85
字号
function imageplot(M,str, a,b,c)% imageplot - diplay an image and a title%% Example of usages:%   imageplot(M);%   imageplot(M,title);%   imageplot(M,title,1,2,1);   % to make subplot(1,2,1);%%   If you want to display several images:%       imageplot({M1 M2}, {'title1', 'title2'});%%   Copyright (c) 2007 Gabriel Peyreif nargin<2    str = [];endnbdims = 2;if size(M,1)==1 || size(M,2)==1    nbdims = 1;endif iscell(M)    q = length(M);    if nargin<5        c = 1;        a = ceil(q/4);        b = ceil(q/a);    end    if (c-1+q)>(a*b)        warning('a and c parameters not large enough');        a = ceil((c-1+q)/4);        b = ceil((c-1+q)/a);    end    for i=1:q        if iscell(str)            str1 = str{i};        else            str1 = str;        end        imageplot(M{i},str1, a,b,c-1+i);    end    global axlist;    if not(isempty(axlist))        linkaxes(axlist, 'xy');    end    return;endif nargin==5    global axlist;    global imageplot_size;    if c==1 || isempty(imageplot_size) || imageplot_size~=size(M,1)        clear axlist;         global axlist;         axlist = [];        imageplot_size = size(M,1);    end    axlist(end+1) = subplot(a,b,c);endif nbdims==1    plot(M); axis tight;else    if size(M,3)==2        M = cat(3,M, zeros(size(M,1),size(M,2)));    end    if size(M,3)==1        colormap gray(256);    else        colormap jet(256);    end    imagesc(rescale(M)); axis image; axis off;endif not(isempty(str))    title(str);endif nargin==5 && c==a*b    linkaxes(axlist, 'xy');end

⌨️ 快捷键说明

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