# Camera-Based Vital Sign Estimation Techniques and Mobile App Development
## 2 Materials and Methods
### SpO2 Detection  
Blood contains hemoglobin, which is a compound of iron-containing heme and the protein globin. Oxidized hemoglobin reflects red light while significantly absorbing green light. For this reason, changes in the amount of oxygen in the blood can be modeled using the reflected intensity of the green channel. The PPG amplitude differs according to the wavelength (see Supplementary Figure S5). The noncontact oxygen saturation estimation method proposed in this paper uses the ratio of the green light absorption characteristics to the red light reflection characteristics of oxidized hemoglobin.  
The proposed process for the noncontact measurement of the SpO2 using a smartphone camera is shown in Figure 4. The SpO2 measurement, using the estimated HR with high reliability, was measured simultaneously to the HR measurement. Only two RGB channels (R and G) were used for the SpO2 measurement.  
Figure 4: Proposed smartphone camera-based SpO2 measurement process.  
Figure 3: Filter sequence for HR extraction.  
The process of extracting the R, G, and B time signals from the image obtained using a smartphone camera was the same as that for HR detection. Similarly, the ROI was detected using a face-tracking algorithm. The ROI only included the skin, including that of the face. Subsequently, the RGB time signals for the detected skin area were calculated by averaging the signal from each of the three RGB channels.  
The R and G signals contained temporal noise such as lighting flicker; therefore, time moving average processing was performed to remove it, as shown in Figure 5, extracting the noise-containing R and G signals by moving one frame at a time for 32 frames (1.6 s). In the figure, R1\(\rightarrow\)32 indicates the result of averaging the R signal from the 1 st frame to the 32 nd frame.  
Despite implementing time moving average processing, the noise was not sufficiently removed from the R and G signals; therefore, a power spectral density (PSD) analysis was performed on these signals using a periodogram. A periodogram is primarily used for the frequency analysis of signals containing random noise. To obtain the periodogram, as shown in Figure 6, the time signal is overlapped and separated into N pieces using a window function, such as a Hamming window.  
A periodogram was obtained by averaging the PSDs of each temporally separated signal. Because the PSD can be obtained by using an FFT and squaring the time signal, the corresponding periodogram can be expressed as follows:  
\[\frac{1}{N}\sum_{i=1}^{N}|FFT\ amplitude(i)|^{2} \tag{3}\]  
The PSD of R and G obtained from the periodogram indicated a peak at the HR frequency. Because a single PSD includes random frequency components, determining a clear peak frequency is difficult. However, if N PSDs are averaged using a periodogram, then the noise frequency components cancel each other out, and the HR frequency component  
Figure 5: Time moving average processing procedure for noise removal.  
Figure 6: Time division to obtain periodogram.  
can be maintained. In addition, because the HR frequency was extracted using a highly reliable HR detection algorithm such as the POS algorithm, the corresponding PSD value was used as the AC value, while the PSD value for a frequency of 0 was used as the DC value. Therefore, at the two wavelengths used to obtain the SpO2, the absorption factor Ka could be estimated as follows:  
\[K_{a}=\frac{\mu(K_{R})}{\mu(K_{G})}=\frac{AC_{\lambda_{G}}/DC_{\lambda_{G}}}{AC_{ \lambda_{G}}/DC_{\lambda_{G}}} \tag{4}\]  
The expression for the calculation of the SpO2 using the formula above was as follows:  
\[\text{SpO2}=A-BK_{a}, \tag{5}\]  
where \(A\) and \(B\) are constant values obtained empirically obtained through experiments.