https://github.com/prouast/heartbeat
Desktop implementation of Remote Photoplethysmography – Measuring heart rate using facial video.
https://github.com/prouast/heartbeat
face heart-rate heart-rate-measurement heart-rate-monitor pulse remote-photoplethysmography remote-sensing rppg video video-processing vital-signs
Last synced: 5 months ago
JSON representation
Desktop implementation of Remote Photoplethysmography – Measuring heart rate using facial video.
- Host: GitHub
- URL: https://github.com/prouast/heartbeat
- Owner: prouast
- License: gpl-3.0
- Created: 2016-08-01T18:56:04.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2025-03-04T06:24:50.000Z (7 months ago)
- Last Synced: 2025-04-11T19:13:34.032Z (6 months ago)
- Topics: face, heart-rate, heart-rate-measurement, heart-rate-monitor, pulse, remote-photoplethysmography, remote-sensing, rppg, video, video-processing, vital-signs
- Language: C++
- Homepage:
- Size: 79.8 MB
- Stars: 566
- Watchers: 22
- Forks: 144
- Open Issues: 7
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Heartbeat: Measuring heart rate using remote photoplethysmography (rPPG)
Looking for more powerful and up-to-date rPPG tools?
Check out our latest libraries and apps!| 📌 Tool | ⚡ Features | 🔗 Get Started |
|---------|-----------|---------------|
| **[Python Library](https://github.com/Rouast-Labs/vitallens-python)** | G, POS, CHROM, VitalLens API | [GitHub](https://github.com/Rouast-Labs/vitallens-python) |
| **[JavaScript Library](https://github.com/Rouast-Labs/vitallens.js)** | G, POS, CHROM, VitalLens API | [GitHub](https://github.com/Rouast-Labs/vitallens.js) |
| **[iOS App](https://apps.apple.com/us/app/vitallens/id6472757649)** | Live HR + RR Estimation | [App Store](https://apps.apple.com/us/app/vitallens/id6472757649) |
| **[Rouast Labs](https://rouast.com/api)** | More about our research & tech | [Website](https://rouast.com) |This is a simple implementation of rPPG, a way to measure heart rate without skin contact. It uses a video recording or live feed of the face to analyse subtle changes in skin color.
Here's how it works:
- The face is detected and continuously tracked
- Signal series is obtained by determining the facial color in every frame
- Heart rate is estimated using frequency analysis and filtering of the seriesIf you are interested in the specifics, feel free to have a read of my publications on the topic:
- [Remote Photoplethysmography: Evaluation of Contactless Heart Rate Measurement in an Information Systems Setting][aitic]
- [Using Contactless Heart Rate Measurements for Real-Time Assessment of Affective States][gmunden]
- [Remote heart rate measurement using low-cost RGB face video: A technical literature review][fcs]See also my minimal [JavaScript implementation](https://github.com/prouast/heartbeat-js) and [Browser Demo](https://prouast.github.io/heartbeat-js/).
### Demo
* [Real-time rPPG in action][video1]
* [Offline rPPG With physiological baseline measurements][video2]### Dependencies
The following libraries are required to run Heartbeat:
* [OpenCV]
They must be installed on the system such that headers and libraries are found on the compiler's standard search path.
### Installation
For building a Makefile is available that works on macOS:
```sh
$ make
```Alternative compilation for Ubuntu. Works with opencv 3.1:
```sh
$ g++ -std=c++11 Heartbeat.cpp opencv.cpp RPPG.cpp `pkg-config --cflags --libs opencv` -o Heartbeat
```### Settings
After building, the app can be run via
```
$ ./Heartbeat
```Several command line arguments are available:
| Argument | Options | Description |
| --- | --- | --- |
| -i | Filepath to input video | Omit flag to use webcam |
| -rppg | g, pca (default: g) | Specify rPPG algorithm variant - only green channel or rgb channels with pca |
| -facedet | haar, deep (default: haar) | Specify face detection classifier - Haar cascade or deep neural network |
| -r | Re-detection interval (default: 1 s) | Interval for face re-detection; tracking is used frame-to-frame |
| -f | Sampling frequency (default: 1 Hz) | Frequency for heart rate estimation |
| -max | default: 5 | Maximum size of signal sliding window |
| -min | default: 5 | Minimum size of signal sliding window |
| -gui | true, false (default: true) | Display the GUI |
| -log | true, false (default: false) | Detailed logging |
| -ds | default: 1 | If using video from file: Downsample by using every ith frame |License
----GPL-3.0
[//]: # (These are reference links used in the body of this note and get stripped out when the markdown processor does its job. There is no need to format nicely because it shouldn't be seen. Thanks SO - http://stackoverflow.com/questions/4823468/store-comments-in-markdown-syntax)
[aitic]:
[fcs]:
[gmunden]:
[OpenCV]:
[ffmpeg]:
[video1]:
[video2]: