I have been able to process video data of myself sleeping using a Wyze camera to produce fairly solid data that I would like to use to calculate breaths per minute.The actual calculation is trivial. I calculate the percent change an image is different from a keyframe where 0 is the same image, and 1% is N/(Width * Height * 256). I create a threshold for percent difference and trigger a retaking of the keyframe and a slight pause in the data processing.
Using a discrete fourier transform I get a good result.
So I can clearly see the FFT is yielding a string signal, but I am unsure how to convert this properly to a breaths per minute calculation. I capture timestamps of the data as I am processing it as a CSV, but when I take windows of the data the position of the spike in the FFT changes, so I think my understanding of what a discrete fourier transform calculates is naive. I know typical sleeping breaths per minute is around 12 ~20 BPM. But the relationship between the actual frequency and the result of the FFT is abstract. I have wanted to attempt this for awhile, but was inspired to give it a try when I say the most recent julia video for DFT
I think my next steps should be using DSP.jl, but I have no idea how to use it. The documentation describes the functions, but I am unable to find examples. Main point being I want to know what methods or libraries I can use to pull the dominant frequencies from the signal in real time domain. I am an amateur programmer and signal processor, and haven’t had to do differential equations for about 10 years, but I find it all fascinating and stimulating. Would appreciate any help.