Calculate heart rate from mp4 video of thumb taken from a smartphone
- Calculate brightness on each frame (mean value over each pixel and RGB channel)
- Remove baseline fluctuations using the Asymmetric Least Squares Smoothing
- calculate FFT of signal
- find frequency corresponding to maximum FFT coefficient
Heart beats per minute is given by maximum FFT frequency * 60
- count positive amplitude spikes (and calculate spike occurence [spikes/minute])
- count negateive amplitude spikes (and calculate spike occurence [spikes/minute])
Heart beats per minute is given by the average of the positive and negative spike occurence
Acquired using a Nexus 4 (Ubuntu Touch OS) with the flash LED on. The current script expects a .mp4
file without a soundtrack
(bitrate of the video was reduced so it could be uploaded on the web).
- imageio:
.mp4
processing - scipy
- numpy
- matplotlib