How to use full axes area when zooming image in App GUI

조회 수: 2 (최근 30일)
Simon Allosserie
Simon Allosserie 2022년 3월 18일
편집: Igor Varfolomeev 2024년 9월 1일
I plot an image using imshow in an axis in my APP GUI. Then there can be zoomed in to see details.
Now when you zoom in, only the part where the original image was, shows the zoomed image. All the area around it stays empty. Is there any way to make the zoomed image fill the entire axis area, without distorting the image shape?
original view (see the empty space on the sides):
zoomed in image: empty space on the sides remain, which is very annoying, certainly for images that are super slender). I'd like to have the zoomed image fill up the entire available space.
I already found out about imscrollpanel (and ImageAnalyst's zoom demo), but it doesn't work in an app UI...
Thanks!
  댓글 수: 1
DGM
DGM 2022년 3월 18일
It might not be a complete answer, but this is what I did:
Then again, I was using that with akzoom() and other things which can get flaky in some scenarios in newer versions.
You're right though. It's really annoying.

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

답변 (1개)

Igor Varfolomeev
Igor Varfolomeev 2024년 9월 1일
편집: Igor Varfolomeev 2024년 9월 1일
Try this:
imshow('corn.tif')
set(gca, 'Clipping', 'off')
Zooming with Clipping set to on :
Zooming with Clipping set to off (the image fills all the available area):
One drawback is that xlim and ylim behave somewhat unexpectedly in this mode. To feel this, try the following:
set(gca,'yLim',[100, 101])
The result looks like this (the visible part of the image is clearly higher than 2 pixels):
Still, this is sort of acceptable for image viewing (I use this to plot a grid of images, using GUILayout GridFlex .
I was looking for a behaviour like this for a few years as well, before I found this answer :)

카테고리

Help CenterFile Exchange에서 Data Exploration에 대해 자세히 알아보기

제품


릴리스

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by