HRV4Training
  • Home
  • QuickStart Guide
  • PRO & TEAMS
  • FAQ
  • Privacy & Terms
  • Contact
  • Publications
  • Blog
  • Shop

Heart rate variability using the phone's camera

5/15/2015

3 Comments

 
Blog post by Marco Altini.
Picture
In the last two posts I introduced the concept of heart rate variability (HRV) and analyzed how well RR intervals and HRV features can be extracted using commercially available heart rate (HR) monitors. While I showed that a chest strap was needed to extract HRV features accurately, I argued that optical measurements are potentially as accurate as chest straps. 

Time to show some data. In this post I will analyze photoplethysmography (PPG for short) data acquired using the iPhone's camera and compare it to a Polar H7. PPG consists in detecting changes in blood volume during a cardiac cycle, by illuminating the skin and measuring changes in light absorption. PPG has become quite a popular non-invasive method for extracting physiological measurements such as heart rate (HR) and oxygen saturation. For more technical details on the signal processing techniques I used to extract HRV features from PPG, you can read this other post on my personal blog.
In this post I will look at the data more from a user perspective, showing how the iPhone camera data processed by HRV4Training is as good as what you get using a chest strap. In particular, I'll cover the following:
  • analyze RR intervals acquired with a Polar H7 or processed using the iPhone's camera, for three different conditions; rest, paced breathing and recovery after exercise
  • analyze HR and HRV features (time and frequency domain) for the same three conditions
I will also provide some tips on how to make the best use of the camera version of my apps. While the camera version is accurate, it can take a bit more time to get familiar with this measurement modality.

Data acquisition

I acquired the data used in this post with a "special app" I made. The app is basically a combination of the Camera HRV and HRV Logger apps, and lets me connect to a Bluetooth SMART sensor and simultaneously collect and process PPG data using the iPhone's camera. The complete PPG raw data is also stored by the app. I used a Polar H7 as reference, since it's the most reliable heart rate monitor I've found so far. 

I will first show RR intervals for the three conditions I'm comparing (rest, paced breathing and recovery post-exercise) and then look at HR and time and frequency domain HRV features computed on 60 seconds windows. 

A note on data collection and synchronization: The two systems (H7 and camera) recorded data simultaneously, however data is not really timestamped. For example when I get data from the H7, RR intervals are appended to the HR sample every second, however RR intervals are not timestamped and I need to reconstruct the absolute time by summing up RR intervals. In case an interval is not detected or there is noise, the absolute timestamps won't be correct and could get out of synch. This issue explains some of the delays seen between the two data streams. When computing features, these delays are a minor problem, since we compute features using bigger windows (e.g. 60 seconds), and therefore attenuate differences due to the fact that a couple of RR intervals might end up in different windows. 

RR intervals - comparison

RR intervals comparison - condition 1: rest

Here are three minutes of RR intervals recorded at rest (sitting):
Picture
The time series and histograms look very similar, pointing out already that PPG data can provide high accuracy in beat to beat measurements. Let's have a look at the other two conditions, paced breathing - showing big swings in heart rate due to respiratory sinus arrhythmia - and recovery - showing lower values and variability - due to lower parasympathetic activity.

RR intervals comparison - condition 2: paced breathing

Here are 90 seconds of paced breathing data, as we can see it's deep breaths, about 6 per minute:
Picture
Again the PPG time series looks pretty good, following closely the pattern we see for the Polar H7.

RR intervals comparison - condition 3: recovery

Here we have about 2 minutes of RR intervals following a 20 minutes bike ride:
Picture
RR intervals are much shorter than in the other two plots (i.e. higher HR), and variability is also reduced (see histogram).

Heart rate

RR intervals seem promising, the time series look very similar. Let's now have a look at HR and HRV features to see if we can extract the same information for both the iPhone's camera and Polar H7. As I discussed in other posts, we are mainly interested in measuring rMSSD and HF, as they are good indicators of parasympathetic activity. Another interesting marker is LF, if we are interested in for example monitoring paced breathing/meditation. In this context we can do breathing exercises (i.e. deep breaths), at relatively low frequencies, that we can capture by analyzing LF. For example, breathing at 6 breaths per minute should result in a peak around 0.1 Hz, which is reflected in the LF feature since LF represent the frequency power in the 0.04 - 0.15 Hz band. Let's start the analysis by looking at HR.

