a = imread('cameraman.tif') ;
image(a)
The commands are producing the image in a colormap, not in gray tone (original color). I do not want the colormap?
How to fix this without using imshow?
Thanks in advance!

 採用された回答

Tommy
Tommy 2020 年 6 月 3 日

1 投票

When you supply a 2D array to image(), the values within that array are mapped to a colormap. The colormap is needed to convert scalar values to RGB triplets. imread() returns a 2D array for grayscale images, but you can supply the corresponding 3D array (where R=G=B) to image() if you want:
image(repmat(a,1,1,3))

その他の回答 (0 件)

カテゴリ

質問済み:

2020 年 6 月 3 日

編集済み:

2020 年 6 月 3 日

Community Treasure Hunt

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

Start Hunting!

Translated by