GithubHelp home page GithubHelp logo

josebenitezg / webcam-heart-rate-monitor Goto Github PK

View Code? Open in Web Editor NEW

This project forked from giladoved/webcam-heart-rate-monitor

0.0 1.0 0.0 14 KB

Measure Your Heart Rate Using Your Webcam!

Python 100.00%

webcam-heart-rate-monitor's Introduction

Webcam Heart Rate Monitor

Measure Your Heart Rate Using Your Webcam!

Note: This project was made for educational purposes only. This is not for commercial use. The algorithm is based on the incredible work done at the MIT Computer Science & Artificial Intelligence Lab. Please check out their work.

This project can monitor a user's heart rate in real time using just a webcam. It is a PPG (Photoplethysmogram) solution based on a color magnification algorithm which makes it possible to see the color of your face change as blood rushes in and out of your head. This project allows you to visualize your face as it pulsates in real time. Since it is able to detect your pulses, it also calculates your heart rate in beats per minute (BPM).

Demo Gif

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing.

Prerequisites

Ensure the computer you are using to run this project has a webcam.

These are the library versions I am using (other versions haven't been tested):

python 2.7.13
numpy  1.13.1
opencv 4.5.5

Installing

Install python here

Install numpy: pip install numpy

Install opencv2 on MacOS: brew install opencv@2. Check out Homebrew, the package manager for MacOS.

Use the following commands in the terminal to check the library versions installed:

python --version
python -c "import numpy; print numpy.__version__"
python -c "import cv2; print cv2.__version__"

Usage

Once the project is downloaded. Run the python file:

python main.py

The webcam light should activate and there should be a small window that appears. The program takes a few seconds to detect the pulse and start calculating your heart rate so be patient. While the program is running, it saves the original unmodified webcam video as 'original.mov' as well as a video of the output called 'output.mov'. Both of these videos will be overwritten every time the program is run, so make sure to copy the videos you would like to save to another directory.

To quit the program press 'q' on your keyboard.

If you would like this program to analyze a video, instead of the real time webcam, simply pass the location of the video as a parameter. The program will generate an output based on the provided video. The input video must be 320x240. Here is an example:

python main.py original.mov

Tips for Best Results

  • Make sure your face is well lit

  • Place your forehead in the green box (area of detection)

  • Try not to move or blink too much

webcam-heart-rate-monitor's People

Contributors

giladoved avatar markusvonstaden 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.