# Camera-Based Vital Sign Estimation Techniques and Mobile App Development
## 2 Materials and Methods
### HR Detection  
We built a noncontact HR measurement system using mobile device cameras (see Supplementary Figure S2). Various mobile devices were used in the experiment. To verify the HR estimated by the camera, HRs were measured simultaneously using a fingertip pulse oximeter, CHOICEMMED's MD300C22, Beijing, China. The images used in the experiment were captured using various smart devices and under various lighting conditions as shown in Table 2. The variables included the illumination environment, acquisition device, image size, and number of frames. Various types of smartphone cameras, laptop cams, and webcams were used as image acquisition devices, and 20 subjects aged 21 to 61 participated in the experiment. The participants stood about 60-90 cm away from the camera and stared at it for about 30 s, with the video frame rate set to 30 fps. To measure the respiratory rate, guided breathing and spontaneous breathing methods were used alternately. Guided breathing meant that the participant breathed according to the breathing pattern displayed on a PC monitor, and spontaneous breathing meant breathing voluntarily regardless of the breathing pattern. The proposed process for the noncontact measurement of the HR using a smartphone camera is shown in Figure 1. The face region was detected in real time using the AdaBoost algorithm [19] and set as the ROI. The proposed HR detection method combines color difference signal amplification and the POS method and is called the CA-POS method in this paper. The RGB image of the facial ROI was converted into color difference signals, \(Cb\) and \(Cr\), which were then amplified [8]. The amplified \(Cb^{\prime}\) and \(Cr^{\prime}\) were calculated as follows. \[Cb^{\prime}=Cb_{c}+S\times(Cb-Cb_{c}) \tag{1}\]  
\[Cr^{\prime}=Cr_{c}+S\times(Cr-Cr_{c}) \tag{2}\]  
where \(Cb_{c}\) and \(Cr_{c}\) represent the average color difference signals of the facial region, and \(S\) represents a scale. Figure 2 shows the changes in color of the images according to the amplification of the color difference signals. It can be seen that the color component of the image increased as the amplification increased. In general, when noise remains constant, increasing the scaling of the color difference signal leads to an improvement in the signal-to-noise ratio (SNR). However, if both the color difference signal scaling and the noise increase simultaneously, the SNR remains nearly unchanged. Close-up images captured with modern smartphone cameras typically yield high SNRs when there is minimal motion. Nevertheless, excessive scaling of the color difference signal may result in color saturation. In this study, the optimal scaling value (\(S\) = 10) was empirically determined within a range that avoids color saturation. Then, the average RGB time signal per frame was calculated by averaging the signal from each RGB channel for the detected face regions. The rPPG signals were detected using the extracted RGB signals per frame and algorithms for the CHROM and POS techniques, which are representative HR estimation methods. Subsequently, the heartbeat frequency was extracted through a frequency analysis of the rPPG signal.