Poor imshow image quality

5 visualizaciones (últimos 30 días)
Conrado Neto
Conrado Neto el 15 de Sept. de 2020
Respondida: DGM el 3 de Jun. de 2024
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 comentarios
Ameer Hamza
Ameer Hamza el 15 de Sept. de 2020
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 el 23 de Sept. de 2020
Hi, can you provide the code before imshow() to get a better idea of what's going on?

Iniciar sesión para comentar.

Respuestas (1)

DGM
DGM el 3 de Jun. de 2024
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