Skip to content

<Watershed not using local minima as markers by default, contradicting documentation.> #7117

@samyblusseau

Description

@samyblusseau

Description:

When running the watershed function without markers (markers = None), the function does not use local minima as markers contrary to what the documentation says.

The result with markers = None is clearly different than with markers = local_minima, while it is supposed to be the same.

With markers=None, the number of returned regions is way larger than the number of local minima, at least on several examples.

Way to reproduce:

import skimage
from skimage.data import camera
from skimage.morphology import local_minima, label
from skimage.segmentation import watershed

print('\nSkimage version:', skimage.__version__,'\n')

im = camera()
locMin = label(local_minima(im)) # local minima

# Markers = None, supposedly local minima taken as markers
imWs1 = watershed(im, watershed_line = True)
print('Watershed with markers=None (supposedly local minima used as markers):')
print('There are '+str(imWs1.max())+ ' basins, and '+str(locMin.max())+' local minima.\n')


# Markers explicitely chosen as local minima
imWs2 = watershed(im, markers = locMin, watershed_line = True)
print('Watershed with local minima as markers:')
print('There are '+str(imWs2.max())+ ' basins, and '+str(locMin.max())+' local minima.')

Version information:

3.9.16 (main, May 15 2023, 23:46:34) 
[GCC 11.2.0]
Linux-5.4.0-150-generic-x86_64-with-glibc2.27
scikit-image version: 0.21.0
numpy version: 1.24.3

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions