My Colored image gets read as a bw image

1 Ansicht (letzte 30 Tage)
Altina Rexha
Altina Rexha am 26 Sep. 2020
Kommentiert: Ameer Hamza am 26 Sep. 2020
pic=imread('C:\Users\Acer\Desktop\p.png');
imshow(pic) (this is how the image in my desktop looks)
(this how the matlab reads it)

Akzeptierte Antwort

Ameer Hamza
Ameer Hamza am 26 Sep. 2020
Bearbeitet: Ameer Hamza am 26 Sep. 2020
MATLAB is loading it as an indexed image: https://www.mathworks.com/help/images/image-types-in-the-toolbox.html#f14-17587. The following show how to display it properly
[im, cm] = imread('image.png', 'png');
imshow(im, 'Colormap', cm)
If you also want an rgb image
[im, cm] = imread('image.png', 'png');
im_rgb = ind2rgb(im, cm);
imshow(im_rgb)
  2 Kommentare
Altina Rexha
Altina Rexha am 26 Sep. 2020
thank you sm it works
Ameer Hamza
Ameer Hamza am 26 Sep. 2020
I am glad to be of help!

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Image Processing Toolbox finden Sie in Help Center und File Exchange

Produkte


Version

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by