フィルターのクリア

How to zoom in the figure/image/montage without the margin surround it?

1 回表示 (過去 30 日間)
Sandy Woo
Sandy Woo 2020 年 9 月 16 日
コメント済み: Sandy Woo 2020 年 9 月 25 日
Hi, when I'm using imshow/montage, I notice that a quite large margin exist around the image when I'm zooming it.
When I zoom in, I thought the image would fill the window like:
But in fact, the image will zoom in and remain its window size like:
This wastes a lot of areas when I'm using a 24 inch monitor, especially when I need to compare several details in montage image. The montage seems very narrow compared with the full screen.
I'm wondering if there are any methods to enlarge the image to fill the window size. Many thanks!

回答 (1 件)

Ameer Hamza
Ameer Hamza 2020 年 9 月 16 日
編集済み: Ameer Hamza 2020 年 9 月 16 日
Try something like this
img1 = imread('pears.png');
imgs = {img1, rgb2gray(img1), imbinarize(img1)};
im = montage(imgs, 'Size', [1 3]);
im.Parent.Position = [0 0 1 1];
  3 件のコメント
Ameer Hamza
Ameer Hamza 2020 年 9 月 16 日
Yes, once the zoom function does not change the position of the axes itself. Doing so seems to be possible but a bit complicated. You will need to attach a callback function with zoom action: https://www.mathworks.com/help/matlab/ref/zoom.html
Sandy Woo
Sandy Woo 2020 年 9 月 25 日
Hi Ameer,
Thanks a lot for your help! I'm quite confused about this help page, as I failed to find a function about this...So would you kindly help me to write an example code based on your example above when you have time?
Cheers

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeDisplay Image についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by