# _Skin Imaging_: A Digital Twin for Geometric Deviations on Manufactured Surfaces
## 2 Skin Image Methodology  
Skin image generation consists of three main steps:  
I--Deviation-Coordinate System (DCS) generation. II--Skin matrix generation. III--Skin image generation. Moreover, the first step is conducted through five sub-steps:  
I. I--SG estimation: Fit the best substitute geometry to the PCs. I. II--Image-Point finding: Find image of every point on the SG. I. III--DOP calculation: Calculate the deviation of every point from SG. I. IV--Deviation-Plane generation: Localization of the Image-Point on the SG. I. V--Deviation-Coordinate System generation: Assign a corresponding coordinate \(\left(x_{DCS}\quad y_{DCS}\quad z_{DCS}\right)\) for every point with results of two latter sub-steps. Figure 1 illustrates the procedures of skin imaging in a flowchart. The last two main steps are common for _skin image_ generation of any kind of surface, while the first main step (Deviation-Coordinate System generation) differs. The fundamental of _skin imaging_ has been thoroughly explained in [45]. Hence, in the following, a concise explanation is presented:  
I--Deviation-Coordinate System generation on the planar surface:  
Acquiring the PCs of the inspected planar surface, the best ideal surface fitted to the PCs is obtained with Principal Component Analysis (PCA) (I.I-SG estimation). Consequently, the coordinates of the points (in the scanner coordinate system) are mapped to the PCA-coordinate system. According to [45] if \(\left[x^{i}\quad y^{i}\quad z^{i}\right]\) is the coordinate of \(i\)th measured point by the scanner in the scanner coordinate system and \(\mathbf{T}_{4\times 4}\) is the transformation matrix  
Figure 1: Skin image generation steps. obtained with the PCA method, the coordinates of data points in PCA coordinate system \(\left[x_{PCA}^{i}\quad y_{PCA}^{i}\quad z_{PCA}^{i}\right]\) are defined as:  
\[\left[x^{i}{}_{PCA}\quad y^{i}{}_{PCA}\quad z^{i}{}_{PCA}\quad 1\right]=\left[x^{i }\quad y^{i}\quad z^{i}\quad 1\right]\times\mathbf{T} \tag{1}\]  
As Figure 2 illustrates the deviation of the measured point with respect to the fitted plane (SG) is presented as \(z_{PCA}\) (LIII-DOP calculation). In this case, [\(x_{PCA}\)\(y_{PCA}\)] is the position of the Image-Point on the SG (step I.IV). For the planar surfaces, the Deviation-Coordinate System generation step (I.V) is finalized by substituting [\(x_{PCA}\)\(y_{PCA}\)\(z_{PCA}\)] for [\(x_{DCS}\)\(y_{DCS}\)\(z_{DCS}\)]. Moreover, in this case, Deviation-Plane is the same as the fitted best plane. Figure 3 illustrates the general concept of _skin imaging_ together with the Deviation-Coordinate System (DCS). The points in blue color are the corresponding of points the measured PC in DCS that are obtained based on the location of the Image-Points on the Deviation-Plane and DOP of the points. II--Skin Matrix generation:  
The first measure to generate the matrix of the _skin image_ is normalization of the \(X_{DCS}\)-Y\({}_{DCS}\) plane of Deviation-Coordinate System. Then by dividing the normalized plane to the  
Figure 3: _Skin imaging_ methodology with Deviation-Coordinate System (DCS) (Red box is blank pixel). Figure 2: SG estimation for planar surface with illustration of DOP and Image-Point. desired number of grids, the cells (elements) of the matrix are obtained. The deviation of the measured points (DOP in Figure 3) are used to define the value of each element of the matrix such that if a cell of the matrix contains an image-point (black points in Figure 3), the point's deviation is considered as the value of that element. In order to define the value for the elements containing no image-point, e.g., the red cell in Figure 3 (namely blank pixel), interpolation is carried out based on the deviations of the three image-points i.e., P\({}^{\prime}\)1, P\({}^{\prime}\)2 and P\({}^{\prime}\)3 surrounding the cell and make a Barycentric triangle [45].