ncorbuk / yarppg

Yet another implementation of remote photoplethysmography (rPPG) in Python

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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 blood [1].

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.

docs/images/yarppg-screenshot.png

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
[2]Li, X., Chen, J., Zhao, G., & 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.

About

Yet another implementation of remote photoplethysmography (rPPG) in Python

License:MIT License


Languages

Language:Jupyter Notebook 98.3%Language:Python 1.7%