Heart Rate Detection using Consumer Camera and MATLAB

by rh5

Software Development Journey Overview

Follow this step-by-step software development journey to see real progress updates, challenges overcome, and practical experience.

Progress Updates (2 total)

Update #1: Heart Rate Detection using Consumer Camera and MATLAB

This project is my final project for Digital Signal Processing. The heart rate estimation algorithm aims to detect the intensity variation of a pixel or a region across the video sequence. To do so, the following overarching steps need to occur: 1. Data Acquisition: - Record 30 second long videos to analyze. - Obtain a ground-truth while recording the videos by measuring the subject's heart-rate via an Apple Watch. - Eventually, have subjects increase heart-rate and re-measure data. 2. Time Domain Analysis: - Read individual frames of Data into 3D-Array. - Select a Region of Interest (ROI). - Convert 3D-Array of ROI to a 1-D array of pixel intensity. 3. Frequency Domain Analysis (WIP) - The heart pushes the blood to every part of the body and to the head particularly (towards the brain), so it changes the color and opacity of the skin. These changes can be detected by analyzing the average red or green component of the frames, taken from the camera. - Using Fourier Transforms, Butterworth Filters, and Amplification, the heart-rate should be able to be detected. - This is still a work in progress. Current Project Status: - I did not want to just define an arbitrary ROI hoping the subject does not move during the recording. - I am using MATLAB's Computer Vision Processing library to detect and track faces. Once the face is detected, I am declaring my ROI in the horizontal center and 10% from the top portion of the box, resulting in a small section of the forehead. - That ROI will (hopefully) allow for reliable pixel intensity measurements.

Update #2: Finished Program

- Based on prior research, .8 – 3 Hz correlates to 40 – 180 BPM. - Designed a 2nd order Butterworth filter to keep our heart rate within those ranges - Other filter types can be tested, and We chose Butterworth as: - It is an IIR filter, and the order required for a given bandwidth is much lower than with a FIR filter. Lower order usually means less computations. It has flat pass-band and stop-bands compared to other IIR structures that show ripples. This avoids favoring certain frequencies over others in the valid range. This sample’s heartrate had a ground truth of 108 BPM measured after working out. As the video goes on, the sample’s heartrate decreases which is evident in the video shown. Moving average was helpful to see the change in heartrate over video sample. - Additionally, the ROI was moved from the forehead to the tip of the nose and made smaller to reduce heartrate error. This allows for no obstruction from bangs or facial hair.