Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Matlab imshow() not showing the image properly

Tags:

matlab

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. enter image description here

also, if i choose to save it to file as a new jpg it is saved correctly.

UPDATE 1:

weirdly if i choose to show the axes in the preferences>image processing, it is corrected

like image 377
SamuelNLP Avatar asked Feb 04 '26 22:02

SamuelNLP


1 Answers

Locking at your screen-shot, the x- and y-ticks are missing. They should appear in a standard-configuration of Matlab. Maybe something is just messed up in the Matlab-configuration. Try to do this with a clean new ~/.matlab folder (rename the old one before).

Alternatively ... again judging by your screen-shot, this looks like Ubuntu/Unity in the background. Unity needs acceleration (OpenGL), which can be randomly buggy for some Linux graphics drivers. You may want to try to launch matlab in a "clean" X-server (maybe the twm environment) to rule this out.

Save the image as an (uncompressed) bitmap (bmp) and read it with imread. If the jpg is messed up by the imread-routine, this should rule this out.

Last but not least, broken copy of your jpg on your disk, some flipped bits. Run md5sums on your file's copies.

like image 88
s-m-e Avatar answered Feb 06 '26 11:02

s-m-e



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!