title: How to map false color image to specific labels assigned for each color
body: <p>I have a false color image which is shown below. I want to convert this image into an array where I can assign a label for each false color area. Thus I can access the image just using that label value.
  I tried using </p>
  
  <pre><code> r_channel = image[:, :, 0]
      g_channel = image[:, :, 1]
      b_channel = image[:, :, 2]
      label_map = (0.2989) * (r_channel) + (0.5870) * g_channel + (0.1140) * b_channel
      label_map = label_map * 500 / 255
      label_map = np.round(label_map).astype(int)
  </code></pre>
  
  <p>But the problem is that I get repeated labels in this case. I want each region to have a unique label, preferably in an ascending order starting from 1.</p>
  
  <p><img src="https://i.stack.imgur.com/g1FO5.png" alt="enter image description here"></p>