imshow with True Size for multiple images

Versión 1.0.0.0 (9,63 KB) por Adi Navve
imshowTruesize plots series of images in a single figure while preserving the actual aspect ratio
695 Descargas
Actualizado 6 jul 2011

Ver licencia

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

Citar como

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

Compatibilidad con la versión de MATLAB
Se creó con R2011a
Compatible con cualquier versión
Compatibilidad con las plataformas
Windows macOS Linux
Categorías
Más información sobre Aspect Ratios and Layout en Help Center y MATLAB Answers.

Community Treasure Hunt

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

Start Hunting!
Versión Publicado Notas de la versión
1.0.0.0