How to show an image of labels in colors and show the colorbar

4 ビュー (過去 30 日間)
Itamar Malageac
Itamar Malageac 2022 年 3 月 17 日
コメント済み: Image Analyst 2022 年 3 月 17 日
Hello
i have an 512X512 image of values from 1 to 10.
I want to use the imshow + label2rgb functions and show the image in colors but when i use the colorbar it doesnt show the right values in the colorbar.
The values that are shown are 0 to 1 and not 1 to 10 as it should.

採用された回答

Kevin Holly
Kevin Holly 2022 年 3 月 17 日
img = round(10*rand(512));
label2rgb(img);
imshow(img)
colorbar
colormap('jet')
caxis([1 10]) %You can change the range for the colorbar with this line
  2 件のコメント
Itamar Malageac
Itamar Malageac 2022 年 3 月 17 日
What a simple and great answer.
Thank you alot!
Image Analyst
Image Analyst 2022 年 3 月 17 日
Yes, so please click the "Accept this Answer" link to award Kevin "reputation points" and let others know it's been solved.

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeImage Processing Toolbox についてさらに検索

製品


リリース

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by