The goal of this repo is to measure heart rate based on variation of color in the forehead reigon.
We start by tracking the forehead and extracting the RGB pixels at every frame and adding the mean of the red component green component and blue component to the buffer.
normalize the last 3 seconds of each signal
bandpass filter each of the 3 signals to capture realistic human heart rate frequencies (128 point hamming window)
Perform PCA
Compute the Power spectral density of each principal component
The one with the highest peak is the raw PPG signal
Note: if the peaks of the PSD are within 1000 units of each other, we select the signal based on the previous heart rate reading
Please see "Detailed summary.pdf" for a detailed walkthrough of the algorithm. Also note that the code presented in this repo is not packaged or tailored to be run directly on a 3rd party machine.