webcam-pulse-detector icon indicating copy to clipboard operation
webcam-pulse-detector copied to clipboard

How to smooth data

Open connormeaton opened this issue 4 years ago • 2 comments

When plotting the output from your program, it produces a waveform like this:

Screen Shot 2020-08-20 at 10 51 39 AM

I understand this output is more sensitive than an on-finger bpm reader, but with a little imagination the waveform looks similar to what is produced by my on device, like this:

Screen Shot 2020-08-20 at 10 54 13 AM

The waveform on the pulse reader is ultimately transformed to give 1 value as the bpm. Any idea how this transformation is completed? In other words, how do I transform the output from your model to give a reliable, stable bpm? I've tried aggregating at varying levels (1 sec, 2 sec, etc.) with different statistics (mean, min, max, mode), but these values rarely match my on-finger device.

The closest your model gets to my on-finger device is at the local minima on the waveforms. Is this the value I should select for?

Thanks!

connormeaton avatar Aug 20 '20 17:08 connormeaton

@cmeaton I would suggest reading up on digital signal processing. This task seems well suited to an application of the Kalman filter.

e.g. https://scipy-cookbook.readthedocs.io/items/KalmanFiltering.html

keyan avatar Sep 02 '20 17:09 keyan

@keyan IIUC, the Kalman filter estimates smoothed data by considering observed data and an a prior model. What I don't understand is how to determine the a priori model in this case. Is it a manually-defined expected range of values, or something determined statistically?

connormeaton avatar Sep 02 '20 22:09 connormeaton