Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7218823
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T21:32:05+00:00 2026-05-28T21:32:05+00:00

I am using the connected component labeling algorithm in Matlab. Is it possible to

  • 0

I am using the connected component labeling algorithm in Matlab. Is it possible to use different color for different labels when showing the output? (Even though the labels have the same intensity).

Clarification:
I used connected component labeling algorithm to label the connected components of a binary images. Now I got different labels. All the labels contains pixel of equal intensity. (All the labels have pixel intensity value of 1) and all the labels appear in the same color. I want to display the different labels using different colors so that I can eliminate the unwanted one easier.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T21:32:06+00:00Added an answer on May 28, 2026 at 9:32 pm

    That is easy – use the imagesc function:

    p = imread('peppers.png'); %Read image
    b = (p(:,:,2)>100); % Thresholding by some constant threshold
    

    If you already have a binary image, just use this section of the code: (b is the image)

    L = bwlabel(b); %Find components
    figure();   %Create figure
    imagesc(L);  %Draw the components, each in its own color.
    

    enter image description here

    You can also change the colors by using the colormap command:

     colormap(bone)
    

    enter image description here

    In order to customize the colors, define an nx3 matrix, and give it as input to colormap

    cm = [1 0 0; 
          0 1 0; 
          0 0 1
          0 1 1 
          1 1 0
        ];
    colormap(cm)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

How can maintain a SqlConnection (or using another component) open (connected) always during the
I have two different-sized monitors, connected together using (I believe) TwinView. I tried System.out.println(Toolkit.getDefaultToolkit().getScreenSize());
UML component diagrams are good at showing technical client-server-like inteface relationships between components, using
I am trying to connect to excel table from Delphi 7 using TAdoConnection component.
I'm running a django instance behind nginx connected using fcgi (by using the manage.py
I have a system which contains multiple applications connected together using JMS and Spring
I've connected to a MySQL database using Perl DBI. I would like to find
I have connected to a server via SFTP using FileZilla and accepted adding the
I've connected to database, using data set .xsr now I wan't to extract all
I'm using Emacs with clojure mode and slime connected to a swank server produced

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.