## 3 Building a GRP Database
### Identification of Contour Points in the Digitized Images  
Digital images of the test artefacts were acquired using a Perfection V39 EPSON flatbed scanner (Seiko Epson Corporation, Nagano, Japan), which integrates a CIS. Each test specimen was placed upside down on the scanner, with the target layer directly on the glass. Scanning was conducted at a resolution of 2400 dpi along both the scanning direction (\(\vec{v}\)) and the direction of the photodetector array (\(\vec{a}\)). As a result, grayscale images were obtained for each test combination, totalling 96 images.  
Before the calculation of the GRPs, it was necessary to identify the reference system of the target layer in the digitized images. To this end, a small reference hole was included at the bottom of the target layer to address the problem of axis orientation associated with the symmetry of its rectangular geometry. The procedure (as depicted in Figure 8) is as follows: (a) detect the circle corresponding to the reference hole; (b) binarize the image using the Otsu algorithm with a threshold of 125 and identify the OCS (long side) and the orthogonal short side of the rectangular target; (c) define two search regions approximately located along the mentioned sides. Once these search regions are defined, the identification of individual contour points on both sides can be performed using the optimal parameters calculated in [29] for a high-contrast scenario: a Canny filter with a noise filter size (\(S_{f}\)) of 19 and a threshold (\(T\)) of 110. After these points are calculated, they are used to define both the \(X_{s}\) and \(Y_{s}\) axes following the same procedure as would be used in a CMM. This reference system (d) will correspond to the one calculated with the CMM.  
Figure 8: Steps followed to determine the \(X_{s}\) and \(Y_{s}\) axes in the digitized image of a test artefact: (a) detection of the reference hole; (b) binarization with Otsu; (c) definition of approximately aligned masks: OCS (red region) and orthogonal short side (red region); (d) final placement of the reference axes (thin red lines).  
Figure 7: Schematic representation of a test artefact and the distribution of points measured with the CMM along the TCS (green dots) and the OCS (red dots).  
Once the local reference system of the target layer has been positioned in the image, the points digitized with the CMM can be translated from the coordinate system of the measuring machine (in mm) to the system of the digitized image (in pixels). However, since an image captured by an optical digital system like a CIS is a distorted representation of reality, it is essential to apply a transformation that accounts for this distortion when adjusting the coordinates of contour points. As explained in [28], global transformations do not fully address the distortion issue, making a local compensation approach a more viable option. In this work, the LDA method described in [28] was employed to address image deformations.  
Utilizing LDA enables the placement of the calculated coordinates for each point (\(P_{i_{TCS}}\)) in the image, thereby facilitating the identification of the grayscale pattern in the local vicinity of the contour point (Figure 9).