PULSE: the step-by-step breakdown
From Adam Rosler. The thing you commented PULSE for: build a webcam pulse meter, and see what a camera can read.
What the reel showed
Every heartbeat pushes a little more blood into your face, and blood absorbs green light, so your skin darkens very slightly with each beat: in our test, about half of one 8-bit shade. Averaged over thousands of pixels, a webcam can see it. Verkruysse et al. (2008) did it with a consumer camera in room light; Poh, McDuff & Picard at MIT (2010) with a laptop webcam. We tested a simple version on a public dataset (MCD-rPPG, CC BY 4.0): on 48 videos of 24 people, it matched a finger sensor within 5 beats a minute 40 times; 7 of its 8 misses were fast heartbeats (over 90 bpm).
Build it (an evening, any webcam)
- Install:
pip install opencv-python-headless scipy numpy(OpenCV 4.x for the face detector). - Record yourself: 30-60 s with your webcam (
ffmpeg -f v4l2 -i /dev/video0 -t 45 me.avion Linux,-f avfoundation -i 0on a Mac), face lit evenly from the front, sitting still. - Run the method in
pulse.py(this page): find the face, average the forehead and cheeks (skin pixels only) per frame, then POS (Wang et al. 2017): normalise R, G, B over 1.6 s windows, project onto the plane orthogonal to skin tone, overlap-add, band-pass 0.7-3.5 Hz. The strongest frequency x 60 is your pulse in bpm. - Check it: count your pulse at your wrist for 30 s while you record, or compare with a fitness watch.
- Test it on real data: MCD-rPPG on Hugging Face has webcam videos with a synced finger sensor;
pulse.pyscores your method against it, window by window.
What breaks it (and how to see for yourself)
- Moving your head, talking, flickering or changing light; make-up and very dark rooms lower the signal.
- Fast heartbeats were our misses; try shorter windows or the green channel alone and compare.
Privacy
- A camera that's on is a sensor that's on: close the lid or use a cover when you're not on a call.
Sources: Verkruysse et al., Optics Express 2008; Poh, McDuff & Picard, Optics Express 2010; Wang et al., IEEE TBME 2017; 21 CFR 870.2785. Our run's numbers are kept with the reel's project files.
Files for this breakdown
Unlock the full PULSE breakdown + downloadable runnable scripts
Drop your email once to read the complete step-by-step guide, grab the files, and unlock all 96 Reel breakdowns on this device forever.