# Correlation Mapping of Perfusion Patterns in Cutaneous Tissue
## 2 Materials and Methods
### Data Processing  
The data pre-processing process was performed in a MATLAB (The MathWorks, Inc., Natick, MA, USA, version R2021a, update 6). Since the data was saved in.raw format, camera parameters such as resolution, frame rate, or bit resolution are not included in the file. Therefore, this data had to be stored in a separate file during the measurement. In addition, during image processing, this data cannot be read from the file but must be entered manually. The speed of this data processing depends on the type and number of input frames and the number of processes performed on the images required by the user. Storing 12-bit data saves memory space compared to 16-bit and provides more quantization levels compared to 8-bit. However, saving in the 12-bit.raw format has its drawbacks. One of them is the speed of loading data into the MATLAB programming environment. One solution to this problem was to write a custom function to load the data. After the data were read (see Figure 3, stage 1), the frame was rotated so that the leg was oriented vertically. Then, using a rectangular region of interest, the foot was marked where the corner points were detected using a modified KLT algorithm [31; 32]. Subsequently, all images were processed using this tracking algorithm. The KLT algorithm is suitable for the slow motion of the foot. Nonetheless, rapid movements of the fingertips or various muscle twitches could be a problem for the tracker. We saved the processing that resulted in images of the foot sole in TIFF format with the same index as the input (Figure 3, stage 2). The pre-processed images were reloaded as part of further processing when we applied a spatial Gaussian filter. Spatial filtering increases the SNR of the PPGI signal for each pixel [33] (Figure 3, stage 3). The SNR refers to the ratio between the power of the desired output signal and the background noise. Therefore, we can better detect perfusion changes  
Figure 3: Data processing steps. Ordered from the left, stage 1 to stage 5. Figure 2: Stages of the experiment. with an increase in SNR. A two-dimensional approximation of the Gaussian function is defined by (1):  
\[g(x,y)=\frac{1}{2\pi\sigma^{2}}e^{-\frac{x^{2}+y^{2}}{2\sigma^{2}}}, \tag{1}\]  
where \(x\) is the distance from the central pixel in the horizontal axis, \(y\) is the distance from the central pixel in the vertical axis, and \(\sigma\) is the standard deviation of the Gaussian distribution. In our case, the values of \(x\) and \(y\) were the same. Using the averaging function of the moving kernel, the number of pixels is reduced:  
\[r(x,y,t)=\frac{1}{(2K+1)^{2}}\sum_{l_{2}=-K}^{K}\sum_{l_{1}=-K}^{K}v(x+l_{1},y +l_{2},t), \tag{2}\]  
where \(r(x,y,t)\) is the signal from a single pixel with positions \(x\) and \(y\), \(K\) is the distance from the central point of the kernel to the edge, and \(v\) is a three-dimensional matrix of input points. The extracted signals contain a component associated with changes in cutaneous tissue perfusion, which are also related to cardiac activity. A band-pass finite response filter (FIR) with cut-off frequencies of 0.8 Hz and 8 Hz was applied to these signals, yielding an alternating component referred to as AC. Similarly, a low-pass FIR with a cut-off frequency of 0.3 Hz was used to obtain a DC component. Hence, the waveforms of the PPGI signals were extracted from a mask of size 19 \(\times\) 19 px\({}^{2}\) (Figure 3, stage 4). Subsequently, we calculated a normalization coefficient:  
\[n(x,y)=\frac{\overline{r}_{\rm AC}(x,y)}{\overline{r}_{\rm DC}(x,y)}, \tag{3}\]  
where \(\overline{r}_{\rm AC}(x,y)\) is the mean value of the AC component of the signal and \(\overline{r}_{\rm DC}(x,y)\) is the mean value of the DC component. Subsequently, the input signals were multiplied by a normalization coefficient, which ensured that the perfusion measurements were invariant to the intensity of the incident light. The normalized signals were then filtered again using a band-pass FIR filter (with cut-off frequencies \(f_{1}\) = 0.8 Hz and \(f_{2}\) = 4 Hz).