Imtile resolution changes with figure height

조회 수: 31 (최근 30일)
Jason
Jason 2025년 11월 13일 17:58
댓글: Jason 2025년 11월 14일 16:10
Hello, Im using imtile to create a montage from an array of images
out=imtile(IMarray,'GridSize',[r c]);
I display this on a fig via:
fig = uifigure('Name',['Montage ',char(tl)]);
fig.HandleVisibility='on';
fig.Position = [300 200 figW figH];
m = uimenu(fig,Label="My Save As");
m.MenuSelectedFcn = @app.mysavefunc;
app.figMontage=fig; % assign to public property so can be accessed
g = uigridlayout(fig);
%Create 3 x 2 Grid Layout
g.RowHeight = {'9x','1x','1x','1x'}; % g.RowHeight = {'6x','6x','1x','1x'};
g.ColumnWidth = {'1x','1x','1x','16x','0.8x'}; %g.ColumnWidth = {'1x','8x'};
%add UIAXES to 1st 2 rows, 1st 2columns
app.axMontage = uiaxes(g);
app.axMontage.Layout.Row = [1,2];
app.axMontage.Layout.Column = [1 5];
myImagesc(app,app.axMontage,out); axis(app.axMontage,'image'); drawnow;
So Ive noticed when y figure is 1500 x 600, the images look a lot better than when the figure is only 300 high - even though with the 300 height figure, the montage completely fits
  댓글 수: 2
DGM
DGM 대략 22시간 전
편집: DGM 대략 20시간 전
It might be worth noting that the default behavior for imtile() sets the tile size to the geometry of the first image. If your images vary in size and you don't want any of them downsampled in the operations internal to imtile(), then you need to explicitly set ThumbnailSize in the call to imtile().
It's not really obvious from the example if your images do vary, but I figured I'd throw that out there.
Like Matt said though, even if there isn't any downsampling happening in the output of imtile(), if the composite image size exceeds the displayed size, then it must be downsampled for display.
Depending on what tool you're using to display the composite image (imshow() vs image()/imagesc()), the display interpolation is likely nearest-neighbor. That tends to accentuate aliasing in images with small features and hard edges. While imshow() supports bilinear display interpolation, it's not the default. See imshow. It might help ease some of the appearance, but if the image is being downsampled for display, it doesn't change the fact that it's being downsampled.
Jason
Jason 대략 16시간 전
Thanks, see my reply to Matt.

댓글을 달려면 로그인하십시오.

채택된 답변

Matt J
Matt J 대략 24시간 전
So Ive noticed when y figure is 1500 x 600, the images look a lot better than when the figure is only 300 high - even though with the 300 height figure, the montage completely fits
The montage will always fit, independently of the height of the figure. However, as the figure dimensions gets smaller, it forces the renderer to downsample your image to make it occupy fewer pixels, and that will of course degrade the appearance of the image.
  댓글 수: 3
Matt J
Matt J 대략 13시간 전
편집: Matt J 대략 13시간 전
You can do,
g.RowHeight = {400,'1x','1x','1x'};
though keep in mind that this sets the first row to 400 logical pixels, not hardware pixels. On Windows systems, a logical pixel is always 1/96 inches,
Maybe you should consider imresizing by a smaller factor, e.g., to 800x800 and using a different interpolation method as @DGM mentions. Then you don't have to worry so much about how visual quality depends on the figure size.
Jason
Jason 대략 7시간 전
Thankyou

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

제품


릴리스

R2024b

Community Treasure Hunt

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

Start Hunting!

Translated by