corey_mcm
asked on
Locating local maxima of arbitrary curve
I need to locate the local maxima across a histogram. That is, I need to locate the 'hills' in the histogram graph. Is the best way to do this to calculate the first derivative across the curve until it is under some low (near zero) threshold value? The graph can be quite noisy so I'm not sure what the best way to do this is. Also, what size window should be used to calculate the derivative across the points of the arbitrary curve?
Thanks in advance
Thanks in advance
If the function is continuously differentiable the local maxima will be where the derivative is 0 and the second derivative is negative
If the function is discrete, than anywhere f(n-1) < f(n) > f(n+1) is a local maximum
ASKER
I'm generating a critically smoothed gaussian kernel of the histogram.. Is the safe to use the following (where 'value' is the histogram array):
To calculate the first order derivative:
dOne (int x) {
return value[i+1] - value[i];
}
To calculate the second order derivative:
dTwo (int x) {
return dOne(x+1) - dOne(x);
}
To calculate the first order derivative:
dOne (int x) {
return value[i+1] - value[i];
}
To calculate the second order derivative:
dTwo (int x) {
return dOne(x+1) - dOne(x);
}
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.