How do I get the same image as generated by imagesc using ind2rgb

3 ビュー (過去 30 日間)
Michael Devereux
Michael Devereux 2018 年 4 月 24 日
コメント済み: Michael Devereux 2018 年 4 月 24 日
I am trying to convert a grayscale image with a colormap to an rgb image using ind2rgb but it loses most of the detail displayed by imagesc using the same colormap and input image.
An example is shown below
map=jet;
A=rand(500,500);
figure,imagesc(A), colormap(map)
A=uint8(256*A);
figure,imagesc(A), colormap jet
B=ind2rgb(A,map);
figure,imshow(B)
In the example above I want B to be the same as the image displayed by imagesc.
Many thanks in advance!

採用された回答

Ahmet Cecen
Ahmet Cecen 2018 年 4 月 24 日
Try:
map=jet(256);

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeColormaps についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by