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!!

 채택된 답변

Image Analyst
Image Analyst 2012년 6월 20일

0 개 추천

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

댓글 수: 9

HASNAIN
HASNAIN 2012년 6월 20일
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 2012년 6월 20일
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 2012년 6월 20일
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 2012년 6월 20일
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 2012년 6월 20일
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 2012년 6월 20일
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 2012년 6월 20일
Have you tried
axis equal
?
HASNAIN
HASNAIN 2012년 6월 20일
@ IM, fair enough.
@Walter Roberson, i dont want to change the axis, resize the graph rather.
Walter Roberson
Walter Roberson 2012년 6월 20일
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'

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

추가 답변 (1개)

Rui Zhao
Rui Zhao 2012년 6월 20일

0 개 추천

doc imresize

Community Treasure Hunt

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

Start Hunting!

Translated by