habom2310 / Heart-rate-measurement-using-camera

real time application to measure heart rate
Apache License 2.0
433 stars 142 forks source link

Discuss how to make it robust #5

Closed Andyeyeye closed 5 years ago

Andyeyeye commented 5 years ago

Hi Habom, I'm studying in this area and writing my code inspired by your code. It's a great job! However, I got several questions and wanna discuss with you. First, some paper indicate that using PCA or ICA can get better result. Have you ever try it? I don't know how PCA or ICA works. Do you have any ideas? Second, since bpm is from green channel value, is Eulerian Video Magnification helpful? Or in the way, can we find a better combination between RGB channels not to just use green channel? Also, why do you use green channel? Is it same as PPG? Third, I don't know why you set the buffer size to 100. I tried other numbers but I don't know what the difference is. I know it means that start calculating bpm after we got 100 green channel values in 100 frames. But why 100? At last, I tried to make this algorithm robust, but I found that bpm is up and down very sharply and I cannot fully trust it. Therefore I turn to calculate average bpm in every second, but it's just a strategy not a solution. Also, your result in 'new update' repo is strange cause bpm is going down like a linear function. Is it a right trend of heart rate?

Thanks for reading my questions and very welcome to discuss anything with me!

habom2310 commented 5 years ago
  1. I've already tried the PCA and ICA but the signals I got after that are not stable and I can not get good fft signals. Maybe it's because I implemented it wrong, you can try it yourself.
  2. About the green channel, there are papers talking about that, you can see here. It's because of blood absorption characteristic, where green is most absorbed so it is easier to see changes in green channel. Combining all three channels somehow reduces the significant changes in the signal.
  3. Buffer size depends on your machine's performance. Higher buffer size results in higher accuracy but decrease in speed. For example, I got buffer size of 100 and fps=15, it means that the buffer contains information of about 7 seconds in real life. As I tried, keeping a buffer size that contains the information of for more than 10 seconds in real life gives good results.
  4. New update with video mode can have some strange results, I'll have a look later.