Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

New to MATLAB?

imshow - Stretching image to fill axis

Asked by Matt

Matt (view profile)

on 13 Jan 2013

I'm trying to display an image on an axis within a GUI. I'm using the imshow function, but it keeps the dimension ratio of the image. I would like to stretch the image, ignoring the dimension ratio, to fill the axis. Any suggestions?

Thanks, Matt

0 Comments

Matt

Matt (view profile)

2 Answers

Answer by Image Analyst

Image Analyst (view profile)

on 13 Jan 2013
Edited by Image Analyst

Image Analyst (view profile)

on 14 Jan 2013
Accepted answer

You can display with imshow() and use the 'XData' and 'YData' property. For example:

imshow(grayImage, [], 'XData', [0 .5], 'YData', [0 .1]);

2 Comments

Walter Roberson

Walter Roberson (view profile)

on 14 Jan 2013

You can pass in coordinates to image() and imagesc()

Matt

Matt (view profile)

on 14 Jan 2013

Xdata and Ydata worked great, thanks!

Image Analyst

Image Analyst (view profile)

Answer by Jurgen

Jurgen (view profile)

on 13 Jan 2013

Have you tried image or imagesc? Or the 'axis image' command?

0 Comments

Jurgen

Jurgen (view profile)

Contact us