erdewit / heartwave

Multi-person heart rate measurement from webcam
BSD 2-Clause "Simplified" License
52 stars 8 forks source link

What is the filtered signal and spectrum? #5

Closed hanumanman closed 3 years ago

hanumanman commented 3 years ago

Hello i want to ask what are the filtered signal and spectrum? The filtered signal is obatained after get throught the butterworth and bandpass filter? I can understand that the raw signal is the average of green pixels in the ROI i have read the Remote Detection of Photoplethysmographic Systolic and Diastolic Peaks Using a Digital Camera and they used 3 coler channel but you only use the green channel right? so you do not need the ICA part Thank you for your time. P/S: Sorry if my english is bad

erdewit commented 3 years ago

So yes, the filtered signal is interpolated and bandpass-filtered, as done in https://github.com/erdewit/heartwave/blob/fb96a81c7c911152757ff17a30e8dfe646b1089b/heartwave/person.py#L107

The spectrum is the Fourier transform: https://github.com/erdewit/heartwave/blob/fb96a81c7c911152757ff17a30e8dfe646b1089b/heartwave/person.py#L128 The green channel is used to improve the signal to noise ratio. If you modify the code to use the red channel then you will find that there is virtually no signal. The blue channel does have a signal but with a lot of noise.

hanumanman commented 3 years ago

May i ask how to modify the code so i can get signal from 3 color channel (R,G,B). I tried to modify it but after "pip install heartwave" it still the same Thank you for your time. Respectfully.

erdewit commented 3 years ago

In the file sceneanalyzer.py, the line

        greenIm = frame.image[:, :, 1]

can be replaced with

        import cv2
        greenIm = cv2.cvtColor(frame.image, cv2.COLOR_BGR2GRAY)

greenIm is then not the green but the gray image.

hanumanman commented 3 years ago

When i use the program it usually drops to 45 or jump to 120 really quick (with or without motion) may i ask how to reduce those kind of behaviors?