Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Any way to output raw PPG signal to calculate HRV metrics? #19

Open
Niteesh-Kalangi opened this issue Oct 9, 2024 · 5 comments
Open

Comments

@Niteesh-Kalangi
Copy link

I am trying to calculate HRV metrics from videos, and I think I need the raw PPG signal to do that. Is there any way I can get the code to output raw PPG signals? I need metrics of {'HR', 'SDRR', 'RMSSD', 'SDSD', 'pNN50'}.

@SamProell
Copy link
Owner

You can run the programm with run-yarppg --savepath=./signals.csv which will write a history of the recorded processor values after the window is closed.

Concerning HRV, you may need to consider that due to the low sampling rate (typically 30 frames per second on a webcam), some parameters may not be very accurate.

@Niteesh-Kalangi
Copy link
Author

I was going to ask, what kind of data does that data outputted represent? Because its not a raw PPG signal right? So what do the columns represent, and how can they be used to get HRV metrics?

@SamProell
Copy link
Owner

SamProell commented Oct 12, 2024

It depends on the algorithm/processor you choose. By default, you get a bandpass-filtered version of the average green channel in the region of interest.

For HRV, you would need to identify the heart beats in the output signal, then calculate the time differences between successive beats (in ECG this would be RR intervals - RRI). Then you could something like neurokit to calculate HRV https://neuropsychology.github.io/NeuroKit/examples/ecg_hrv/ecg_hrv.html

But as I said, many of the features may not make sense due to the low sampling rate.

@Niteesh-Kalangi
Copy link
Author

Also, I see that in the code, you guys calculate heartbeats from peaks in hr.py with the from_peaks method. Could I just use that code and the pulse wave signal values to identify heartbeats and then use that for HRV? Or would you suggest using the outputted csv file for those calculations instead?

@SamProell
Copy link
Owner

I actually just this week updated the repo with a complete rework of the functionality. There is now also a documentation for most of the code.
You can go through the instructions here: https://samproell.github.io/yarppg/video_processing/ to get signal values directly for a video file. You can then detect heartbeats from there to do the HRV.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants