How to resize and display an image......

Hi All,
So when i do imagesc(img); it shows an image as follows:
However i want it to be displayed like this :
[EDITED, Jan, above picture is too wide to be embedded]
The difference is that the latter has been resized using the image resizing handles (from the corners of the image). Just to emphasise, i mean these handles :
^^but when applied to a figure in MATLAB.
I know i can do this manually but i want to incorporate this in my .m file and hence want to keep it automated.
Many thanks!!

 Respuesta aceptada

Image Analyst
Image Analyst el 20 de Jun. de 2012

0 votos

Define manual and automated. If you have handles for the user to manually drag, then that does not seem automated to me.

9 comentarios

HASNAIN
HASNAIN el 20 de Jun. de 2012
Manual is when i manually resize the image from the first image to the second (as shown in the two images above).
Automatically is when MATLAB does it for me automatically. Thanks!
Image Analyst
Image Analyst el 20 de Jun. de 2012
If you know the desired output size in advance, then you can use imresize(). I guess that's automatic, though you do have to "manually" determine what the target size is.
HASNAIN
HASNAIN el 20 de Jun. de 2012
I see. Could you kindly point me in the right direction to find out how to determine what the right target size is please?
Image Analyst
Image Analyst el 20 de Jun. de 2012
How could I possibly know what size you want your image to be? Why don't you tell me why you want to resize it in the first place?
HASNAIN
HASNAIN el 20 de Jun. de 2012
Because the plot that iam displaying is basically too stretched when i type in plot(x,y); For me to interpret the graph correctly, i have to resize it so the points look more or less like what i want. Thanks.
Image Analyst
Image Analyst el 20 de Jun. de 2012
Only you will know what is "too stretched" and "looks like what you want". Keep in mind that there may be a difference between how it appears on different video monitors.
Walter Roberson
Walter Roberson el 20 de Jun. de 2012
Have you tried
axis equal
?
HASNAIN
HASNAIN el 20 de Jun. de 2012
@ IM, fair enough.
@Walter Roberson, i dont want to change the axis, resize the graph rather.
Walter Roberson
Walter Roberson el 20 de Jun. de 2012
axis equal will resize the graph so that it does not looked stretched.
Anyhow, consider set()'ing the axes Position property, perhaps using 'Units', 'normalized'

Iniciar sesión para comentar.

Más respuestas (1)

Preguntada:

el 19 de Jun. de 2012

Community Treasure Hunt

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

Start Hunting!

Translated by