# Non-Contact SpO2 Prediction System Based on a Digital Camera
## 3 Materials and Methods
### System Overview  
In this section, we discuss the image and signal processing techniques that were designed to extract the relevant wavelengths from the selected forehead signal and eliminate noise artefacts embedded in the image spatial domain. These techniques include a face detection method, a signal decomposition technique, the ICA technique, a spectral analysis method and finding local maxima of the extracted signals. The overall system design of the non-contact SpO2 prediction system is illustrated in Figure 3.  
After converting the videos into frames, the skin detection algorithm based on skin tone was applied on the first frame to select the ROI automatically. The algorithm returned the bounding box of the skin portion, especially the face, and the ROI was detected automatically based on skin tone. This process was repeated for all frames. In the skin detection algorithm, the RGB image was converted to the LAB device-independent colour space transformation, as this colour space is useful for image segmentation, as shown in Figure 4a. The A (red-green) and B (yellow-blue) components of this colour space (see Figure 4b,c) were chosen and then converted into binary images, as shown in Figure 4d,e. Image binarisation was done based on the gray image threshold histogram method. After that, binary images were multiplied and AND logic was performed on the image, as shown in Figure 4f. Figure 2: Video recordings from two participants using Nikon 3500 digital camera. Figure 4: Skin detection. (**a**) LAB colour space, (**b**) A channel of the LAB colour space, (**c**) B channel of the LAB colour space, (**d**) binary image of the A channel, (**e**) binary image of the B channel, (**f**) multiplied image of binary images. Figure 3: Overall system design of the non-contact SpO2 prediction. As a result, a matrix was obtained having 1 and 0. One (1) indicated the presence of skin. Thus, facial ROI could be detected automatically, followed by determining face border points to select the forehead, as shown in Figure 3.  
After that, the red and green channels could be represented by the brightness of the colour images as follows: [41; 42]:  
\[R=\int E_{\lambda}S_{R}\;d\lambda, \tag{3}\]  
\[G=\int E_{\lambda}S_{G}\;d\lambda, \tag{4}\]  
where \(E_{\lambda}\) is the light spectrum, and \(S_{R}\) and \(S_{G}\) are the sensitivity functions of the red and green channels at a wavelength of \(\lambda\). The average time-series signal of the brightness pixel values for the red and green channels can be expressed as [28; 43]  
\[i_{R}\;(t)=\frac{\sum_{x,y\in ROI}F\;(x,y)}{|ROI|} \tag{5}\]  
\[i_{G}\;(t)=\frac{\sum_{x,y\in ROI}F\;(x,y)}{|ROI|} \tag{6}\]  
where \(F(x,y)\) is the brightness pixel value at a location \((x,y)\) from the red and green channels, and \(|ROI|\) is the pixel area of the selected forehead ROI, where the average value for each channel is in a range from 0 to 255. The average pixel signals from both channels are illustrated in Figure 5.  
The next processing stage consisted in using a complete EEMD method [38]. This decomposition technique is commonly used to remove noise artefacts from biomedical signals [44; 45; 46]. Using this technique, \(i_{R}\;(t)\) and \(i_{G}\;(t)\) were composed into a set of signals with different frequency scales, called intrinsic mode functions (IMFs), as shown in Figures 6 and 7. Figure 2:0 Average pixel signals for the red and green channels. Figure 2:1 Signal decomposition of \(i_{R}\left(t\right)\) using a complete EEMD technique with 100 realisations and 100 iterations with 0.2 noise standard deviation. Figure 2:2 Signal decomposition of \(G\left(t\right)\) using a complete EEMD technique with 100 realisations and 100 iterations with 0.2 of noise standard deviation. In order to estimate oxygen saturation, we used the low-frequency IMF5 from the red channel and the high-frequency IMF2 from the green channel that is representative of the infrared wavelength used in traditional pulse oximetry.