Matlab imshow() not showing the image properly

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.
*UPDATE 1:
weirdly if i choose to show the axes in the preferences>image processing, it is corrected*

11 件のコメント

Sean de Wolski
Sean de Wolski 2012 年 12 月 4 日
Does the cameradude show correcly?
imshow(imread('cameraman.tif'));
Does the cameradude with color show correctly?
imshow(repmat(imread('cameraman.tif'),[1 1 3]));
32sthide
32sthide 2012 年 12 月 4 日
no, both are showed tiled as well.
Sean de Wolski
Sean de Wolski 2012 年 12 月 4 日
What is the output from:
which -all imshow
?
32sthide
32sthide 2012 年 12 月 4 日
/usr/local/MATLAB/R2012a/toolbox/images/imuitools/imshow.m
32sthide
32sthide 2012 年 12 月 4 日
編集済み: 32sthide 2012 年 12 月 4 日
the cameramen is showed well in the beginning but when i maximize the window it gets tiled.
Sean de Wolski
Sean de Wolski 2012 年 12 月 4 日
Is it just images displayed with imshow or is it all images?
imagesc(imread('cameraman.tif'))
32sthide
32sthide 2012 年 12 月 4 日
編集済み: 32sthide 2012 年 12 月 4 日
just imshow, imagesc works fine
Sean de Wolski
Sean de Wolski 2012 年 12 月 4 日
I would recommend contacting support.
32sthide
32sthide 2012 年 12 月 5 日
@Sean weirdly if i choose to show the axes in the preferences>image processing, it is corrected
Lakshay Bhandari
Lakshay Bhandari 2019 年 2 月 13 日
what does "if i choose to show the axes in the preferences>image processing, it is corrected" mean ?
Walter Roberson
Walter Roberson 2019 年 2 月 13 日
There was an image processing preference as to whether the axes Visible property will be set or not. See iptsetprefs()

サインインしてコメントする。

回答 (3 件)

Image Analyst
Image Analyst 2012 年 12 月 4 日

0 投票

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 件のコメント

Sean de Wolski
Sean de Wolski 2012 年 12 月 4 日
@IA, he said the same thing happens with cameraman.
32sthide
32sthide 2012 年 12 月 4 日
it is the same with the camera man.
Image Analyst
Image Analyst 2012 年 12 月 4 日
OK - I wasn't sure if he meant that imagesc worked with his image but imshow didn't, or if that also applied to the cameraman image. It's certainly bizarre. I wonder if it would still be that way if he reinstalled. I'm pretty certain it wouldn't be that way on a different computer because no one else's has that problem. I'd also look at the "img" variable to see if maybe it was imread that created a corrupted image and imshow was correctly displaying it, or if img is fine and the problem lies with imshow. I'd also try zooming in and out to see if it was a repainting/refreshing/rendering issue or maybe some problem with the video adapter. If you zoom in and then out once and it looks fine, then imshow would be okay.
32sthide
32sthide 2012 年 12 月 4 日
i've reinstalled matlab once. it's the same. as you said, when I maximaze the window or xoom in / out the image is refreshing and the pattern changes.
32sthide
32sthide 2012 年 12 月 5 日
weirdly if i choose to show the axes in the preferences>image processing, it is corrected

サインインしてコメントする。

VENKATESAN
VENKATESAN 2012 年 12 月 4 日

0 投票

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 件のコメント

32sthide
32sthide 2012 年 12 月 4 日
i've tried even something like:
cd /home/samuelpedro/Desktop/APIProject/
close all
clear all
clc
img = imread('coimbra_aerea.jpg');
figure, imshow(img);
Sean de Wolski
Sean de Wolski 2012 年 12 月 4 日
This won't matter. I would guess it is some graphics driver isolated specifically to your machine.

サインインしてコメントする。

UJJWAL
UJJWAL 2012 年 12 月 4 日

0 投票

I would really request you to post the image file so that others could also try it.

1 件のコメント

32sthide
32sthide 2012 年 12 月 4 日
it's not a problem from the image. all my imshow no matter the files is the same.

サインインしてコメントする。

カテゴリ

ヘルプ センター および File ExchangeIntroduction to Installation and Licensing についてさらに検索

製品

タグ

質問済み:

2012 年 12 月 4 日

コメント済み:

2019 年 2 月 13 日

Community Treasure Hunt

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

Start Hunting!

Translated by