imshow with True Size for multiple images

imshowTruesize plots series of images in a single figure while preserving the actual aspect ratio
689 download
Aggiornato 6 lug 2011

Visualizza la licenza

IMSHOWTRUESIZE plots series of images in a single figure while preserving the actual
aspect ratio or scale of the images (similar to the functionality of truesize but in
a multiple images situation).

the images can be aligned to the left of the figure, to the top or centered, as desired.
Using the returned handles the user can set properties for the plots such as title,
axis, etc.
This function comes in handy when you want to plot images with different sizes in one
figure and you want to preserve the aspect ratio of the images. This is not the case
with imshow since imshow changes the scales of the images. The example below demonstrates
this downside of imshow and shows how imshowTruesize handles this situation successfully.

Example usage:
% compare imshow vs. imshoTruesize.
% the example requires image processing toolbox
% images of Mandelbrot set in differenct scales
mand = imread('mandelbrot_set.jpg');
dim = 3;
clear imagesCellArray
[imagesCellArray{1:dim,1:dim}] = deal(mand);
for iRow = 1:dim
for iCol = 1:dim
imagesCellArray{iRow,iCol} = imresize(imagesCellArray{iRow,iCol},1/(1.5*(iCol*iRow)));
end
end
% plot with imshow - true aspect ration is lost
figure
for iRow = 1:dim
for iCol = 1:dim
subplot(dim,dim,sub2ind([dim,dim],iRow,iCol))
imshow(imagesCellArray{iRow,iCol})
axis on
end
end
% plot with imshowTruesize - true aspect ration is preserved
margins = [25 25];
Handles = imshowTruesize(imagesCellArray,margins);
for iRow = 1:dim
for iCol = 1:dim
axis(Handles.hSubplot(iRow,iCol),'on')
end
end

Comments, suggestions, bug reports and any other feedback is welcomed at adi.navve[at]gmail[dot]com

Cita come

Adi Navve (2024). imshow with True Size for multiple images (https://www.mathworks.com/matlabcentral/fileexchange/32094-imshow-with-true-size-for-multiple-images), MATLAB Central File Exchange. Recuperato .

Compatibilità della release di MATLAB
Creato con R2011a
Compatibile con qualsiasi release
Compatibilità della piattaforma
Windows macOS Linux
Categorie
Scopri di più su Aspect Ratios and Layout in Help Center e MATLAB Answers

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
Versione Pubblicato Note della release
1.0.0.0