title: Region growing with the watershed transform error
body: <p>Hello guys I am new to image processing, I've been trying out this code from adfoucart but I have been receiving this error</p>
  <p><a href="https://github.com/adfoucart/image-processing-notebooks/blob/main/V31%20-%20Region%20growing%20with%20the%20watershed%20transform.ipynb" rel="nofollow noreferrer">https://github.com/adfoucart/image-processing-notebooks/blob/main/V31%20-%20Region%20growing%20with%20the%20watershed%20transform.ipynb</a></p>
  <pre><code>image.shape
  (240, 320)
  
  from skimage.filters import rank,gaussian
  from skimage.morphology import disk
  from skimage.feature import peak_local_max
  
  def get_markers(image, indices=False):
      im_ = gaussian(image, sigma=4)
      gradr = rank.gradient(im_[:,:,0],disk(5)).astype('int')
      gradg = rank.gradient(im_[:,:,1],disk(5)).astype('int')
      gradb = rank.gradient(im_[:,:,2],disk(5)).astype('int')
      grad = gradr+gradg+gradb
      
      return peak_local_max(grad.max()-grad,threshold_rel=0.5, min_distance=60,indices=indices),grad
  
  markers,grad = get_markers(image, True)
  plt.figure()
  plt.imshow(grad, cmap=plt.cm.gray)
  plt.plot(markers[:,1],markers[:,0],'b+')
  plt.show()
  
  </code></pre>
  <pre><code>---------------------------------------------------------------------------
  IndexError                                Traceback (most recent call last)
  /var/folders/f9/5vh23mb50wj5wq4vfl8wcgx40000gn/T/ipykernel_34090/3084023926.py in &lt;module&gt;
       12     return peak_local_max(grad.max()-grad,threshold_rel=0.5, min_distance=60,indices=indices),grad
       13 
  ---&gt; 14 markers,grad = get_markers(image, True)
       15 plt.figure()
       16 plt.imshow(grad, cmap=plt.cm.gray)
  
  /var/folders/f9/5vh23mb50wj5wq4vfl8wcgx40000gn/T/ipykernel_34090/3084023926.py in get_markers(image, indices)
        5 def get_markers(image, indices=False):
        6     im_ = gaussian(image, sigma=4)
  ----&gt; 7     gradr = rank.gradient(im_[:,:,0],disk(5)).astype('int')
        8     gradg = rank.gradient(im_[:,:,1],disk(5)).astype('int')
        9     gradb = rank.gradient(im_[:,:,2],disk(5)).astype('int')
  
  IndexError: too many indices for array: array is 2-dimensional, but 3 were indexed
  </code></pre>
  <p>Any help will be appreciated thank you so much!</p>