Why am I not able to read some images and why do some images get stretched or blurred on reading using 'imread' function?

8 visualizaciones (últimos 30 días)
When I am trying to read images using the 'imread' function, some files can be read and others cannot. I am not sure why that happens.
Also, some images get stretched on reading and others do not. I also see some blurring occur sometimes on reading the images.
How do I resolve these two issues?

Respuesta aceptada

MathWorks Support Team
MathWorks Support Team el 9 de En. de 2023
Editada: MathWorks Support Team el 27 de En. de 2023

Reading Files With 'imread'

The 'imread' function in MATLAB supports a variety of different image file formats as inputs, including but not limited to: '.bmp', '.jpeg', '.png', and '.tiff'. If an image file is not able to be read, please double-check that it is in a file format supported by 'imread', as well as the file is not corrupted or otherwise invalid. For a full list of supported file types, please see the 'imread' documentation:
https://www.mathworks.com/help/matlab/ref/imread.html

Images Appearing Blurry or Stretched

An image may appear stretched or blurry when displayed for a variety of reasons.
  • Double-check the resolution and quality of the image file itself, as it may simply be low quality or low resolution on its own.
  • If you are using 'imshow' to display an image, please double-check that the 'InitialMagnification' field is set to a value you are expecting. Additionally, saving an image in '.jpeg' format may contribute to some form of Lossy Compression, which will permanently delete image data for the sake of reducing file size. For more information about 'imshow', please see the following documentation page:
  • If you are using 'imtool' to display the image file, check if MATLAB is currently in software OpenGL mode. This can be checked by typing the following command into the Command Window: 
    >> opengl info
    If this outputs something along the lines of:
    Version: '1.1.0'
    Vendor: 'Microsoft Corporation'
    Renderer: 'GDI Generic'
    MaxTextureSize: 1024
    Visual: 'Visual 0x140, (RGB 24 bits (8 8 8), Z depth ...'
    Software: 'true'
    SupportsGraphicsSmoothing: 0
    SupportsDepthPeelTransparency: 0
    SupportsAlignVertexCenters: 0
    Extensions: {3x1 cell}
    MaxFrameBufferSize: 0
    then images with a dimension larger than the specified "MaxTextureSize" parameter will appear blurry. To temporarily test if this is the cause, try the following command: 
>> opengl hardware
and try displaying the image again to see if the display quality improves.
The above is not an exhaustive list, and if you encounter an issue with a displayed image in MATLAB appearing stretched or blurry, and your case is not one of the above scenarios, please contact MATLAB Support.
​​​​​​
  11 comentarios
Walter Roberson
Walter Roberson el 7 de En. de 2023
Years ago on a Cisco newsgroup, two people asked nearly identical questions that would seemingly have identical answers, but I gave them quite different answers and I was right, having diagnosed them as dealing with different situations even though their opening paragraphs could have been pretty much copy-and-pasted. What I had noticed was that their error messages had one space at a point for one of them, but two spaces for the other person. And that pointed to two different causes. So differences in how people ask their questions can be important.
DGM
DGM el 8 de En. de 2023
I kind of see it as the purpose of the title to be the broad net, but I admit that's a challenge. Even if there are many ways a question can be posed based on the user's interpretation of the problem, there's no reason a prototype question can't incorporate multiple perspectives/observations. Even if there's a reluctance to edit the natural question, the answer itself can contain enough information to bridge the gap between the question and the solution it poses. Details can be important, but there aren't many of those left here.
Maybe I'm assuming that there was (or should be more) human interaction behind these answers. I suppose it's understandable that there isn't if much of the content is just programmatically exported here. That kind of explains the installation threads.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Graphics Performance en Help Center y File Exchange.

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by