How to make the aspect ratio of the zoom-in window fixed?

조회 수: 6 (최근 30일)
Omar Alamoudi
Omar Alamoudi 2020년 6월 18일
댓글: Omar Alamoudi 2020년 6월 18일
So I'm using AppDesigner to dipslay a sequence of 2D images. All of these images have the same dimensions. Within each image there are regions of interest that I would like to zoom-in to. After setting the axis sytle to image using the follow command
axis(app.UIAxes,'image');
Now, when I zoom-in, the shape of the pixels is preserved which is a desired behavior. In addition, I want is that the zoom-in window shown in blue in the image below to preserve the aspect ration of the image dimentions shown in red. Where when I expand the zoom-in window, it only grows or shrinks with the aspect ratio of the image.
How can I do that?

답변 (1개)

Ameer Hamza
Ameer Hamza 2020년 6월 18일
You can use daspect() to keep the aspect ratio of the image constant when zooming on a particular region. Also see my answer here: https://www.mathworks.com/matlabcentral/answers/550149-allow-zooming-to-resize-the-axes-and-maintain-axis-equal
  댓글 수: 1
Omar Alamoudi
Omar Alamoudi 2020년 6월 18일
Thank you Ameer for your fast reply.
The aspect ratio of the image is working as I want it to, but my concern is about the region within blue box in the image I attached. The blue box appears after pressing the left buttom of the mouse when choosing the axtoolbar zoomin icon.
What happens now is that the blue box shown above of the image above is a zoomed in version of the image with the correct aspect ratio cropped, but the dimensions of the entire image adjusts to the dimensions of the blue box. What I want is the correct aspect ration, but a zoomed in area that has dimentions identical to original axis.
I hope this helps in clarifying the question.

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

카테고리

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

제품


릴리스

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by