Algorithm to locate local maxima

后端 未结 9 1910
有刺的猬
有刺的猬 2020-12-24 03:24

I have data that always looks something like this:

alt text http://michaelfogleman.com/static/images/chart.png

I need an algorithm to locate the three peaks.

9条回答
  •  感情败类
    2020-12-24 03:59

    I practice, I've found what works well is to use a dilation morphology operation to produce a dilated version of your sampled function (data points) then to identify local max's compare the dilated version vs. the original and anywhere where the dilated version equals the original version should be a local maximum. This works really well I find with 2D+ data (i.e. images) but since you have 1D data it may be easier just to use the differences between successive points as an approximation to the derivative.

    Note if you do use the dilation technique, the structuring element (both the size and shape) that you use in the dilation greatly determines the types of peaks you are looking for.

    Also if you have noise in your data, smooth it with a low pass filter, like a 1D Gaussian before searching.

    More info on dilation can be found here:

    here is the idea implemented in matlab: http://www.mathworks.com/matlabcentral/fileexchange/14498-local-maxima-minima

    if you don't know what dilation is: http://en.wikipedia.org/wiki/Dilation_%28morphology%29

    (its dead simple once you understand it here is a really easy explanation) http://homepages.inf.ed.ac.uk/rbf/HIPR2/dilate.htm

提交回复
热议问题