how to put several image into one figure.
9 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
hi all.
I load a folder that contains 255 'tif' images. I put all images together in one figure, but there are spaces between each image.
Can anyone tell me how to put images without any spaces?
Thanks in advance.
Below shows all images in a plot.
my code is:
folder_name = uigetdir;
f = dir(fullfile(folder_name, '*tif'));
for ii = 1 : length(f)
im = imread(f(ii).name);
subplot(15,15,ii);
colormap(gray);
imagesc(im);
end
0 Commenti
Risposte (2)
Geoff Hayes
il 12 Ott 2014
Mehdi - if all of your images have the same dimension (all are mxn) then you could do something like the following
m = 15; % number of subplots per row
n = 15; % number of subplots per column
hAxes = [];
for u=1:m
for v=1:n
% create the subplot at the given position
hAxes(u,v) = subplot('Position',[(v-1)/n 1-(u/m) 1/n 1/m]);
% add the (dummy) 100x200 image
imagesc(repmat(uint8(randi(255,1,1,3)),100,200,1),'Parent',hAxes(u,v));
% hide the axes ticks, labels, etc.
set(hAxes(u,v),'Visible','off');
end
end
The above just creates a grid of 15x15 subplots, where each plot is just a solid (random) colour. Each plot is positioned in such a way that there is no space between each one. You should be able to place your tiff images in a similar manner.
Else, you could just create one image that is composed of all 225 sub-images, and then display just that image.
0 Commenti
Image Analyst
il 12 Ott 2014
Simply use montage() rather than calling subplot 255 times, that is if you have enough memory. If you don't, then you'll have to create an image and paste the images onto it, after downsizing them. See my copy and past demo, attached.
0 Commenti
Vedere anche
Categorie
Scopri di più su Geometric Transformation and Image Registration in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!