imshow with True Size for multiple images

バージョン 1.0.0.0 (9.63 KB) 作成者: Adi Navve
imshowTruesize plots series of images in a single figure while preserving the actual aspect ratio
ダウンロード: 695
更新 2011/7/6

ライセンスの表示

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

引用

Adi Navve (2025). imshow with True Size for multiple images (https://jp.mathworks.com/matlabcentral/fileexchange/32094-imshow-with-true-size-for-multiple-images), MATLAB Central File Exchange. に取得済み.

MATLAB リリースの互換性
作成: R2011a
すべてのリリースと互換性あり
プラットフォームの互換性
Windows macOS Linux
カテゴリ
Help Center および MATLAB AnswersAspect Ratios and Layout についてさらに検索

Community Treasure Hunt

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

Start Hunting!
バージョン 公開済み リリース ノート
1.0.0.0