Average HR should be easy to measure using optical methods. IPhone apps detecting HR have been out forever and wrist based sensors showing poor performance for HRV can still measure HR pretty accurately. Our comparison shows what we expect, HR computed using the camera matches very closely what we get with the Polar H7, for all three conditions:

Heart rate comparison - condition 1: rest

Picture

Heart rate comparison - condition 2: paced breathing

Picture

Heart rate comparison - condition 3: recovery

Picture
All HR plots were computed using features collected over 30 seconds and a sliding window of 5 seconds, so over a rather short timeframe. Next, we'll finally look into HRV features.

Heart rate variability features

The following plots show HRV features computed over 60 seconds windows. I plotted features derived using the iPhone camera side by side with features extracted using RR intervals collected with the Polar H7. The data is the same that was used for the plots above. I computed both time and frequency domain features according to the formulas I introduced in a previous post. The sliding window here is 15 seconds, and as usual we look at all three condition separately (rest, paced breathing and recovery).

HRV features comparison - condition 1: rest

Picture

HRV features comparison - condition 2: paced breathing

Picture
At this point we can start looking at a few interesting aspects. For example, as I introduced before, paced breathing at low frequency rates (e.g. 6 breaths/minute), are reflected in higher frequency power for the LF feature, which includes the 0.1Hz peak resulting from breathing at 6 breaths per minute (LF is defined as 0.04 to 0.15Hz). I'll show comparisons between conditions later on, but you can scroll up and see easily how the LF values are much higher in the paced breathing condition. Also, both conditions are actually recordings taken at rest, which might explain similar values in rMSSD and HF. The situation gets quite different for the recovery recording, shown next.

HRV features comparison - condition 3: Recovery

Picture
As expected, for the recovery conditions HRV is highly reduced, with pNN50 going down to zero (i.e. no consecutive RR intervals differ for more than 50 ms), and rMMSD, LF and HF also being much lower. Both the PPG from the iPhone camera and the Polar H7 show the same behavior across time and frequency domain features.

Now let's finally look at a comparison between conditions:
Picture
Just looking at the data, we can see that PPG data can discriminate between different conditions as good as the Polar H7 can, for both time and frequency domain features.

We can also look at the HRV features values computed using the iPhone camera and Polar H7 in a different way, plotted against each other for each time window, and all conditions together (plus residuals): 
Picture
Picture
For the ones that believe in p-values, no statistically significant differences are found for any of the features, if we consider a standard alpha value of 0.05 (t-test for AVNN: p=0.56, SDNN: p=0.92, rMSSD: p=0.56, pNN50: p=0.55, HF: p=0.98, LF: p=0.63).

Summary and tips for the camera

I hope with this post I convinced you that the camera version of HRV4Training is as good as the Polar H7. I went through all time and frequency domain HRV features (+RR intervals and HR computed on shorter time windows), for three different conditions in which the sympathetic and parasympathetic systems interact differently. With both the camera and Polar H7 we could easily spot the differences in HRV features that we expected and for all conditions we couldn't find any statistically significant difference between the two sensor modalities. 

For my recordings, I stopped using the H7 a long time ago, and went for the convenience of using the camera and not having to wear the sensor early in the morning. However, I realize there are trade offs and it might take a couple of measurements with the camera before you get familiar with it. Here are a few tips to speed up this process:
  • Use your fingertip for the measurement
  • Place your fingertip exactly on the camera, you need to cover it all
  • It doesn't matter that you fully cover the flash, worry about the camera. However, it does matter that the flash fires up, and the app won't work properly in iPads or iPods where the flash doesn't turn on. You will need an iPhone to be able to use the camera version
  • Do touch the camera, but limit pressure. It's important to touch it gently, otherwise too much pressure will impede blood flow (which is what needs to be measured)
  • Try not to move for the duration of the whole test, and follow the breathing pattern shown by the blue bar. Moving the finger can easily create motion artifacts and affect your measurement. While the algorithms try to deal with noise and discard bad data, if you feel there was too much noise and you moved too much, it's better to take the test a second time.
  • A good reference for how the signal should look like is the screenshot at the beginning of this article


Since version 4.9.2 HRV4Training provides more guidance on how to place your finger as well as a view of the camera to make sure you properly cover it (see screenshots above). 
Follow @marco_alt
3 Comments
Nigel lewis link
9/9/2015 12:16:49 pm

I am really excited with your findings. As a therapist who uses various forms of bio-feedback to convince my clients of the effectiveness of breathing techniques to achieve coherence I have been waiting for a way to measure HR,HRV,HF,LF ect without having to expect my clients to put on a polar strap. ( too invasive). You have convinced me that that is now available. Thank you for all the creative, innovative and groundbreaking work that you are doing!

