Dear all,

`I have been playing around with the watershed segmentation by markers`

`with the code proposed as example:`

http://scikit-image.org/docs/dev/auto_examples/segmentation/plot_watershed.html

`Unfortunately, if we use for example floating values for the radii of`

`the circles (like r1, r2 = 20.7, 24.7), the separation is not perfect,`

`as it gives 4 labels.`

`If we use the chamfer distance transform instead of the Euclidean`

`distance transform, it is even worse.`

`It appears that the markers detection by regional maximum`

`(peak_local_max) fails in the presence of plateaus. Its algorithm is`

`basically D(I)==I, where D is the morphological dilation.`

`A better algorithm would be to use morphological reconstruction (see`

`SOILLE, Pierre. /Morphological image analysis: principles and`

`applications/. Springer Science & Business Media, 2003, p202, Eq 6.13).`

`A proposition of the code can be the following (it should deal with`

`float values):`

import numpy as np from skimage import morphology def rmax(I): """ This avoids plateaus problems of peak_local_max I: original image, float values returns: binary array, with True for the maxima """ I = I.astype('float'); I = I / np.max(I) * 2**31; I = I.astype('int32'); rec = morphology.reconstruction(I-1, I); maxima = I - rec; return maxima>0

`This code is relatively fast. Notice that the matlab function`

`imregionalmax seem to work the same way (the help is not explicit, but`

`the results on a few tests seem to be similar).`

`I am afraid I do not have time to integrate it on gitlab, but this`

`should be a good start if someone wants to work on it. If you see any`

`problem with this code, please correct it.`

thank you best regards -- Yann

_______________________________________________ scikit-image mailing list scikit-image@python.org https://mail.python.org/mailman/listinfo/scikit-image