Ask Your Question

Best method for breath tracking

asked 2015-11-10 20:28:40 -0500

MartinTarrou gravatar image

Hey All,

I'm making a windows application that does breath tracking with a standard webcam. It detects when the user is inhaling, exhaling, and resting, and eventually I'd like to get more precise information about for example the speed and size of the breath (i.e. deep breathing or not). I currently have two prototypes using different methods and was wondering if people had input on which would be better long term.

Both detect general upward and downward movement in order to determine breath. The first is based on the motempl.c example program (which I have not been able to get running in OpenCV 3 yet, but can in earlier versions). Demo here: Code here:

The other prototype I have uses Farneback Optical Flow. demo here: example code:

I'm eventually hoping to port the project into UE4 using the OpenCV plugin if that makes a significant difference.

Mostly curious to know if one of the algorithms is definitively better for this kind of tracking. Biggest priority would be to focus detection on the chest so background/other movement doesn't hurt it too much.

Thanks in advance for the help.

edit retag flag offensive close merge delete


About "motempl.c example program" it's now in opencv contrib

LBerger gravatar imageLBerger ( 2015-11-11 14:12:46 -0500 )edit

2 answers

Sort by » oldest newest most voted

answered 2015-11-11 12:41:05 -0500

I am doing a paper review about 'Non-Contact Video-Based Estimation Of Physiological Parameters: A Review'. It is not finished at all, but I can copy/paste a piece of text about breath information.

Poh et al. [96], explored the possibility to measure Hear Rate (HR) from face videos recorded by a webcam. They detected the region of interest (ROI, i.e. the face area) using Viola-Jones face detector and computed the mean pixel values of the ROI of each frame from three color channels. Then, Independent Component Analysis (ICA) was applied to separate the PPG signal from the three color traces, and the PPG signal was transferred into frequency domain to find the frequency with the max power within the range of [0.7, 4] Hz as the HR frequency. Indeed, ICA had previously been used to reduce motion artifacts in PPG measurements [124], [125]. According to previous findings [120], the green channel trace contains the strongest plethysmographic signal among the three color channels. Poh’s results showed that comparing to the raw green trace, ICA separated sources can achieve higher accuracy for measuring HR.

Later on, Poh et al. [97] extended their original work in order to estimate respiratory rate, which was estimated with a well-known indirect method [126] based on heart rate variability (HRV). The peaks of the PPG waveform (corresponding to the dominant ICA component) were identified to derive a time series of inter-beat intervals. Respiratory rate estimation from HRV works well in healthy young volunteers, but is much less likely to give accurate results in elderly subjects, especially those with chronic diseases, most of which depress autonomic function [127].

However, breathing is associated with movement of the upper thorax and regions of the face. The changes in the amplitude of the PPG waveform caused by breathing-synchronous motion can be extracted though band-pass filtering and spectral analysis [112].

Respiratory rate can also be estimated directly through motion-tracking techniques. Eulerian video magnification techniques can be used to track and amplify the motion-related changes caused by breathing in the videos of human subjects, including neonates, recorded under normal lighting conditions [100].

... ...

Westphal et al. [128] examine abilities and limitations of the aforementioned algorithm proposed by Wu et al. [100]. More specifically, this study investigates the influence of varying ambient light as well as the influence of movements of the measuring objects on the results. Reliable results are strongly dependent on the right environmental conditions. Good results are obtained if the ROI is nearly free of movements. However, particular movements of the subject have a greater influence on the accuracy. The effect of varying ambient light was found to have no significant influence on the accuracy of the result.

[96] M.-Z. Poh, D. J. McDuff, and R. W. Picard, “Non-contact, automated cardiac pulse measurements using video imaging and blind source separation,” Optics express, vol. 18, no. 10, pp. 10 762–10 774, 2010.

[124] J. Yao and S. Warren, “A short study to assess the potential of independent component ... (more)

edit flag offensive delete link more



Interesting stuff! Thanks for the papers!

StevenPuttemans gravatar imageStevenPuttemans ( 2015-11-12 05:17:39 -0500 )edit

answered 2015-11-10 21:03:17 -0500

theodore gravatar image

I think that in your case the Eulerian Video Magnification algorithm would help you towards to what you want to achieve.

And a video where you can see the effect

edit flag offensive delete link more


LBerger gravatar imageLBerger ( 2015-11-11 03:34:32 -0500 )edit

@LBerger no I haven't but it seems quite interesting. Thanks for sharing ;-).

theodore gravatar imagetheodore ( 2015-11-11 06:42:57 -0500 )edit

@theodore can you help me to implement this?

LBerger gravatar imageLBerger ( 2016-02-19 13:25:15 -0500 )edit

@LBerger I am quite busy this period but I would be glad to contribute if I can somehow, however I cannot guarantee to you full help :-(. Why you do not open a new thread, I think more people would be interested to help :-). Moreover, I saw that they provide a pseudo code of their algorithm, so it should not be that hard.

theodore gravatar imagetheodore ( 2016-02-20 06:44:51 -0500 )edit
Login/Signup to Answer

Question Tools



Asked: 2015-11-10 20:28:40 -0500

Seen: 1,586 times

Last updated: Nov 11 '15