how to use imshow for this array?

8 ビュー (過去 30 日間)
audley james
audley james 2018 年 10 月 25 日
編集済み: jonas 2018 年 10 月 25 日
hello, I have attach my image. I want to use imshow. However, it shows as white and nothing appears when I use imshow. I want to see a coloured image. This array is the output of a pixel-based classification. Please advise.
EDIT: I added output example pic that I am looking to get. It will not be the same exact pic but should have the same color scheme and look similar.
thanks Aud

採用された回答

jonas
jonas 2018 年 10 月 25 日
編集済み: jonas 2018 年 10 月 25 日
It's not imshow but you could use imagesc instead
imagesc(out_map)
If you really want to use imshow, then
B = mat2gray(out_map)
imshow(B)
in which case you have to apply a colormap, because your matrix is not an RGB image.
  7 件のコメント
Adam
Adam 2018 年 10 月 25 日
You can also create your own colourmap with defined colours or just random as
cmap = rand( 10, 3 )
if you have 10 classes and provided the caxis scaling is appropriate to map 1 per class.
Obviously if choosing your own 10 colours you would just put them into a 10 by 3 array like the one randomly created, e.g.
cmap = [1 0 0; 0 1 0; 0 0 1; 1 0 1;...];
where you put all your colours in instead of the ... of course.
jonas
jonas 2018 年 10 月 25 日
編集済み: jonas 2018 年 10 月 25 日
I agree with guilliame that 'jet' is a poor colormap for visualizing intensity and completely useless if you print in grayscale. If the purpose is to show a number of distinct regions in different colors, then it is quite OK because it covers a wide range of colors (still useless in grayscale though).
Just set the number of segments to the number of unique values and pick another colormap. Personally I like the magma and inferno colormaps but they are not part of the default ones.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by