Giter Site home page Giter Site logo

aliushn / heartbeat Goto Github PK

View Code? Open in Web Editor NEW

This project forked from prouast/heartbeat

0.0 1.0 0.0 81.69 MB

Desktop implementation of Remote Photoplethysmography – Measuring heart rate using facial video.

License: GNU General Public License v3.0

C++ 100.00%

heartbeat's Introduction

Heartbeat: Measuring heart rate using remote photoplethysmography (rPPG)

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 series

If you are interested in the specifics, feel free to have a read of my publications on the topic:

See also my minimal JavaScript implementation and Browser Demo.

Demo

Dependencies

The following libraries are required to run Heartbeat:

They must be installed on the system such that headers and libraries are found on the compiler's standard search path.

Installation

UPDATE: With current changes in Mojave, compiling via g++ was complicated. After following this advice, the following works for me with macOS 10.14.2 and opencv 4.0.1 installed via Homebrew:

g++ -std=c++11 -I/usr/local/Cellar/opencv/4.0.1/include/opencv4 -lopencv_core -lopencv_dnn -lopencv_highgui -lopencv_imgcodecs -lopencv_imgproc -lopencv_objdetect -lopencv_video -lopencv_videoio Heartbeat.cpp opencv.cpp RPPG.cpp Baseline.cpp -o Heartbeat

Compile the source code for your system, providing a number of required linker flags. This works with opencv 3.4.1 on macOS:

$ g++ -std=c++11 -lopencv_core -lopencv_dnn -lopencv_highgui -lopencv_imgcodecs -lopencv_imgproc -lopencv_objdetect -lopencv_video -lopencv_videoio Heartbeat.cpp opencv.cpp RPPG.cpp Baseline.cpp -o Heartbeat

Alternative compilation for Ubuntu. Works with opencv 3.1:

$ g++ -std=c++11 Heartbeat.cpp opencv.cpp RPPG.cpp Baseline.cpp `pkg-config --cflags --libs opencv` -o Heartbeat

Settings

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

heartbeat's People

Contributors

prouast avatar csavur avatar pierrefritsch avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.