show an image in the center of the axes

조회 수: 5 (최근 30일)
Silvia
Silvia 2013년 7월 5일
Hello,
I have a fixed axes in a GUI (position: [517 125 283 459]). I'm showing an image in this axes:
axes(handles.imagenanatomica) imshow(imagen,[]) or imshow(imagen,'parent',handles.imagenanatomica).
The 'imshow' function shows the image smaller than the axes'size so as to not deform the image. Here I have two questions:
1) The image is not in the center of the axes, it appears at the top-left of the axes.¿Is it possible to center the image in the axes?
2) Is it posiible to show the image bigger?. I mean, not as the size of the axes but a bit bigger than it appears.
Thank you very much.
Silvia

답변 (1개)

Image Analyst
Image Analyst 2013년 7월 5일
1) imshow() automatically tries to fit the image into the existing space allocated from the axes. It will scale it down, maintaining the aspect ratio if it has to, in order to get it to fit.
2) You can use the InitialMagnification option of imshow to override the fitting functionality. For example 'InitialMagnification', 800 will make each pixel 8 pixels. I believe this will give scroll bars or a hand cursor so you can pan/scroll the image.
  댓글 수: 2
Silvia
Silvia 2013년 7월 5일
1)Yes, my image is scaled maintaining the aspect ratio so it appears smaller than the size of the axes. The problem is that it doesn't appear centered in the axes.
2)I tried with 'InitialMagnification' but the image doesn't change. It doen't matter if I write 25 or 800 the image is the same
Image Analyst
Image Analyst 2013년 7월 5일
A screenshot (alt-Printscreen) posted to http://snag.gy would help

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

Community Treasure Hunt

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

Start Hunting!

Translated by