user30985 - 2 months ago 35

Python Question

I need to find the regional maxima of an image to obtain foreground markers for watershed segmentation. I see in matlab use the function

. As I don't have the matlab software, I use the function`scipy.ndimage.filters.maximum_filter()`

`imregionalmax()`

`scipy.ndimage.filters.maximum_filter()`

Please help me how to find out the regional maxima of an image. Thanks very much for your help.

Answer

It appears as if scipy's `maximum_filter`

returns the actual local max values, while Matlab's `imregionalmax`

returns a mask with the *locations* of the local maxima.

I would expect

```
lm = scipy.ndimage.filters.maximum_filter( img, ... )
msk = (img == lm) #// convert local max values to binary mask
```

should give you similar results to Matlab's.

Source (Stackoverflow)

Comments