tl;dr: What is a fast way to get the equation of this line?
I have to extract the "line of best fit" from this data (shown below), and many others like it (so I need a robust method). It is a a spectrogram of a linear chirp. The x axis is frequency and the y-axis is time. The linear chirp came from a truck outputting 4-140Hz linearly over exactly 8 seconds, but attenuation in the ground and some other physical phenomena mean that we are seeing a signal for around 10 seconds.
I looked into using the Hough transform to find the gradient of the line, and then cross-correlating the data with a line of this gradient. But the Hough transform is too slow to perform en mass, which is what I need to do.
I thought about finding the maxima for frequency ranges (5-10, 10-15, etc.) and plotting a line of best fit through these, but in this particular example there are only two or three areas of strong intensity.
The other spectrograms look like this but the high intensity regions will move around to different points on the line, and some may have more noise.
Whats a good way of doing this algorithmically?
My current idea is:
- Look for highest intesity regions.
- Look at many pixels in their neighbourhood and estimate the "center of mass".
- Draw line between them and find equation of line.
Is there a better way?