如何在同一个图中显示几个图像 - Matlab [英] How to show several images in the same figue - Matlab
问题描述
已知:
Hii,
抱歉没有提及它,我需要做的是显示6张图片同一个数字。 此外,在每个图像(帧)我需要绘制一些点(我的代码跟踪脸部的动作 - 眼睛,鼻子,嘴唇。)
我有246个图像(帧)
Hii, sorry not mentioning it earlier, what I need to do is to display 6 images in the same figure at the same time. Besides, at every image (frame) I need to draw some points (my code tracks the moves of the face - the eyes, nose, lips.) I have 246 images (frames)
这是我使用的主要功能:
this is the main functions I use:
// 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个图像(同时)。并让用户选择其中一个图像进行编辑(点击它)。
I need to write a code that displays 6 images in the same figure (at the same time). and lets the user to choose one of the images to edit it (by clicking on it).
任何帮助我该怎么办?
提前致谢。
推荐答案
这是一个简单的例子,可以帮助您入门:
Here is a simple example to get you started:
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
另一个要研究的功能是 MONTAGE 功能:
Another function to look into is the MONTAGE function from the IPT Toolbox:
%# given the above cell array `imgs`
montage( cat(4,imgs{:}) )
这篇关于如何在同一个图中显示几个图像 - Matlab的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!