My Colored image gets read as a bw image

조회 수: 1 (최근 30일)
Altina Rexha
Altina Rexha 2020년 9월 26일
댓글: Ameer Hamza 2020년 9월 26일
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)

채택된 답변

Ameer Hamza
Ameer Hamza 2020년 9월 26일
편집: Ameer Hamza 2020년 9월 26일
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
Altina Rexha
Altina Rexha 2020년 9월 26일
thank you sm it works
Ameer Hamza
Ameer Hamza 2020년 9월 26일
I am glad to be of help!

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Image Processing Toolbox에 대해 자세히 알아보기

제품


릴리스

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by