## 4 Identification of Contour Points in a Manufactured Part  
The process of identifying contour points on a manufactured component begins with digitizing the layer to be inspected using the CIS. The captured image undergoes processing with LDA to compensate for distortions, enabling the conversion of pixel coordinates to component coordinates. To achieve this, it is crucial to establish a reference system for the component, or, more precisely, for the target layer. Determining the reference system from the image involves a procedure like the one used for locating the target-layer origin in reference patterns, as described in the preceding section. However, this determination depends on the geometric attributes of each layer. Consequently, after applying LDA, translating the theoretical positions (obtained from the CAD file) of the contour points in the image becomes straightforward, yielding a set of tentative points close to where the actual contour points should lie (see Figure 12). Figure 11: Representation of the GRP for the different test pieces based on the layer-to-background distance: (**a**) \(H_{\beta}\); (**b**) \(H_{\theta}\); (**c**) \(H_{4}\); (**d**) \(H_{2}\). Figure 10: Calculation of the \(I^{j}_{H,\theta}\) intensity values for \(GRP_{H,\theta}\). This procedure yields a collection of tentative points (\(P_{i}\)), for which their position in the image in pixel coordinates, the theoretical contour orientation (\(\theta\)), and the distance between the target layer and the local background (\(H\)) at each point are already known. Thus, adhering to the same criterion for the vertical/horizontal orientation of GCPs described in the preceding section, it becomes feasible to define the \(ROI_{P_{i}}\) (Figure 12). Each \(ROI_{P_{i}}\) will have a size (\(m\)) significantly larger than the size (\(n\)) of the reference vector \(GRP_{H,\theta}\), allowing for the extraction of every possible CP and its corresponding \(CP_{j}^{P_{i}}\) vector, also \(n\)-sized. As a rule, \(m\) should be large enough to ensure that the position of the tentative point does not differ significantly from the position of the actual contour point to the extent that the latter falls outside the \(ROI_{P_{i}}\), thereby impeding its accurate identification. Given the typical dimensional errors documented in studies such as those published by [PERSON] [14], a region of interest greater than 0.5 mm should be sufficient in most cases, although larger lengths would also be adequate. The degree of similarity between each \(CP_{j}^{P_{i}}\) and the corresponding \(GRP_{H,\theta}\) is evaluated by means of the Euclidean distance (\(d\)), following Equation (4). \[d\left(CP_{j}^{P_{i}},GRP_{H,\theta}\right)=\left\|CP_{j}^{P_{i}}-GRP_{H, \theta}\right\| \tag{4}\]  
The closer the value of \(d\) is to 0, the more similar both vectors are. By evaluating the value of \(d\) across the \(ROI_{P_{i}}\), the algorithm searches for the vector that yields the minimum value, thereby assigning the location of the actual contour point. In the example provided in Figure 13, an \(ROI_{P_{i}}\) consisting of 51 pixels is analyzed using a window size of seven pixels. With this length, the first assessable position is centered on pixel 4 (\(CP_{4}^{P_{i}}\)), which retrieves a \(d\) value of 1.459. Then, the procedure moves to the next position (pixel 5) to extract \(CP_{5}^{P_{i}}\) and calculate its \(d\) value, and it will continue up to pixel 48, since this is the last assessable position given this window size. In this example, the candidate pattern centered in the 25 th pixel yields the minimum value for the Euclidean distance (0), and, consequently, the contour point location will be assigned to that position. This procedure should be repeated for all the previously defined tentative points along the theoretical layer contour, retrieving a collection of contour points. The final step of the algorithm involves applying an outlier filter to remove false positives related to phenomena such as ghostly features, small disturbances, and hindrances.