show an image in the center of the axes

3 visualizaciones (últimos 30 días)
Silvia
Silvia el 5 de Jul. de 2013
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

Respuestas (1)

Image Analyst
Image Analyst el 5 de Jul. de 2013
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 comentarios
Silvia
Silvia el 5 de Jul. de 2013
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 el 5 de Jul. de 2013
A screenshot (alt-Printscreen) posted to http://snag.gy would help

Iniciar sesión para comentar.

Community Treasure Hunt

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

Start Hunting!

Translated by