Coder Social home page Coder Social logo

samproell / yarppg Goto Github PK

View Code? Open in Web Editor NEW
40.0 2.0 12.0 7.44 MB

Yet another implementation of remote photoplethysmography (rPPG) in Python

License: MIT License

Python 1.75% Jupyter Notebook 98.25%
physiological-signals photoplethysmography pulse-detection computer-vision

yarppg's Introduction

Yet another rPPG

* This is a work in progress, do not blindly trust the results *

yarppg is yet another implementation of remote photoplethysmography in Python. Remote photoplethysmography (rPPG) refers to the camera-based measurement of a (blood volume) pulse signal. It works by detecting small changes in skin color, originating from the pulsation of blood1.

Some other open-source implementations of rPPG:

The current default implementation uses the bandpass-filtered green channel averaged across a custom ROI suggested by Li et al.2 Other features of their algorithm are a work in progress.

image

Installation and usage

In order to run this rPPG implementation, you first have to clone the repository and make sure all requirements are installed. Afterwards you can run the yarppg subfolder as a python package using the -m flag:

git clone https://github.com/SamProell/yarppg.git
cd yarppg
pip install -r requirements.txt
python -m yarppg  # from yarppg top-level directory

Alternatively, install the package using pip (from the top-level directory). After installing, you can simply call the provided entry point run-yarppg.

pip install -e .
run-yarppg

Command line options

There are a number of options available, when running yarppg:

Option Default Description
--detector facemesh

ROI (face) detector - choices: {facemesh,caffe-dnn,haar,full}

--processor LiCvpr

Processor translating ROI to pulse signal. LiCvpr currently only returns mean green value - choices: {LiCvpr,Pos,Chrom}

--winsize 32

Window sized used in some processors (in frames)

--bandpass 0.5,2

bandpass frequencies for processor output

--blobsize 150

quadratic blob size of DNN Face Detector

--draw-facemark False

draw landmarks when using facemesh detector

--blur -1

pixelation size of detected ROI

--video 0

video input device number or filename

--limitfps None

force a delay when reading frames (specified in milliseconds)

--savepath ''

store generated signals as data frame to disk

Camera setup

For rPPG to work as intended it might be required to tweak the camera settings. For example auto white-balancing and auto-exposure could be disabled, to avoid small adjustments in RGB values. One possibility to change the camera settings is via the ffmpeg commandline tool. See the discussion here: https://superuser.com/questions/1287366/open-webcam-settings-dialog-in-windows/1511657



  1. W Verkruysse, L O Svaasand and J S Nelson. Remote plethysmographic imaging using ambient light. Optics Express. 2008;16(26):21434–21445. doi:`10.1364/oe.16.021434 <https://doi.org/10.1364/oe.16.021434>`_

  2. Li, X., Chen, J., Zhao, G., &#38; Pietikainen, M. (2014). Remote Heart Rate Measurement From Face Videos Under Realistic Situations. Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition (CVPR), 4264-4271.

yarppg's People

Contributors

dependabot[bot] avatar samproell avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

yarppg's Issues

Live digital filters as a separate package / library

Hello,

I read with interest your blog post https://www.samproell.io/posts/yarppg/yarppg-live-digital-filter/

I wonder if a separate package just for implementing live digital filters in Python won't make sense.

It could be based on list as you did in

self._xs = [0]*len(b)

or on deque as mentioned in your blog post.

A last idea could be to rely on circular buffer / ring buffer on top of Numpy such as https://github.com/eric-wieser/numpy_ringbuffer or https://github.com/Dennis-van-Gils/python-dvg-ringbuffer

Any opinion?

Video Input

Input video as a recorded video does not work. The error is "No frames received"

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.