9

EDITTED:

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); 

Any ideas how can I do it?


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).

Any help how can I do it?

Thanks in advance.

6
  • 1
    Have you tried "subplot" function? Commented May 26, 2012 at 20:41
  • Yes I have, but it didn't work as it should. Most of the figure was empty and the images were so small. Commented May 26, 2012 at 20:51
  • @HowaidaKhoureieh: can you show the code you have tried so far? Commented May 26, 2012 at 21:11
  • For example: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)) Commented May 26, 2012 at 21:12
  • there is some gui programming here : mathworks.com/help/techdoc/creating_guis/… Commented May 26, 2012 at 21:18

1 Answer 1

14

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 

enter image description here

Another function to look into is the MONTAGE function from the IPT Toolbox:

%# given the above cell array `imgs` montage( cat(4,imgs{:}) ) 
Sign up to request clarification or add additional context in comments.

1 Comment

@Amro, Thanks alot for the answer. It is really useful. But I editted the question, and would be very happy if you helped me with it. Thanks again.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.