Find 2D peak prominence using Python

5k views Asked by At

I found this scipy function scipy.signal.peak_prominences that finds the topographic prominence of specified local maxima in a 1d sequence.

But my application requires locating important peaks in a 2D array. I'm aware of some peak finding methods, such as doing a maximum filtering, which both scipy and skimage have their implementations. Also skimage's h_maxima() allows filtering local peaks that have a minimal relative height. But these only give the coordinates of the peaks, not their prominence .

So how do I compute peak prominence on a 2d array? Any help would be appreciated.

1

There are 1 answers

0
Jason On

I've cooked a python module using enclosing contour method, following wiki's definition:

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.

optionally one can filter out local peaks that have small cross section area or low prominence values.

I've put the code here: https://github.com/Xunius/python_peak_promience2d, if anyone finds any issue or possible improvement please fire an issue or PR.

A demo graph: enter image description here