MATLAB Answers

0

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

Asked by Michael Devereux on 24 Apr 2018
Latest activity Commented on by Michael Devereux on 24 Apr 2018
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!

  0 Comments

Sign in to comment.

1 Answer

Answer by Ahmet Cecen on 24 Apr 2018
 Accepted Answer

Try:
map=jet(256);