Image 在MATLAB中在一个窗口上显示多个图像

Image 在MATLAB中在一个窗口上显示多个图像,image,matlab,subplot,Image,Matlab,Subplot,这些是我的原始图像,我需要在一个图中显示 以下是我的源代码 function draw_multiple_images(image_list) N = length(image_list); [m, n] = factor_out(N); % create the subplots figure; if(iscell(image_list)) for k=1:N h = subplot(m,n,

这些是我的原始图像,我需要在一个图中显示

以下是我的源代码

function draw_multiple_images(image_list)    
    N = length(image_list);
    [m, n] = factor_out(N);

    % create the subplots
    figure;

    if(iscell(image_list))    
        for k=1:N
            h = subplot(m,n,k);
            image(image_list{k},'Parent',h);
            set(gca,'xtick',[],'ytick',[])
        end    
    elseif(isvector(image_list))
         for k=1:N
            h = subplot(m,n,k);
            image(image_list(k),'Parent',h);
            set(gca,'xtick',[],'ytick',[])
        end
    end
end
输出

为什么我把它们看作蓝黄色


我需要将它们显示为黑白。

我使用
彩色贴图(灰色(256))解决了这个问题紧跟在
命令之后

function draw_multiple_images(image_list)    
    d = size(image_list);
    l = length(d);

    figure;
    hold all
    colormap(gray(256));  

    if(l==2)
        N = length(image_list);
        [m, n] = factor_out(N);

        if(iscell(image_list))    
            for k=1:N
                h = subplot(m,n,k);
                image(image_list{k},'Parent',h);
                set(gca,'xtick',[],'ytick',[])
            end    
        elseif(isvector(image_list))
            for k=1:N
                h = subplot(m,n,k);
                image(image_list(k),'Parent',h);
                set(gca,'xtick',[],'ytick',[])
            end
        end
    elseif(l==3)
        N = d(3) ;
        [m, n] = factor_out(N);
        for k=1:N
            I = image_list(:,:,k);
            subplot(m,n,k);
            imshow(I);
            set(gca,'xtick',[],'ytick',[])
        end  
    end     
    hold off
end 

你的问题是什么?图像列表是图像名称的列表?还是图像作为矩阵?我想知道的是你如何阅读图片。尝试:
Image(uint8(图像列表(k)),'Parent',h)