# Unobtrusive Respiratory Flow Monitoring Using a Thermopile Array: A Feasibility Study
## 2 Materials and Methods
### Method
#### 2.2.3 Respiration Signal Extraction and RR Estimation  
Once the pixel is selected, the respiration signal is obtained for each window as:  
\[R(nT_{s})=x_{i_{R_{j}}}(nT_{s}), \tag{4}\]  
where \(i_{R_{j}}\) indicates the pixel selected with the proposed method in the \(j^{\text{th}}\) window.  
To estimate the RR, the Spectral Density (SD) needs to be calculated. SD can be estimated as the squared magnitude of the Fourier spectrum, known as the periodogram method:  
\[P_{PER}(f_{k})=Y_{i}(f_{k})\cdot Y_{i}(f_{k})^{*}=\mid Y_{i}(f_{k})\mid^{2}. \tag{5}\]  
Several other methods have been developed to estimate a more precise SD; Autoregressive (AR) models have already been used to extract respiration from PPG and have shown good potential [28]. AR models are parametric methods for signal modeling and SD estimation. The model assumes that a signal can be modeled based on the weighted sum of \(p\) precedent values. In the spectral domain, in particular, the SD can be estimated as the frequency response of a digital filter:  
\[P_{AR}(f_{q})=\frac{\sigma^{2}T_{s}}{\left|1+\sum\limits_{b=1}^{p}a_{b}exp(-j2 \pi f_{q}bT_{s})\right|^{2}}, \tag{6}\]  
where \(\sigma^{2}\) is the variance of the noise, \(a_{b}\) are the weights of the AR model, and \(p\) is the model order. The weights need to be estimated and the order indicated. Moreover, it should be noted that this parametric model allows the estimation of \(P_{AR}\) in an arbitrary number of points between 0 and \(\frac{1}{2T_{s}}\); therefore, in general, \(f_{q}\) can be different from the previously-defined \(f_{k}\).  
Figure 2: The upper plots show the time domain signal and spectrum of a pixel where no respiratory information is present. The plots on the second row show the time domain and spectrum of another pixel that contains a respiration signal; whereas, the upper figure shows a thermal image where a subject is in a profile view at 20 cm from the sensor, the lower one showing the distribution of the normalized spectrum’s peak calculated per each pixel, i.e., \(\mathbf{M}\) resulting from Equation (3). The pixels containing the signals plotted are indicated. BPM, Breaths Per Minute.  
AR models are not directly affected by the Discrete Fourier Transform (DFT) limitations because they estimate the frequency response directly without implicit windowing and without spectral resolution restrictions. Therefore, AR models have been used especially when spectra need to be estimated on short windows. This parametric method is suited for narrowband signals with medium or high SNRs [29].  
Several methods are available for autoregressive modeling; detailed information can be found in [30]. In this study, [PERSON]'s method was chosen for its stability and accuracy on short data recordings. The model order \(p\) is not known a priori, and since there is no optimal method yet, many methods have been proposed in the years to correctly estimate it [31].  
[PERSON] et al. [32] recently proposed to determine the order by choosing the \(p\) that minimizes the error obtained by comparing the peak of AR's SD and the Fourier spectrum.  
In this study, [PERSON]'s method has been used; the optimal model order was selected for each window, and \(f_{q}\) was chosen to be equal to \(f_{k}\). In Dataset B, the RRs have been estimated with both the AR model and periodogram, to compare the performances. The range of order was empirically chosen and went from 15-30 with a step of 1; whereas, in Dataset A, the periodogram method was used.  
The RR was estimated as the frequency corresponding to the maximum magnitude. Once the RR were estimated, a moving median filter was applied averaging 10 estimations together and allowing us to obtain a new estimation of RR every second. Moreover, the time domain signal was reconstructed by gluing together the segments, as explained in [33].