Filter löschen
Filter löschen

Why does MATLAB read a picture and add noise on it?

1 Ansicht (letzte 30 Tage)
M B
M B am 25 Mär. 2015
Kommentiert: Titus Edelhofer am 27 Mär. 2015
Hi,
I typed in matlab the following command:
x=imread('pic.gif')
imshow(x);
I would expect that the output image look exactly like the one MATLAB read. However, it didn't happen. MATLAB gave an output that looked like the original one, but with a lot of noise... My question is why don't I get exactly the same image?
  4 Kommentare
Titus Edelhofer
Titus Edelhofer am 26 Mär. 2015
M B, I can't see the attachment either ...
M B
M B am 26 Mär. 2015
I attatched it now to the original message.

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

Titus Edelhofer
Titus Edelhofer am 26 Mär. 2015
Hi,
your image is an indexed image, not RGB. Therefore you need to read the colormap as well:
[a,b] = imread('pic.gif');
imshow(a);
colormap(b);
Titus

Weitere Antworten (1)

Jan
Jan am 26 Mär. 2015
Or:
[c, map] = imread('pic.gif');
img = ind2rgb(c, map);
imshow(img)
  4 Kommentare
Image Analyst
Image Analyst am 26 Mär. 2015
If you didn't supply a color map, and the image was uint8, then it just chose the gray scale colormap. But since the pixel value is really a row number into a colormap instead of an intensity value, the image most likely looked like a bunch of black/white/gray garbage/noise.
Titus Edelhofer
Titus Edelhofer am 27 Mär. 2015
It was not 100% noise, since the colormap of the image had some similarity to simple gray scale. That's why it did not look completely weird but just "with some noise".

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Images finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by