Matlab imshow() not showing the image properly

27 visualizzazioni (ultimi 30 giorni)
32sthide il 4 Dic 2012
Commentato: Walter Roberson il 13 Feb 2019
I have a simple code to show an image in Matlab. I use imread() to read it and imshow() to show it. the code it below, and the result in not shown properly. hope someone can help me.
img = imread('/home/samuelpedro/Desktop/API - Projecto/coimbra_aerea.jpg');
figure, imshow(img);
the resulting image is below.
the actual image is below
also, if i choose to save it to file as a new jpg it is saved correctly.
weirdly if i choose to show the axes in the preferences>image processing, it is corrected*
  11 Commenti
Walter Roberson
Walter Roberson il 13 Feb 2019
There was an image processing preference as to whether the axes Visible property will be set or not. See iptsetprefs()

Accedi per commentare.

Risposte (3)

Image Analyst
Image Analyst il 4 Dic 2012
It kind of looks like it's an interlaced file, like a PNG file that's interlaced, but the interlacing is not recognized. Any chance you could post the image so others could try it?
  5 Commenti
32sthide il 5 Dic 2012
weirdly if i choose to show the axes in the preferences>image processing, it is corrected

Accedi per commentare.

VENKATESAN il 4 Dic 2012
Your path length looks very big. Don't use hyphen (-) symbol in your folders, instead u can use underscore. Try this.. Because there is a hyphen in your folder API-Projecto. But, it is better if you read the file from the work folder and the imshow will be perfect.
Try this
img = imread('/home/samuelpedro/Desktop/API_Projecto/coimbra_aerea.jpg'); figure, imshow(img);
or the other one
img=imread('coimbra_aerea.jpg'); figure, imshow(img); imwrite(img, 'coimbra_aerea.jpg', 'jpg');
  2 Commenti
Sean de Wolski
Sean de Wolski il 4 Dic 2012
This won't matter. I would guess it is some graphics driver isolated specifically to your machine.

Accedi per commentare.

UJJWAL il 4 Dic 2012
I would really request you to post the image file so that others could also try it.
  1 Commento
32sthide il 4 Dic 2012
it's not a problem from the image. all my imshow no matter the files is the same.

Accedi per commentare.


Scopri di più su Environment and Settings in Help Center e File Exchange



Community Treasure Hunt

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

Start Hunting!

Translated by