gpt4 book ai didi

python - 使用 Python 查找 2D 峰值突出度

转载 作者:行者123 更新时间:2023-12-01 01:27:10 24 4
gpt4 key购买 nike

我找到了这个 scipy 函数 scipy.signal.peak_prominences找到 topographic prominence一维序列中指定的局部最大值。

但是我的应用程序需要在二维数组中定位重要的峰值。我知道一些峰值查找方法,例如进行最大过滤,scipy 和 skimage 都有其实现。此外,skimage 的 h_maxima() 允许过滤具有最小相对高度的局部峰值。但这些仅给出了峰的坐标,而不是它们的突出度。

那么如何计算二维数组上的峰值突出度?任何帮助将不胜感激。

最佳答案

我按照 wiki 的定义,使用封闭轮廓方法编写了一个 python 模块:

The prominence of a peak is the height of the peak’s summit above the lowest contour line encircling it but containing no higher summit within it.

可以选择过滤掉横截面积较小或突出值较低的局部峰。

我已将代码放在这里:https://github.com/Xunius/python_peak_promience2d ,如果有人发现任何问题或可能的改进,请提出问题或 PR。

演示图: enter image description here

关于python - 使用 Python 查找 2D 峰值突出度,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53236058/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com