Algorithm for extracting Heart Rate from raw ECG signal
I have a raw ECG signal recorded in BDF format (can also make it EDF or txt). Now I have to analyze it off-line and extract heat rate.
Is there any C# or C++ implementation of such an algorithm? Or pseudocode algorithm at least.
Reason for doing it from scratch on my own is that late I want to incorporate it into an online analysis system.
I found links to:
Low Pass Filter: http://en.wikipedia.org/wiki/Low-pass_filter
High Pass Filter: http://en.wikipedia.org/wiki/High-pass_filter
… which will probably be needed for filtering the initial data.
Also there is a system created for a hardware module that might be a nice start:
http://www.codeproject.com/Articles/4353/ECG-recording-storing-filtering-and-recognition
The “Pan, Tompkins” algorithm is fairly simple to implement, and yields reasonable results.
As far as I remember the general ideas were something like:
The characteristic ECG shape is called the QRS-complex, where major spike in the ECG (aka the “R-spike”) has a distinct shape, which is what most people focus-on. The R-spike is enhanced by a “matched filter” (a filter with an impulse-response resembling the spike). I think afterwards the signal was put through a differentiator. Then then there was a simple 3-point-search after the highest peak.
I also remember, that the algoritm had a “blanking period” where no R-spike search was performed, since a heart can only beat so fast…
Have a look at this: ECG QRS Detection (PDF)