Reply
Monica
9/11/2015 03:33:12 pm

Impressive blog and ability to translate research into usable information. I am a fan! What apps do u recommend for android systems?

Reply
Robert Sholtes link
10/6/2015 09:22:56 pm

An artical was in JAMA. Psychiatry Oct 2015 about hiw low heart rate variability is associated with higher risk for PTSD in vets prospectively measured from just 5 minute samples. I have so many people in my peactice who struggle with vulnerability to reactivity. This kind of measuring could be useful in demtstifying their vulnerability. Thanks and keep it up. I will look into the apps and the training.

Reply

Your comment will be posted after it is approved.


Leave a Reply.

    Picture
    Picture
    Register to the mailing list
    and try the HRV4Training app!
    Picture
    Picture
    This blog is curated by
    Marco Altini, founder of HRV4Training


    ​Blog Index
    ​
    The Ultimate Guide to HRV
    1: Measurement setup
    2: Interpreting your data
    3: Case studies and practical examples

    How To
    1. Intro to HRV
    ​2. How to use HRV, the basics
    3. HRV guided training
    ​4. HRV and training load
    ​
    5. HRV, strength & power
    6. Overview in HRV4Training Pro​
    7. HRV in team sports
    ​

    HRV Measurements
    Best Practices

    1. Context & Time of the Day
    2. Duration
    ​
    3. Paced breathing
    4. Orthostatic Test
    5. Slides HRV overview
    6. Normal values and historical data
    ​7. HRV features
    ​
    Data Analysis
    1a. Acute Changes in HRV
    (individual level)

    1b. Acute Changes in HRV (population level)
    ​
    1c. Acute Changes in HRV & measurement consistency
    1d. Acute Changes in HRV in endurance and power sports​
    2a. Interpreting HRV Trends
    2​b. HRV Baseline Trends & CV
    3. ​Tags & Correlations​
    4. Ectopic beats & motion artifacts
    5. HRV4Training Insights
    6. HRV4Training & Sports Science
    7. HRV & fitness / training load
    ​8. HRV & performance
    9. VO2max models
    10. Repeated HRV measurements
    11. VO2max and performance
    12. HR, HRV and performance
    13. Training intensity & performance​
    14. Publication: VO2max & running performance
    ​
    15. Estimating running performance
    16. Coefficient of Variation
    17. More on CV and the big picture
    ​​​​​18. Case study marathon training
    19. Case study injury and lifestyle stress
    20. HRV and menstrual cycle
    21. Cardiac decoupling
    22. FTP, lactate threshold, half and full marathon time estimates
    ​23. Training Monotony
    ​
    Camera & Sensors
    1. ECG vs Polar & Mio Alpha
    2a. Camera vs Polar
    2b. Camera vs Polar iOS10
    2c. iPhone 7+ vs Polar
    2d. Comparison of PPG sensors
    3. Camera measurement guidelines
    4. Validation paper
    ​5. Android camera vs Chest strap
    ​6. Scosche Rhythm24
    ​7. Apple Watch
    8. CorSense
    ​
    9. Samsung Galaxy
    ​
    App Features
    ​1. Features and Recovery Points
    2. Daily advice
    3. HRV4Training insights
    4. Sleep tracking
    5. Training load analysis
    ​6a. Integration with Strava
    6b. Integration with TrainingPeaks
    6c. Integration with SportTracks
    6d. Integration with Genetrainer
    ​
    6e. Integration with Apple Health
    ​
    ​6f. Integration with Todays Plan
    7. Acute HRV changes by sport
    8. Remote tags in HRV4T Coach
    9. VO2max Estimation
    ​
    10. Acute stressors analysis
    11. Training Polarization
    ​
    12. Lactate Threshold Estimation
    13. Functional Threshold Power(FTP) Estimation for cyclists
    14. Aerobic Endurance analysis
    15. Intervals Analysis
    ​​​16. Training Planning
    17. Integration with Oura
    18. Aerobic efficiency and cardiac decoupling
    ​
    Other
    1. HRV normal values​
    ​2. HRV normalization by HR
    ​
    3. HRV 101

    RSS Feed

Picture
  • Home
  • QuickStart Guide
  • PRO & TEAMS
  • FAQ
  • Privacy & Terms
  • Contact
  • Publications
  • Blog
  • Shop