title: How to find superpixels' centroid using masked region?
body: <p>Newbie here! I'm working with python plus opencv and skimage packages. I've segmented an image in superpixels using:</p>
  
  <pre><code>segments = slic(image, n_segments=numSegments, sigma=1, convert2lab=True)
  </code></pre>
  
  <p>I can access every superpixel with:</p>
  
  <pre><code>#FOR-LOOP-1
  for v in np.unique(segments):
      #create a mask to access one region at the time
      mask = np.ones(image.shape[:2])
      mask[segments == v] = 0
  
      #my function to calculate mean of A channel in LAB color space
      A = mean_achannel(img, mask) 
  </code></pre>
  
  <p>Now I'd like to get the coordinates associated with each superpixel's centroid, how can I do that?
  I tried using:</p>
  
  <pre><code>from skimage.measure import regionprops
  
  #FOR-LOOP-2
  regions = regionprops(segments)
  for props in regions:
      cx, cy = props.centroid  # centroid coordinates
  </code></pre>
  
  <p>But I can't understand how to link each region in the "FOR-LOOP-2" with the right one in the "FOR-LOOP-1". How can I calculate each region centroid inside "FOR-LOOP-1"?</p>