title: Convert RGB image into index (label) array
body: <p>I have image which has many duplicated pixel.
  So, I'd like to create label image.</p>
  
  <p>For example, I'll use elements of arr_u_rs array as label values  </p>
  
  <pre><code># Load origianl image
  im = Image.open(img_path)
  arr = np.array(im)
  
  # -------------------------
  arr=arr.reshape(-1,3)
  # Shape is (921600, 3)
  
  # Remove duplicated pixels
  arr_u_rs = np.unique(arr, axis=0)
  # Shape is (65566, 3)
  </code></pre>
  
  <p>I'd like to create 65566 labels<br>
  and would like to assign each label into original image  </p>
  
  <p>For example,</p>
  
  <pre><code>Assign 0 (label) into [0,1,2] pixel
  Assign 1 (label) into [3,4,5] pixel
  Assign 3 (label) into [12,13,14] pixel from
  [[[ 0,  1,  2],
    [ 3,  4,  5],
    [ 0,  1,  2],
    [ 0,  1,  2]],
   [[12, 13, 14],
    [ 0,  1,  2],
    [ 3,  4,  5],
    [ 3,  4,  5]]]
  </code></pre>