Display Issues with Matlab Images in GUI

조회 수: 14 (최근 30일)
Eric Cote
Eric Cote 2016년 12월 22일
답변: David Barry 2016년 12월 23일
I have a MATLAB GUI where I have displayed an image on a set of axes, and it looks fine.
However, when the GUI is opened on some other computer with (presumably) different resolution settings, the image is stretched and becomes pixelated. I have tried setting up the axis size based on both pixel units and characters, neither of which preserve the smooth original appearance of the image across all computers.
Does anyone have a solution for this?
It seems crazy to me that there doesn't appear to be an easy way to have a simple image, with known pixel height and width, appear properly in a Matlab GUI regardless of monitor and resolution configuration.
Thanks in advance!
  댓글 수: 4
David Barry
David Barry 2016년 12월 23일
Have you set the axes limits correctly? You could maybe try this instead of using image as it should sort out limits for you.
load('logo.mat');
imshow(thelogo, 'Parent', handles.axes1, 'Colormap', thecmap);
Can you upload a screenshot to demonstrate the issue?
Eric Cote
Eric Cote 2016년 12월 23일
See below. Again, the axes here are specified in pixels. Clearly the resolutions are different on each computer, you can tell from size of the image and font. But if this same image is opened up on the computer having a pixelated view of the image (i.e. using Paint or another way to view the image), it is rendered fine by Windows. Just gets skewed/stretched by Matlab and GUIDE.
I can try what you posted shortly.

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

답변 (2개)

David Barry
David Barry 2016년 12월 23일
If you are running Windows (unlucky) then make sure your zoom settings are set to 100%. For some reason 125% seems to be the default on some OS. This has tripped me up at work where colleagues are on 125 and I'm designing GUI's on 100. This seemed to have an effect in later releases of MATLAB (maybe post 14b and HG2).

Image Analyst
Image Analyst 2016년 12월 23일
I often have trouble with the GUI not looking like mine when I compile and deploy it. It's caused by different video adapters and different resolutions. Try making the units property of all your controls 'normalized'. It helps but does not fix everything. Then try experimenting with different axis options like "axis image" or "axis equal" etc. Even that may not fix everything, especially controls with text on them. I still don't have a 100% solution for me, or for you. Maybe you can try App Designer - I haven't tried it yet.
  댓글 수: 1
Eric Cote
Eric Cote 2016년 12월 23일
편집: Eric Cote 2016년 12월 23일
Thanks for the suggestion. Normalized from what I understand, actually seems to cause more issues than it fixes.
You bring up another good point though. It blows my mind (even moreso) that the compiled GUI can experience these issues. I've noticed that as well. At this point I've been focusing on the GUI without compilation, but have also experienced what you state.
I came across another answer that suggested resizing everything using pixels at runtime, based on the size of a person's monitor. I selected to follow the topic but now I can't see a spot to view topics I've chosen to follow. I'm new to the answers forum and feel like a complete newbie for not being able to find it. ;)

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

제품

Community Treasure Hunt

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

Start Hunting!

Translated by