在阅读了这篇文章并玩了 SciKit-image 之后,我发现 Python 与 MATLAB 的函数相比有所不同imregionalmax
。
我有这些代码行:
from skimage.feature import peak_local_max
manos = np.ones([5,5])
manos[2,2] = 0.
manos[2,4] = 2.
giannis = peak_local_max(manos,min_distance=1, indices=False, exclude_border=False)
giorgos = ndimage.filters.maximum_filter(manos, footprint=np.ones([3,3]))
giorgos = (giorgos == manos)
我希望一个二维数组只有一个True
变量值 ([2,4])giannis
或giorgos
我在 MATLAB 中得到的值。相反,我最多取一个以上。
知道为什么会这样工作以及如何使它像在 MATLAB 中一样工作吗?