A python application that detects and highlights the heart-rate of an individual (using only their own webcam) in real-time.
Python
3,232
197 commits
updated May 13, 2025

A python code that detects the heart-rate of an individual using a common webcam or network IP camera. Tested on OSX, Ubuntu, and Windows
This application uses OpenCV to find the location of the user's face, then isolate the forehead region. Data is collected from this location over time to estimate the user's heart rate. This is done by measuring average optical intensity in the forehead location, in the subimage's green channel alone (a better color mixing ratio may exist, but the blue channel tends to be very noisy). Physiological data can be estimated this way thanks to the optical absorption characteristics of (oxy-) haemoglobin (see http://www.opticsinfobase.org/oe/abstract.cfm?uri=oe-16-26-21434).
With good lighting and minimal noise due to motion, a stable heartbeat should be isolated in about 15 seconds. Other physiological waveforms (such as Mayer waves) should also be visible in the raw data stream.
Once the user's heart rate has been estimated, real-time phase variation associated with this frequency is also computed. This allows for the heartbeat to be exaggerated in the post-process frame rendering, causing the highlighted forehead location to pulse in sync with the user's own heartbeat.
Support for detection on multiple simultaneous individuals in a single camera's image stream is definitely possible, but at the moment only the information from one face is extracted for analysis.
The overall dataflow/execution order for the real-time signal processing looks like:

pip install -r requirements.txtpython get_pulse.py
data_spike_limit in get_pulse.py.
Other mutable parameters of the analysis can be changed here as well.348 followers · starred Feb 2015
412 followers · starred Apr 2013
208 followers · starred Apr 2013
682 followers · starred Apr 2013
A python application that detects and highlights the heart-rate of an individual (using only their own webcam) in real-time.
Python
3,232
197 commits
updated May 13, 2025

A python code that detects the heart-rate of an individual using a common webcam or network IP camera. Tested on OSX, Ubuntu, and Windows
This application uses OpenCV to find the location of the user's face, then isolate the forehead region. Data is collected from this location over time to estimate the user's heart rate. This is done by measuring average optical intensity in the forehead location, in the subimage's green channel alone (a better color mixing ratio may exist, but the blue channel tends to be very noisy). Physiological data can be estimated this way thanks to the optical absorption characteristics of (oxy-) haemoglobin (see http://www.opticsinfobase.org/oe/abstract.cfm?uri=oe-16-26-21434).
With good lighting and minimal noise due to motion, a stable heartbeat should be isolated in about 15 seconds. Other physiological waveforms (such as Mayer waves) should also be visible in the raw data stream.
Once the user's heart rate has been estimated, real-time phase variation associated with this frequency is also computed. This allows for the heartbeat to be exaggerated in the post-process frame rendering, causing the highlighted forehead location to pulse in sync with the user's own heartbeat.
Support for detection on multiple simultaneous individuals in a single camera's image stream is definitely possible, but at the moment only the information from one face is extracted for analysis.
The overall dataflow/execution order for the real-time signal processing looks like:

pip install -r requirements.txtpython get_pulse.py
data_spike_limit in get_pulse.py.
Other mutable parameters of the analysis can be changed here as well.348 followers · starred Feb 2015
412 followers · starred Apr 2013
208 followers · starred Apr 2013
682 followers · starred Apr 2013