问题描述
我需要找到图像的区域最大值,以获得用于分水岭分割的前景标记.我在matlab中看到使用功能 imregionalmax()
.由于我没有Matlab软件,因此我使用了 scipy.ndimage.filters.maximum_filter()
代替.但是,来自imregionalmax()
和scipy.ndimage.filters.maximum_filter()
的结果是不同的.
I need to find the regional maxima of an image to obtain foreground markers for watershed segmentation. I see in matlab use the function imregionalmax()
. As I don't have the matlab software, I use the function scipy.ndimage.filters.maximum_filter()
instead. However, the results from imregionalmax()
and scipy.ndimage.filters.maximum_filter()
are different.
请帮助我如何找出图像的区域最大值.非常感谢您的帮助.
Please help me how to find out the regional maxima of an image. Thanks very much for your help.
推荐答案
似乎scipy的maximum_filter
返回实际的局部最大值,而Matlab的imregionalmax
返回具有位置的蒙版局部最大值的
我希望
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
应该给您与Matlab相似的结果.
should give you similar results to Matlab's.
这篇关于matlab的imregionalmax()和scipy.ndimage.filters.maximum_filter有什么区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!