Close

Keeping a finger on the pulse

A project log for BabyDroid

An Internet connected, Non-invasive, Baby-safe, Baby monitor and Alert system

digigramDigiGram 08/07/2014 at 20:130 Comments

This whole idea started off while we were looking at baby monitors. "This one features crummy audio while this one has VGA video. This one has better video, but will probably not give me ANY feedback from the baby room while I'm in the laundry room" etc etc. So it went. Off course I just had to find fault with every single one, else there would be little reason for me to get my hand dirty in my electronics pile again.

MIT had a SIGGRAPH paper on measuring a pulse with video magnification (HaD also featured it about two years ago), and so I looked up the videos going along with it to help me convince my wife that we need to build our own Baby Monitor. Well I got ahead of myself and implemented part of it without actually doing all of the important math, and funny enough, so far it works great. I get around 3 beats per minute error on myself, whether I'm resting or exercising. Funny enough my algorithm gets almost double of the real heart rate when my wife is in front of the camera. I tried to convince her it's because she's pregnant. Sadly she's too smart and not gullable enough. I'll update the math as soon as I understand it.

In essence, OpenCV reads a frame, finds a face (or a region roughly the colour of Caucasian skin) and then calculates the mean value of the Green channel in that sub image (so far the Green channel had the least amount of interference from ambient light). This value is added to a list containing the last 360 values (my i3 processes around 6 FPS, so 360 frames = 1 minute). With the help of some Fast Fourier Transforms and a lot of data smoothing, a rate can be extracted. I'm pretty sure it is the heart rate.

Funny enough, when I put a picture of myself on my phone and show it to the camera, the algorithm finds a pulse of exactly 60 or 0. Alternating endlessly. I assume this has to do with ambient light, light from the computer OR phone or something to that extend.

So far I'm happy with the accuracy when I'm close to the webcam, but I need to work on the accuracy when the subject (ahem, our baby) is 1m or more away from the camera.

Here is a screen shot. Real pulse = 64. FPS is obviously rounded and MOV I will explain later on.

Discussions