Mobile Cardiograph

This simple project was to try and extract a person's heart rate from a video feed of a close up one's illuminated finger. One just has to place their finger under the camera of their phone and the measurement can be easily made.

I tried two methods of calculating the pulse, one using time domain analysis and the other in the frequency domain. 

In the final implementation I used the phone flash for illumination, but I worked out that given sufficient ambient illumination one can do away with the flash. The flash actually makes the experience a bit uncomfortable due to the heat that it generates when kept on even for around 5-6 seconds. 

Also another thing that happens when the flash is used is the camera sensor's red channel gets saturated and the oscillations in intensity need to be tracked from the green channel.

Since it is difficult to ensure the sensor is covered completely even around the edges, from an application point of view it is beneficial to use just a smaller section of values in the middle of the video feed for the analysis.

(Left) Ideal arrangement for measurement 

(Right) Position of the finger with respect to the camera and flash

Time Domain Method

In this method the idea is to find the time period between successive peaks in the signal. Peaks are chosen over something like zero crossings as they are invariant to offset. For this particular signal it made sense to choose peak detection over valley detection because of the nature of the two, one is more distinct. 

The heart rate estimate is shown on the right with both the raw and filtered signals plotted.

Frequency Domain Method

The simple idea behind this is to decompose the signal on a Fourier basis and pick out the frequency at which there is the largest absolute magnitude. This method gave an estimate with significantly lower variance and could track changes in the pulse better.

Comparison between the Two Methods