How can i enlarge displayed images in a figure ?
Ältere Kommentare anzeigen
I want to display a total of 100 images (they have different sizes) in a figure. when i do so the images are shrinked a lot, so i want to enlarge them a bit just so that they'd be visible. (a screenshot of the figure is bellow) and here's my code :
figure('Name','Retrieved images','NumberTitle','off');
for i = 1:100
subplot(5,20,i);
imshow(imread(fullfile('C:\Users\viet\Desktop\image.orig',meanValuesW(i).baseFileName)));
end

Akzeptierte Antwort
Weitere Antworten (1)
Image Analyst
am 13 Apr. 2022
Bearbeitet: Image Analyst
am 13 Apr. 2022
Maybe try imshow with the 'Border', 'Tight' option.
figure('Name','Retrieved images','NumberTitle','off');
for i = 1:100
subplot(5,20,i);
thisFileName = fullfile('C:\Users\viet\Desktop\image.orig',meanValuesW(i).baseFileName);
rgbimage = imread(thisFileName);
imshow(rgbimage, 'Border', 'tight');
end
Or try using imtile() or montage().
3 Kommentare
nissrine Neyy
am 14 Apr. 2022
Image Analyst
am 14 Apr. 2022
I'm pretty sure montage() or imtile() don't leave tons of gray space around each image. Post a screenshot of how it looked for you.
Same as in my example, but with montage()
% test images
L = ones(66,100); % landscape AR 3/2
P = ones(100,66); % portrait AR 2/3
imgs = {L P};
% there are 14 portrait images, 100 total
idx = ones(100,1);
idx(1:14) = 2;
idx = idx(randperm(100));
% build a cell array of images
C = cell(100,1);
for k = 1:100
C{k} = imgs{idx(k)}*rand(1)*0.5 + 0.25;
end
montage(C,'size',[8 13])
Kategorien
Mehr zu Display Image finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

