【问题标题】:How to show several images in the same figue - Matlab如何在同一个图中显示多个图像 - Matlab
【发布时间】:2012-06-01 22:22:17
【问题描述】:

已编辑:

嗨, 不好意思前面没有提到,我需要做的是在同一个图中同时显示 6 个图像。 此外,在每个图像(帧)上,我都需要绘制一些点(我的代码会跟踪脸部的移动 - 眼睛、鼻子、嘴唇。) 我有 246 张图片(帧)

这是我使用的主要功能:

   // The points/ coordinates of the lips, eyes and nose of the image "i".
Points = createPointsStructure (landmarks , i , NumOfLandarkPerFrame);
   // Draw landmarks and splines on the frame i (and draw/show the frame)
DrawAllPointsOnFace (pointArr , Points , img , 1  , position, i);

任何想法我该怎么做?


我需要编写一个代码,在同一个图中(同时)显示 6 个图像。并让用户选择其中一张图像进行编辑(通过单击它)。

有什么帮助吗?

提前致谢。

【问题讨论】:

  • 你试过“subplot”功能吗?
  • 是的,我有,但它没有按应有的方式工作。大部分图是空的,图像太小了。
  • @HowaidaKhoureieh:你能展示一下你目前尝试过的代码吗?
  • 例如:subplot(2,2,1),imshow(rand(50,50)) , subplot(2,2,2),imshow(rand(50,50)) , subplot (2,2,3),imshow(rand(50,50)) , subplot(2,2,4),imshow(rand(50,50))
  • 这里有一些 gui 编程:mathworks.com/help/techdoc/creating_guis/…

标签: matlab image-processing


【解决方案1】:

下面是一个简单的示例,可以帮助您入门:

function ImagesExample()
    %# read images in a cell array
    imgs = cell(6,1);
    for i=1:6
        imgs{i} = imread( sprintf('AT3_1m4_%02d.tif',i) );
    end

    %# show them in subplots
    figure(1)
    for i=1:6
        subplot(2,3,i);
        h = imshow(imgs{i}, 'InitialMag',100, 'Border','tight');
        title(num2str(i))
        set(h, 'ButtonDownFcn',{@callback,i})
    end

    %# mouse-click callback function
    function callback(o,e,idx)
        %# show selected image in a new figure
        figure(2), imshow(imgs{idx})
        title(num2str(idx))
    end
end

另一个要研究的函数是 IPT 工具箱中的 MONTAGE 函数:

%# given the above cell array `imgs`
montage( cat(4,imgs{:}) )

【讨论】:

  • @Amro,非常感谢您的回答。它真的很有用。但我编辑了这个问题,如果你能帮我解决这个问题,我会很高兴。再次感谢。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2012-01-21
  • 2017-10-28
  • 2021-02-28
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2013-03-21
相关资源
最近更新 更多