thearn/webcam-pulse-detector
thearn/webcam-pulse-detector has 3,235 GitHub stars and 595 forks. GitHot measured 0 stars in 24 hours. Last checked 2026-11-06 18:53 UTC. Last push 2025-05-13.
A python application that detects and highlights the heart-rate of an individual (using only their own webcam) in real-time.
Measured star growth
- in 24h
- 0
- in 7 days
- Collecting history
- in 15 days
- Collecting history
- in 1 month
- Collecting history
Net star changes over overlapping periods, not daily totals. Missing measurements are left blank. Stars measure attention, not software quality.
README.md
Original
webcam-pulse-detector
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
How it works:
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:

Quickstart:
- run
pip install -r requirements.txt - run get_pulse.py to start the application
python get_pulse.py
Usage notes:
- When run, a window will open showing a stream from your computer's webcam
- When a forehead location has been isolated, the user should press "S" on their keyboard to lock this location, and remain as still as possible (the camera stream window must have focus for the click to register). This freezes the acquisition location in place. This lock can be released by pressing "S" again.
- To view a stream of the measured data as it is gathered, press "D". To hide this display, press "D" again.
- The data display shows three data traces, from top to bottom:
- raw optical intensity
- extracted heartbeat signal
- Power spectral density, with local maxima indicating the heartrate (in beats per minute).
- With consistent lighting and minimal head motion, a stable heartbeat should be isolated in about 15 to 20 seconds. A count-down is shown in the image frame.
- If a large spike in optical intensity is measured in the data (due to motion
noise, sudden change in lighting, etc) the data collection process is reset and
started over. The sensitivity of this feature can be tweaked by changing
data_spike_limitin get_pulse.py. Other mutable parameters of the analysis can be changed here as well.
Explore related projects
freeCodeCamp/freeCodeCamp
freeCodeCamp.org's open-source codebase and curriculum. Learn math, programming, and computer science for free.
458,678 starsdonnemartin/system-design-primer
Learn how to design large-scale systems. Prep for the system design interview. Includes Anki flashcards.
377,162 starsreact/react
The library for web and native user interfaces.
252,293 starsvuejs/vue
This is the repo for Vue 2. For Vue 3, go to https://github.com/vuejs/core
212,623 stars