MATLAB Answers

"imshow" distorts jpeg

조회 수: 21(최근 30일)
Matt
Matt 15 Jan 2013
편집: Walter Roberson 27 Apr 2017
I am using the following code to display an image on an axis in a Matlab GUI.
axes(handles.axis1);
imshow('my_image.jpg');
This is distorting my image. (There is text on the image which becomes difficult to read). However it seems that Matlab is trying to keep the dimension ratio, because stretching the axis in one direction does not change the output of imshow at all.
I have tried using XData and YData to manually resize the jpeg, with limited success. If I open the jpeg directly, it looks perfect, so it must be something Matlab is doing.
Does anyone have any suggestions? I don't really have a firm grasp on what Matlab is doing when I call the imshow function, so please point out of I'm completely off-base. Thanks.
-Matt
  댓글 수: 2
Matt
Matt 15 Jan 2013
Thanks for the reply. There is no warning.

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

채택된 답변

Image Analyst
Image Analyst 15 Jan 2013
It "shrinks to fit" the image into your axes. This means that it might subsample your image and lose some pixels, causing it to look bad. Try using a bigger axes, or maybe you can play around with the 'InitialMagnification' option for imshow(), or try using zoom().

추가 답변(2개)

Jurgen
Jurgen 15 Jan 2013
Are you displaying at the proper size? fine detail can be lost (aliasing) if your display size is too small, try maximizing it with e.g.:
figure;imshow('my_image.jpg')
  댓글 수: 2
Jurgen
Jurgen 15 Jan 2013
Yes obviously the new figure was because I thought your axis was too small. Just a test, guess it was right.

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


vcmorini
vcmorini 27 Apr 2017
This link might be usefull: Resolving Low-Level Graphics Issues

Community Treasure Hunt

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

Start Hunting!

Translated by