MATLAB Answers

How to display multiple images (non indexed images) with different sizes in a row?

조회 수: 4(최근 30일)
Salad Box
Salad Box 8 May 2019
댓글: Image Analyst 17 May 2019
Hi
Say I have 3 images and they are not indexed images therefore they don't have X, map, they only have RGB values.
And these 3 images are of different sizes.
How do I display them in a row?

  댓글 수: 0

댓글을 달려면 로그인하십시오.

답변(2개)

gonzalo Mier
gonzalo Mier 8 May 2019
I would use moon1, moon2 and moon3 as 3 images that can be different and with different size, but I will obtain them as
moon1 = imread('moon.tif');
moon2 = imread('moon.tif');
moon3 = imread('moon.tif');
If you want them to be plotted in the same row you can use subplot to create the sections in the figure and imshow to plot them as:
subplot(3,1,1); imshow(moon1);
subplot(3,1,2); imshow(moon2);
subplot(3,1,3); imshow(moon3);

  댓글 수: 2

Salad Box
Salad Box 9 May 2019
Is 'moon1' just a random variable like 'RGB1'?
If so I have already done it and for some unknown reason the two images with different sizes look exactly the same size when I used 'subplot'. So not sure subplot would deal with my problem.
gonzalo Mier
gonzalo Mier 9 May 2019
Yes, moon1 is just a random image as RGB1. subplot will resize the images to fill the space that you want to give them. If I want moon look 3 times bigger than moon3 and moon2 twice bigger than moon3, you can distribute your subplots as:
subplot(6,1,[1,2,3]); imshow(moon1);
subplot(6,1,[4,5]); imshow(moon2);
subplot(6,1,[6]); imshow(moon3);
But you have to previously map the figure as you want. For more info look in subplot

댓글을 달려면 로그인하십시오.


Image Analyst
Image Analyst 9 May 2019
Have you tried imtile()?

  댓글 수: 6

표시 이전 댓글 수: 3
Image Analyst
Image Analyst 11 May 2019
It's been in the Image Processing Toolbox since R2018b. Use "ver" to find out what toolboxes you have. Otherwise you might try montage().
Salad Box
Salad Box 16 May 2019
I'm using R2018a and I do have the 'Image processing Toolbox' but 'imtile is not found'. Does anyone know why?
Untitled.png
Image Analyst
Image Analyst 17 May 2019
Because 2018a came out in March 2018, while 2018b (which is the release where imtile first was introduced) came out in September 2018. So your version came out BEFORE the function was introduced. Why not just upgrade?
Or stitch them together, like
rgb3 = [rgbImage1, regImage2, rgbImage3];
They must all have the same number of rows. If not, figure out how many rows need to be added to the smaller ones and use padarray(). Or else use imresize() to make them all the same size.

댓글을 달려면 로그인하십시오.

범주


Translated by