How to assign different colors to different labels?

5 ビュー (過去 30 日間)
Sara Salimi
Sara Salimi 2017 年 11 月 25 日
コメント済み: Sara Salimi 2017 年 12 月 14 日
Hi,
I saw in one paper that they are showing their segmentation results of different objects with different colors and overlayed on the input image. As you can see in the following image.
Could I ask how we can assign different colors to different labels obtained from a segmentation algorithms with different objects? I would like to do the same on the segmentation results that I am obtaining from my algorithm. I have 0 as background and labels 1-to-4 as 4 different objects. Your help is really appreciated.
Thanks

採用された回答

Image Analyst
Image Analyst 2017 年 11 月 25 日
See this snippet:
% Label each blob with 8-connectivity, so we can make measurements of it
[labeledImage, numberOfBlobs] = bwlabel(binaryImage, 8);
% Apply a variety of pseudo-colors to the regions.
coloredLabelsImage = label2rgb (labeledImage, 'hsv', 'k', 'shuffle');
% Display the pseudo-colored image.
imshow(coloredLabelsImage);
  1 件のコメント
Sara Salimi
Sara Salimi 2017 年 12 月 14 日
Thank you very much Sir.

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeImage Segmentation and Analysis についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by