thearn / webcam-pulse-detector

A python application that detects and highlights the heart-rate of an individual (using only their own webcam) in real-time.
Other
3.14k stars 592 forks source link

Taking all color channels instead of green only. #47

Open Exile333 opened 6 years ago

Exile333 commented 6 years ago

For all interested - here's the original article: https://dspace.mit.edu/openaccess-disseminate/1721.1/66243 This implementation does not: 1) use JADE algorithm to recover original independent signals, from which we take second and do the processing via Fourier transform; 2) use not all face for processing, but only a small part of a forehead (which is probably fine although); 3) use raw green channel for processing as particularly green channel is the closest one to represent human pulse.

Correct me if I'm wrong.

Exile333 commented 6 years ago

UPD: Sorry for i didn't read the whole readme. It uses other algorithm to process heartrate. Still for some reason i don't understand why all color channels are used in processing, not just green.

osianSmith commented 5 years ago

Hello This implementation is using photoplethysmography which is the same technology that many smart devices such as the Apple Watch use. According to apple (easiest description I could find for you) it works like this.

The heart rate sensor in Apple Watch uses what is known as photoplethysmography. This technology, while difficult to pronounce, is based on a very simple fact: Blood is red because it reflects red light and absorbs green light. Apple Watch uses green LED lights paired with light‑sensitive photodiodes to detect the amount of blood flowing through your wrist at any given moment. When your heart beats, the blood flow in your wrist — and the green light absorption — is greater. Between beats, it’s less. By flashing its LED lights hundreds of times per second, Apple Watch can calculate the number of times the heart beats each minute — your heart rate.

influt commented 5 years ago

Hi Sorry to wake up this thread. The explanation about green light absorption and red light reflection is clear. I'm guessing that Exile333 was referring to this: https://github.com/thearn/webcam-pulse-detector/blob/no_openmdao/lib/processors_noopenmdao.py#L87 . On this line, we are picking means for all 3 channels instead of just green, which probably is a bug.