필터 지우기
필터 지우기

Poor imshow image quality

조회 수: 5 (최근 30일)
Conrado Neto
Conrado Neto 2020년 9월 15일
답변: DGM 2024년 6월 3일
Hi I am trying to get a figure into a plot using imshow nd the results I get are really poor quality
this is the original figure:
this is what I get:
Increasing the size of the figure, does make the quality slightly better but it is still not any close to the original
the code I ued is:
imshow('Truss.png','border','tight','InitialMagnification',200)
I used border tight, and initial magnification but they dont seem to change anything all, with respect the size and quality
any help is appreciated
thanks
  댓글 수: 2
Ameer Hamza
Ameer Hamza 2020년 9월 15일
The image is drawn over a TiledChartLayout object. This is not the default behavior. There must be some other lines of code before imshow() lines, which are modifying the figure window.
Madhav Thakker
Madhav Thakker 2020년 9월 23일
Hi, can you provide the code before imshow() to get a better idea of what's going on?

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

답변 (1개)

DGM
DGM 2024년 6월 3일
The image is being drawn into a TiledLayout with the default wide padding and tile spacing. A ton of space is being wasted.
While imshow() normally wastes a ton of space by using the its default loose axes placement, that option is overridden by the placement within the tiledlayout.
The image looks terrible because it's a high-contrast image that's necessarily being downsampled for display in a tiny portion of a particularly-sized window. By default, imshow() uses nearest-neighbor interpolation when scaling images to fit, but this can be changed to bilinear with the 'interpolation' option. The result will still be undersized and slightly blurry, but you can't make an image smaller without losing information.
Your options:
  • Use a larger figure window
  • Don't try to cram so many axes in one figure that you run out of room (do you need more than one?)
  • Be smart about how you arrange your axes (tiling wide images horizontally seems like the worst option)
  • Be smart about how your figure geometry suits the combined effects of the tiling and image aspect ratios
  • Use the available padding/spacing options to make a tighter tiledlayout()
  • Consider using different display interpolation if necessary

Community Treasure Hunt

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

Start Hunting!

Translated by