Image Analysis Techniques Applied in the Drilling of a Carbon Fibre Reinforced Polymer and Aluminium Multi-Material to Assess the Delamination Damage

: Due to the high abrasiveness and anisotropic nature of composites, along with the need to machine different materials at the same time, drilling multi-materials is a difficult task, and usually results in material damage, such as uncut fibres and delamination, hindering hole functionality and reliability. Image processing and analysis algorithms can be developed to effectively assess such damage, allowing for the calculation of delamination factors essential to the quality control of hole inspection in composite materials. In this study, a digital image processing and analysis algorithm was developed in Python to perform the delamination evaluation of drilled holes on a carbon fibre reinforced polymer (CFRP) and aluminium (Al) multi-material. This algorithm was designed to overcome several limitations often found in other algorithms developed with similar purposes, which frequently lead to user mistakes and incorrect results. The new algorithm is easy to use and, without requiring manual pre-editing of the input images, is fully automatic, provides more complete and reliable results (such as the delamination factor), and is a free-of-charge software. For example, the delamination factors of two drilled holes were calculated using the new algorithm and one previously developed in Matlab. Using the previous Matlab algorithm, the delamination factors of the two holes were 1.380 and 2.563, respectively, and using the new Python algorithm, the results were equal to 3.957 and 3.383, respectively. The Python results were more trustworthy, as the first hole had a higher delamination area, so its factor should be higher than that of the second one.


Introduction
Image processing and analysis techniques are based on mathematical functions to achieve the intended outcomes for the desired task [1].Nowadays, many of the advanced engineering developing software tools, such as Matlab (MathWorks, Natick, MA, USA), version 2019 B, or Python (Python Software Foundation, Wilmington, DE, USA), version 5.1.5., already include many of these functions, and the algorithms developed almost only depend on the correct combination of these available functions.Four primary focus areas are usually considered in image processing and analysis: image improvement or enhancement, image restoration, image compression, and image analysis.These focus areas are typically associated with artificial intelligence and are usually designated as computer vision [2].The first and last areas are the most important in multi-material drilling processes.In the image improvement or enhancement process, the characteristics of the input image are improved, for example, by accentuating the contrast and reducing the noise.On the other hand, image analysis aims to interpret a given image by measuring or classifying its properties.These techniques can be applied in various fields, such as engineering, science, and healthcare [3].
Usually, the first step in image processing is to convert the input colour image into a grayscale image to simplify the following steps.Afterward, a noise-smoothing technique may be applied to remove unwanted elements in the image surrounding the object(s) of interest, which can be achieved using, for example, a bilateral filter [4] or low-pass filter [5].Another helpful technique to improve the input image's quality is contrast stretching [6], which increases the contrast between the darkest and brightest regions in the image while preserving the relative differences among the intermediate values.The intensity of the pixels of the object of interest can also be enhanced using sharpening or histogram equalization techniques [7] by modifying the image's intensity distribution based on its histogram or using a high-pass filter.
Another essential function in image processing is the erosion operation, commonly used to erode the boundaries of the object of interest in an image.It can be used, for example, to remove noise, to isolate individual elements, or to reduce the object's size.In the same area, the dilation operation is often used to expand the object's boundaries in a binary image.It can also be used to fill gaps, to connect broken objects, or to increase the object's size.Both have an "iterations" parameter, specifying how often the techniques are applied to the image and how they can be increased to intensify their result [8].
In many applications, after image pre-processing, it becomes necessary to apply the thresholding technique [9], which is the simplest method for performing image segmentation.This technique turns the image into a binary form so that a specific region of interest (ROI) of the image can be emphasised and its subregions can be uniformised.Some other important techniques usually used for this task include the Hough transform technique [10], to detect geometric shapes in images, such as circles; the snake algorithm [11], to find the contour that best approximates the border of an object; and the level set model for image segmentation [12], which implements a geometric active segmentation contour model.From a boundary detection perspective, the Canny, Prewitt, Roberts, and Sobel edge detectors [13,14] are some of the most used operators that perform contour detection in the image under study, using an approximation of its intensity gradient through finite differences.For image analysis, the region-growing algorithm [15] is commonly used to segment image regions by growing a region from a seed point, and then measurements can be obtained from a particular region, allowing for further analyses.
Due to the many possibilities that the usual image processing and analysis techniques offer in solving real-world problems, different applications exist to put them into practice.These range from the automatic evaluation of metallographic microstructure phases [16] and surface characterisations [17] to damage detection in parts resulting from mechanical tests [18] or manufacturing processes in engineering.In the scope of drilling composites and multi-materials, mainly by a combination of composite and metal, several damages usually arise, such as burrs and fibre delamination.This happens mainly due to composite materials' anisotropic nature, making it harder to perform a clean cut.This property, along with the high abrasiveness of the composite fibres and the drill's need to cut through different materials simultaneously, causes severe tool wear, leading to an imperfect surface on the hole's border [19].This kind of damage may sometimes go unnoticed in high batch production, which could have catastrophic consequences, especially for this process' most frequent applications, the aeronautical and automotive industries [20].
To quantify the hole delamination, some criteria have been proposed in the literature relating the key properties of the damaged regions and those of the original hole.These can comprise just the diameter (F d ), introduced by Chen et al. [21] in 1997, or just the area (F a ), presented for the first time by Mohan et al. [22] in 2007.Later, in the same year, Davim et al. [23] suggested an improved version of the delamination measurement, the adjusted delamination factor (F da ), which is considered a better approximation of reality by combining the diameter and the area at the same time.This can be expressed as: where D nom and A nom correspond to the nominal hole's diameter and area (in mm and mm 2 , respectively), D max and A max to the maximum delamination diameter and area considering the maximum diameter (in mm and mm 2 , respectively), and A d to the actual delamination area (in mm 2 ) (Figure 1).If the damage around the hole is circular and has a low amplitude, it is not completely considered in the F d approach, and the same happens for the F a if there is just a thin crack or a damaged peak but without a great area.That is why the adjusted delamination factor, F da , provides a more complete and more reliable result.
relating the key properties of the damaged regions and those of the original hole.These can comprise just the diameter ( ), introduced by Chen et al. [21] in 1997, or just the area ( ), presented for the first time by Mohan et al. [22] in 2007.Later, in the same year, Davim et al. [23] suggested an improved version of the delamination measurement, the adjusted delamination factor (  ), which is considered a better approximation of reality by combining the diameter and the area at the same time.This can be expressed as: where  and  correspond to the nominal hole's diameter and area (in mm and mm 2 , respectively),  and  to the maximum delamination diameter and area considering the maximum diameter (in mm and mm 2 , respectively), and  to the actua delamination area (in mm 2 ) (Figure 1).If the damage around the hole is circular and has a low amplitude, it is not completely considered in the  approach, and the same happens for the  if there is just a thin crack or a damaged peak but without a great area.That is why the adjusted delamination factor,  , provides a more complete and more reliable result.Several studies assess delamination damage in composite materials using image processing and analysis techniques to identify if the non-conformities are within the acceptable limits imposed by the industry quality patterns.Durão et al. [24] used damage assessment image-based methods through computational processing of data extracted from radiographic images and compared them with mechanical test results, bearing and delamination assessment tests, and analytical models, obtaining valuable information regarding the delamination extension and mechanical strength of the drilled parts.In more recent studies, Durão et al. [25] and Devesa et al. [26] used similar methods to calculate the fractal dimension of the damaged region's boundary.Geier et al. [27] predicted drilling-induced burr occurrence in CFRP composites using image processing and analysis by studying the fibre orientation in CFRP sections and their local properties achieving an accuracy of 64-97% compared to real drilling experiments.Alejandro et al [28] also autonomously inspected drilled holes in CFRP panels using image processing and analysis techniques to determine the geometric errors and delamination factors for several holes and compared them with experimental results.Despite most delamination assessment approaches through image processing and analysis techniques being applied in just plain composites, machined multi-material processing has been gaining relevance in recent years, even if only a few studies exist on this topic.Isbilir and Ghassemieh [29]  Several studies assess delamination damage in composite materials using image processing and analysis techniques to identify if the non-conformities are within the acceptable limits imposed by the industry quality patterns.Durão et al. [24] used damage assessment image-based methods through computational processing of data extracted from radiographic images and compared them with mechanical test results, bearing and delamination assessment tests, and analytical models, obtaining valuable information regarding the delamination extension and mechanical strength of the drilled parts.In more recent studies, Durão et al. [25] and Devesa et al. [26] used similar methods to calculate the fractal dimension of the damaged region's boundary.Geier et al. [27] predicted drilling-induced burr occurrence in CFRP composites using image processing and analysis by studying the fibre orientation in CFRP sections and their local properties, achieving an accuracy of 64-97% compared to real drilling experiments.Alejandro et al. [28] also autonomously inspected drilled holes in CFRP panels using image processing and analysis techniques to determine the geometric errors and delamination factors for several holes and compared them with experimental results.Despite most delamination assessment approaches through image processing and analysis techniques being applied in just plain composites, machined multimaterial processing has been gaining relevance in recent years, even if only a few studies exist on this topic.Isbilir and Ghassemieh [29] studied the hole's quality and respective delamination factors of drilled CFRP/titanium stacks using image processing and analysis techniques, and Marques et al. [30] successfully determined the delamination factors of holes in drilled composite and aluminium (CFRP/Al) multi-materials via computational analysis of X-ray images.Several non-destructive tests could acquire images of the hole and surrounding areas for the damage extension analysis and evaluation, such as radiogra-phy, ultrasound, acoustic emission, C-scan, and computer tomography (CT) [24].Despite this, the delamination damage was typically assessed using X-ray radiography, as it is the cheapest and most easily accessible imaging modality.
The problem is that the common software used to assess drilled multi-material hole damage had some gaps.For example, in many of them, the original hole images required manual pre-editing to obtain consistent results, which were sometimes incorrect, nonetheless.They also required several user inputs of key functions that, if wrongly selected, led to problems in their functioning.Additionally, the main limitation of solutions developed in Matlab is that it is a paid software, whereas those developed in Python have no such limitation and can be improved easily with new functions associated with the Python libraries that appear every day.Therefore, the objective of this work consisted in the development of an algorithm in Python with an intuitive interface, i.e., an enhanced graphical user interface (GUI), which uses image processing and analysis techniques to obtain comprehensive information about the quality of drilled holes in CFRP/Al multi-material, namely the extent of delamination, from X-ray images.The algorithm was then compared to a previous algorithm developed in Matlab to confirm its superior performance, mainly in terms of image improvement and accuracy of delamination factors.For this, it was necessary to perform the division of the problem under study into two main steps:

•
Image processing, where the input image was firstly improved by enhancing its most relevant features and via contrast refinement and noise smoothing to retain only the regions of interest with enhanced quality.

•
Image segmentation and analysis, where the region of interest was selected through proper thresholding and finally assessed, resulting in the evaluation of the hole's damage based on delamination factors derived from its perimeter and area.

Image Acquisition
This work was based on a drilling campaign using a DMG Mori DMU 60 eVo (DMG Mori, Bielefeld, Germany) CNC machine on a three-layered multi-material (CFRP/Al/CFRP) with a 4.5 mm thickness, using a 6 mm diameter conventional twist drill with a point angle of 120 • and helix angle of 30 • .The multi-material was evenly distributed, with each layer having a thickness of 1.5 mm.The metal used was Al2024-T3, and the composite was a cross-ply (0/90 • ) with a thermosetting matrix (epoxy) composed of 7 plies.
For the acquisition of the intended images from the drilled holes, a radiography system associated with a Kodak RVG 5100 (Eastman Kodak Company, Rochester, NY, USA) digital sensor was used, Figure 2a, since the X-ray could effectively pass through both the CFRP and aluminium, revealing the damage present in them, as has been considered in several studies in the literature.Two foam supports were used on both sides of the sensor for the stacks' stability and to ensure that all the images were obtained with the same distances between the sensor and the plate and the sensor and the emissary.Firstly, the samples were immersed in a contrasting liquid, Analar Normapur Diiodomethane, for 30 min.Thus, when the X-ray system was employed, it revealed the zones where the liquid penetrated the delamination areas, which were clearly distinguished from the unaffected material because the liquid was opaque to radiography.As already mentioned, a Satelec X-mind radiography system was used, Figure 2b, with a 0.16 s exposition time, alongside the image acquisition software in Matlab and Python languages.

Algorithm Pipeline
Python was used to develop the image processing and analysis algorithm, mainly to identify the ROIs, i.e., the hole and damaged areas, and assess them.Its main steps consisted of image processing to determine the damaged and hole regions, image segmentation to determine the ROIs, and image analysis to calculate the delamination factors (Equations ( 1)-( 3)).Finally, the results were shown to the user.The scheme in Figure 3 depicts the tasks performed in the novel algorithm.The development was based on the defined objectives and a literature search for Python functions that could be used to address the tasks involved.Combining different functions to obtain the desired outcome was possible with a trial-and-error method.

Algorithm Pipeline
Python was used to develop the image processing and analysis algorithm, mainly to identify the ROIs, i.e., the hole and damaged areas, and assess them.Its main steps consisted of image processing to determine the damaged and hole regions, image segmentation to determine the ROIs, and image analysis to calculate the delamination factors (Equations ( 1)-( 3)).Finally, the results were shown to the user.The scheme in Figure 3

Algorithm Pipeline
Python was used to develop the image processing and analysis algorithm, mainly to identify the ROIs, i.e., the hole and damaged areas, and assess them.Its main steps consisted of image processing to determine the damaged and hole regions, image segmentation to determine the ROIs, and image analysis to calculate the delamination factors (Equations ( 1)-( 3)).Finally, the results were shown to the user.The scheme in Figure 3 depicts the tasks performed in the novel algorithm.The development was based on the defined objectives and a literature search for Python functions that could be used to address the tasks involved.Combining different functions to obtain the desired outcome was possible with a trial-and-error method.

Algorithm Comparison 3.1. Previous Algorithm
With the previous image processing and analysis algorithm developed in Matlab, when a new image is given as the algorithm's input, the first step is to manually choose the ROI's borders using a two-step selection grid, Figure 4, so that the algorithm may restrict the analysis to the specified region.From this selection and based on a conversion factor from pixels to millimetres (mm) that the user needs to update in the algorithm code before running it, the hole's radius is calculated first in pixels and then in mm.

Previous Algorithm
With the previous image processing and analysis algorithm developed in Matlab, when a new image is given as the algorithm's input, the first step is to manually choose the ROI's borders using a two-step selection grid, Figure 4, so that the algorithm may restrict the analysis to the specified region.From this selection and based on a conversion factor from pixels to millimetres (mm) that the user needs to update in the algorithm code before running it, the hole's radius is calculated first in pixels and then in mm.Afterward, the algorithm suggests a threshold that usually never corresponds to the intended one.It is either too high, as in Figure 5a, meaning that almost no delamination is detected and the hole circle is not entirely detected, or too low, as in Figure 5b, with unwanted noise surrounding the hole's region and disrupting the real delamination analysis.Therefore, the algorithm asks the user if the threshold is acceptable, and if the user declines it, the algorithm then asks the user to choose another value in an iterative method until a satisfying result is obtained, as in Figure 5c.Thus, an adequate threshold needs to be selected by the user based on visual analysis, otherwise, the delamination factors are miscalculated.Then, if the user accepts the threshold, it is necessary to zoom in on the image and press a random keyboard key.The problem is that the user can only determine that a pixel on the hole's border needs to be selected after pressing the key, and the user cannot zoom the image out at this step.Hence, an error occurs if a bad selection is made, and the process Afterward, the algorithm suggests a threshold that usually never corresponds to the intended one.It is either too high, as in Figure 5a, meaning that almost no delamination is detected and the hole circle is not entirely detected, or too low, as in Figure 5b, with unwanted noise surrounding the hole's region and disrupting the real delamination analysis.Therefore, the algorithm asks the user if the threshold is acceptable, and if the user declines it, the algorithm then asks the user to choose another value in an iterative method until a satisfying result is obtained, as in Figure 5c.Thus, an adequate threshold needs to be selected by the user based on visual analysis, otherwise, the delamination factors are miscalculated.

Previous Algorithm
With the previous image processing and analysis algorithm developed in Matlab, when a new image is given as the algorithm's input, the first step is to manually choose the ROI's borders using a two-step selection grid, Figure 4, so that the algorithm may restrict the analysis to the specified region.From this selection and based on a conversion factor from pixels to millimetres (mm) that the user needs to update in the algorithm code before running it, the hole's radius is calculated first in pixels and then in mm.Afterward, the algorithm suggests a threshold that usually never corresponds to the intended one.It is either too high, as in Figure 5a, meaning that almost no delamination is detected and the hole circle is not entirely detected, or too low, as in Figure 5b, with unwanted noise surrounding the hole's region and disrupting the real delamination analysis.Therefore, the algorithm asks the user if the threshold is acceptable, and if the user declines it, the algorithm then asks the user to choose another value in an iterative method until a satisfying result is obtained, as in Figure 5c.Thus, an adequate threshold needs to be selected by the user based on visual analysis, otherwise, the delamination factors are miscalculated.Then, if the user accepts the threshold, it is necessary to zoom in on the image and press a random keyboard key.The problem is that the user can only determine that a pixel on the hole's border needs to be selected after pressing the key, and the user cannot zoom the image out at this step.Hence, an error occurs if a bad selection is made, and the process Then, if the user accepts the threshold, it is necessary to zoom in on the image and press a random keyboard key.The problem is that the user can only determine that a pixel on the hole's border needs to be selected after pressing the key, and the user cannot zoom the image out at this step.Hence, an error occurs if a bad selection is made, and the process must be reinitiated to continue.A similar process starts for the user to select a pixel on the delamination contour.Figure 6a and Figure 6b represent the hole and delamination contour detection, respectively, on the top left corner region of the image in Figure 5c.At the final step of running the previous algorithm, it returns three images, one highlighting the hole region, Figure 7a, another representing the hole and damaged regions merged, Figure 7b, and finally, the binary image to be assessed, Figure 7c.Alongside these visual representations, the delamination factor values are presented to quantify the damage from the drill effect on the hole's periphery.

Novel Algorithm
Considering the operational concerns mentioned earlier, a new algorithm needed to be developed, to enable easier operation and better result accuracy.Thus, a new set of steps was designed as follows:

•
Image processing to determine the damaged and hole regions, i.e., image segmentation or determination of the ROIs.

•
Showing the results to the user.Figure 8 shows an example of a grayscale image imported to the new Python algorithm.At the final step of running the previous algorithm, it returns three images, one highlighting the hole region, Figure 7a, another representing the hole and damaged regions merged, Figure 7b, and finally, the binary image to be assessed, Figure 7c.Alongside these visual representations, the delamination factor values are presented to quantify the damage from the drill effect on the hole's periphery.At the final step of running the previous algorithm, it returns three images, one highlighting the hole region, Figure 7a, another representing the hole and damaged regions merged, Figure 7b, and finally, the binary image to be assessed, Figure 7c.Alongside these visual representations, the delamination factor values are presented to quantify the damage from the drill effect on the hole's periphery.

Novel Algorithm
Considering the operational concerns mentioned earlier, a new algorithm needed to be developed, to enable easier operation and better result accuracy.Thus, a new set of steps was designed as follows:

•
Image processing to determine the damaged and hole regions, i.e., image segmentation or determination of the ROIs.

•
Showing the results to the user.Figure 8 shows an example of a grayscale image imported to the new Python algorithm.

Novel Algorithm
Considering the operational concerns mentioned earlier, a new algorithm needed to be developed, to enable easier operation and better result accuracy.Thus, a new set of steps was designed as follows:

•
Image processing to determine the damaged and hole regions, i.e., image segmentation or determination of the ROIs.

•
Calculating the delamination parameters: F d , F a , F da .

•
Showing the results to the user.

Image Segmentation-Determination of the ROI
The best way to analyse an image is to look at its histogram, like the one in F The histogram shows the number of pixels along each bright intensity.The origin essentially contained three groups of pixels, black, grey, and white, which could lysed in the peaks of the respective histogram (Figure 9a) although the last o nearly 250 bins, was not very pronounced.To automatically determine the thres dicated for each image, the value of each peak was calculated, Figure 9b, with onl range given to define the values of that peak.The purpose of these two graphic show the approach used in the algorithm to identify the hole and damaged regio The images in Figure 10 were obtained from the histogram data.Figures 10a resulted from the values of the peaks identified in Figure 9, showing the hole a aged regions, respectively, by simply applying a threshold to those values give spective interval.Figure 10c combines Figures 10a and 10b, showing the hole a aged regions.

Image Segmentation-Determination of the ROI
The best way to analyse an image is to look at its histogram, like the one in Figure 9a.The histogram shows the number of pixels along each bright intensity.The original image essentially contained three groups of pixels, black, grey, and white, which could be analysed in the peaks of the respective histogram (Figure 9a) although the last one, with nearly 250 bins, was not very pronounced.To automatically determine the threshold indicated for each image, the value of each peak was calculated, Figure 9b, with only a small range given to define the values of that peak.The purpose of these two graphics was to show the approach used in the algorithm to identify the hole and damaged regions.

Image Segmentation-Determination of the ROI
The best way to analyse an image is to look at its histogram, like the one in Figure 9a.The histogram shows the number of pixels along each bright intensity.The original image essentially contained three groups of pixels, black, grey, and white, which could be analysed in the peaks of the respective histogram (Figure 9a) although the last one, with nearly 250 bins, was not very pronounced.To automatically determine the threshold indicated for each image, the value of each peak was calculated, Figure 9b, with only a small range given to define the values of that peak.The purpose of these two graphics was to show the approach used in the algorithm to identify the hole and damaged regions.The images in Figure 10 were obtained from the histogram data.Figures 10a and 10b resulted from the values of the peaks identified in Figure 9, showing the hole and damaged regions, respectively, by simply applying a threshold to those values given the respective interval.Figure 10c combines Figures 10a and 10b, showing the hole and damaged regions.The images in Figure 10 were obtained from the histogram data.Figure 10a,b resulted from the values of the peaks identified in Figure 9, showing the hole and damaged regions, respectively, by simply applying a threshold to those values given the respective interval.Figure 10c combines Figure 10a,b, showing the hole and damaged regions.In the case of Figure 11, two different filters were applied to the original image.The Canny filter is commonly used to find objects' edges in images.This filter was tested, and examples of its results are shown in Figure 11a.Since this filter only shows the hole's edges, and there can be cases where the edges are not all closed, and there are gaps in the objects' borders, basic morphological filters were tested to improve the results.The combination of dilation and erosion operators after applying the Canny filter was the method that improved the results the most, Figure 11b.Figure 12a depicts the result of combining the previously applied filters with the threshold technique.Figure 12b shows the damaged and hole regions merged together, derived from Figure 12a by closing its borders, filling in the insides, and selecting only the region with the biggest area.At this step, the unwanted surrounding noise disappeared due to the combined action of the previously used filters.In the case of Figure 11, two different filters were applied to the original image.The Canny filter is commonly used to find objects' edges in images.This filter was tested, and examples of its results are shown in Figure 11a.Since this filter only shows the hole's edges, and there can be cases where the edges are not all closed, and there are gaps in the objects' borders, basic morphological filters were tested to improve the results.The combination of dilation and erosion operators after applying the Canny filter was the method that improved the results the most, Figure 11b.In the case of Figure 11, two different filters were applied to the original image.The Canny filter is commonly used to find objects' edges in images.This filter was tested, and examples of its results are shown in Figure 11a.Since this filter only shows the hole's edges, and there can be cases where the edges are not all closed, and there are gaps in the objects' borders, basic morphological filters were tested to improve the results.The combination of dilation and erosion operators after applying the Canny filter was the method that improved the results the most, Figure 11b.Figure 12a depicts the result of combining the previously applied filters with the threshold technique.Figure 12b shows the damaged and hole regions merged together, derived from Figure 12a by closing its borders, filling in the insides, and selecting only the region with the biggest area.At this step, the unwanted surrounding noise disappeared due to the combined action of the previously used filters.Figure 12a depicts the result of combining the previously applied filters with the threshold technique.Figure 12b shows the damaged and hole regions merged together, derived from Figure 12a by closing its borders, filling in the insides, and selecting only the region with the biggest area.At this step, the unwanted surrounding noise disappeared due to the combined action of the previously used filters.Figure 12c was obtained by replacing the central area (white pixels) of Figure 12b with the value of the hole region (black pixels), showing only the damaged region, so a proper comparison with the original image could be possible.

Calculating the Delamination
This step calculates the delamination parameters by automatically counting the pixels corresponding to each region.Then, by knowing the base radius of the drilled hole, the conversion factor is calculated so that the delamination factors can be determined in mm.The X-ray images processed by the Python algorithm permitted a specific delamination evaluation to be quantified through delamination factor criteria (Equations ( 1)-( 3)).
To determine the diameters for calculating the delamination factors, first, the contours of the hole and the damaged regions were identified by thin internal lines.Secondly, the smallest circle that included those contours was calculated on the thicker lines, corresponding to the hole's inner diameter,  , Figure 13a, and the outer diameter of the circle better adjusted to the complete delaminated region,  , Figure 13b.In the first image, a slight difference between the two lines in the top left-hand corner is seen, which means that the hole was not perfectly circular, possibly caused by more loads being applied on that side during the drilling process.

Novel Algorithm's Results
In order not to simply write the new algorithm's results in the user console, as the user may not be proficient in programming with Python or may use different code compilers, the results were presented under the image form for clearer output.For comparison purposes, the two algorithms were put side by side to highlight their differences, and the improvements brought by the new one in the analysis of two holes performed with different sets of parameters with distinct delamination levels.
Hole 1 was drilled with a feed of 0.3 mm/rev.and a cutting speed of 150 m/min.Comparing its original image, Figure 14a, with the corresponding binary image obtained by

Calculating the Delamination
This step calculates the delamination parameters by automatically counting the pixels corresponding to each region.Then, by knowing the base radius of the drilled hole, the conversion factor is calculated so that the delamination factors can be determined in mm.The X-ray images processed by the Python algorithm permitted a specific delamination evaluation to be quantified through delamination factor criteria (Equations ( 1)-( 3)).
To determine the diameters for calculating the delamination factors, first, the contours of the hole and the damaged regions were identified by thin internal lines.Secondly, the smallest circle that included those contours was calculated on the thicker lines, corresponding to the hole's inner diameter, D nom , Figure 13a, and the outer diameter of the circle better adjusted to the complete delaminated region, D max , Figure 13b.In the first image, a slight difference between the two lines in the top left-hand corner is seen, which means that the hole was not perfectly circular, possibly caused by more loads being applied on that side during the drilling process.

Calculating the Delamination
This step calculates the delamination parameters by automatically counting the pixels corresponding to each region.Then, by knowing the base radius of the drilled hole, the conversion factor is calculated so that the delamination factors can be determined in mm.The X-ray images processed by the Python algorithm permitted a specific delamination evaluation to be quantified through delamination factor criteria (Equations ( 1)-( 3)).
To determine the diameters for calculating the delamination factors, first, the contours of the hole and the damaged regions were identified by thin internal lines.Secondly, the smallest circle that included those contours was calculated on the thicker lines, corresponding to the hole's inner diameter,  , Figure 13a, and the outer diameter of the circle better adjusted to the complete delaminated region,  , Figure 13b.In the first image, a slight difference between the two lines in the top left-hand corner is seen, which means that the hole was not perfectly circular, possibly caused by more loads being applied on that side during the drilling process.

Novel Algorithm's Results
In order not to simply write the new algorithm's results in the user console, as the user may not be proficient in programming with Python or may use different code compilers, the results were presented under the image form for clearer output.For comparison purposes, the two algorithms were put side by side to highlight their differences, and the improvements brought by the new one in the analysis of two holes performed with different sets of parameters with distinct delamination levels.
Hole 1 was drilled with a feed of 0.3 mm/rev.and a cutting speed of 150 m/min.Comparing its original image, Figure 14a, with the corresponding binary image obtained by

Novel Algorithm's Results
In order not to simply write the new algorithm's results in the user console, as the user may not be proficient in programming with Python or may use different code compilers, the results were presented under the image form for clearer output.For comparison purposes, the two algorithms were put side by side to highlight their differences, and the improvements brought by the new one in the analysis of two holes performed with different sets of parameters with distinct delamination levels.
Hole 1 was drilled with a feed of 0.3 mm/rev.and a cutting speed of 150 m/min.Comparing its original image, Figure 14a, with the corresponding binary image obtained by the previously developed Matlab algorithm, Figure 14b, and the image obtained by the new Phyton algorithm, Figure 14c, a clear difference was observed.Particularly noticeable was the identification of the delaminated zones around the drilled hole, which in this new solution was highlighted more, with the delamination regions fully filled, contrary to the result obtained by the previous algorithm.Moreover, the presence of contrasting liquid drops near the hole, which could not be completely removed despite thoroughly cleaning the sample, leaving only the delaminated zones impregnated with it, can sometimes affect the damage assessment.The new algorithm successfully considered these as image noise and removed them so there was no interference with the delaminated region around the hole.This ensured a higher accuracy of the results, making the evaluation more precise and effective.
result obtained by the previous algorithm.Moreover, the presence of contrasting liquid drops near the hole, which could not be completely removed despite thoroughly cleaning the sample, leaving only the delaminated zones impregnated with it, can sometimes affect the damage assessment.The new algorithm successfully considered these as image noise and removed them so there was no interference with the delaminated region around the hole.This ensured a higher accuracy of the results, making the evaluation more precise and effective.
An example of a less damaged hole, namely of the Hole 2 image, drilled with a lower feed, 0.15 mm/rev., and the same cutting speed, 150 m/min., is depicted in Figure 15a.The problem with the previous algorithm, Figure 15b, was that if the selected threshold was too high, the hole's boundaries were not properly identified, but if it was too low, as shown in the image, there was too much noise around the hole.As clearly seen, the new algorithm, Figure 15c, was designed to identify better the less prominent delamination zones around the hole, i.e., the ones where the contrast liquid did not penetrate as effectively or were simply less deep and not so easily distinguishable with the naked eye.In the new algorithm, combining the Canny, dilation and erosion operators, and threshold filter removed the noise from the input image without compromising the hole boundaries, thus overcoming this problem.With the application of the new algorithm, obtaining more accurately adjusted delamination factors from images of holes with great delamination was possible.It also resulted in logical values regarding the tool used, and the chosen machining parameters, An example of a less damaged hole, namely of the Hole 2 image, drilled with a lower feed, 0.15 mm/rev., and the same cutting speed, 150 m/min., is depicted in Figure 15a.The problem with the previous algorithm, Figure 15b, was that if the selected threshold was too high, the hole's boundaries were not properly identified, but if it was too low, as shown in the image, there was too much noise around the hole.As clearly seen, the new algorithm, Figure 15c, was designed to identify better the less prominent delamination zones around the hole, i.e., the ones where the contrast liquid did not penetrate as effectively or were simply less deep and not so easily distinguishable with the naked eye.In the new algorithm, combining the Canny, dilation and erosion operators, and threshold filter removed the noise from the input image without compromising the hole boundaries, thus overcoming this problem.the previously developed Matlab algorithm, Figure 14b, and the image obtained by the new Phyton algorithm, Figure 14c, a clear difference was observed.Particularly noticeable was the identification of the delaminated zones around the drilled hole, which in this new solution was highlighted more, with the delamination regions fully filled, contrary to the result obtained by the previous algorithm.Moreover, the presence of contrasting liquid drops near the hole, which could not be completely removed despite thoroughly cleaning the sample, leaving only the delaminated zones impregnated with it, can sometimes affect the damage assessment.The new algorithm successfully considered these as image noise and removed them so there was no interference with the delaminated region around the hole.This ensured a higher accuracy of the results, making the evaluation more precise and effective.An example of a less damaged hole, namely of the Hole 2 image, drilled with a lower feed, 0.15 mm/rev., and the same cutting speed, 150 m/min., is depicted in Figure 15a.The problem with the previous algorithm, Figure 15b, was that if the selected threshold was too high, the hole's boundaries were not properly identified, but if it was too low, as shown in the image, there was too much noise around the hole.As clearly seen, the new algorithm, Figure 15c, was designed to identify better the less prominent delamination zones around the hole, i.e., the ones where the contrast liquid did not penetrate as effectively or were simply less deep and not so easily distinguishable with the naked eye.In the new algorithm, combining the Canny, dilation and erosion operators, and threshold filter removed the noise from the input image without compromising the hole boundaries, thus overcoming this problem.With the application of the new algorithm, obtaining more accurately adjusted delamination factors from images of holes with great delamination was possible.It also resulted in logical values regarding the tool used, and the chosen machining parameters, With the application of the new algorithm, obtaining more accurately adjusted delamination factors from images of holes with great delamination was possible.It also resulted in logical values regarding the tool used, and the chosen machining parameters, namely the feed and cutting speed.Table 1 indicates the delamination factors calculated using Equations ( 1)-( 3) with the data obtained from the images of Holes 1 and 2 by the previous and the new algorithms, along with the respective drilling parameters.Noticeably, the increase in the delamination factor obtained by the new algorithm was directly related to the feed increment.The previous algorithm had problems with the image processing step and with calculating the delamination factors.Although the values of the adjusted delamination factor (F da ) seemed more reliable in the previous algorithm, as they were lower, it quickly became apparent that they were incorrect.The value in the Hole 2 image was almost twice as high as that in the Hole 1 image, and it can be perceived visually that the Hole 1 image contained more delamination than the second image.Using the new algorithm, the Hole 1 image had a higher adjusted delamination factor (F da ), but the two values were closer to each other, which is more realistic.Additionally, the delamination factor considering the area (F a ) obtained by the previous algorithm was too low, which does not make sense.Since it is calculated via the area, it should be higher than one, which only happens with the new algorithm.
All the calculated delamination factors are considerably above the acceptable limit in the aeronautical industry, which is 1.200 [31], which means that, as confirmed visually, the holes exhibit severe damage and would not be accepted in a quality inspection.Nevertheless, with the aid of the new Python algorithm, a correct analysis can be performed, ensuring better hole assessment and higher quality in obtaining good results in future experiments.

Discussion
The literature contemplates some works in this field, although the most common ones focus on drilling composites, such as CFRP.For example, Krishnaraj et al. [32] performed drilling tests in a 4.2-mm-thick unidirectional CFRP, obtaining an F d of 1.33 with a feed of 0.2 mm/rev.and a cutting speed of 15 mm/min.In the work of Durão et al. [24], a 4-mm-thick unidirectional epoxy CFRP was drilled with feeds of 0.03, 0.1, and 0.2 mm/rev.and a constant cutting speed of 52 m/min, which resulted in F d , F da values of 1.29, 1.47, 1.61, 1.81, 2.04, and 2.33, respectively.In both studies, the F d values were close to the multimaterial ones, but in the second, the F da values were relatively lower.Studies regarding the delamination quantification and analysis of drilling multi-materials, specifically CFRP/Al, are also being conducted, although not very prominently.Nevertheless, few articles can be found with the delamination values clearly stated and, from the existing ones, the majority only address the F d factor, the simplest delamination factor.This is the case in Mahdi et al. [33], where they drilled into a 7.6-mm-thick woven CFRP/Al stack with an uncoated classical twist drill, obtaining F d values of around 1.2 using a feed of 0.0023 mm/min.and a cutting speed of 178 m/min.Furthermore, Ekici et al. [34] drilled a 5-mm-thick woven CFRP/Al multi-material composed of seven alternate material layers with a twist drill containing a TiN-TiAlN PVD coating, achieving F da results of 1.8 using a feed of 0.2 mm/rev.and a cutting speed of 85 m/min.This value is lower than the one obtained

Figure 1 .
Figure 1.Diameters and areas used to calculate the delamination factors  ,  and  .

Figure 1 .
Figure 1.Diameters and areas used to calculate the delamination factors F d , F a and F da .

Figure 2 .
Figure 2. (a) The Kodak RVG 5100 digital sensor and (b) a sample of the multi-material under X-ray analysis.

Figure 3 .
Figure 3. Pipeline of the novel image processing and analysis algorithm developed in Python.

Figure 2 .
Figure 2. (a) The Kodak RVG 5100 digital sensor and (b) a sample of the multi-material under X-ray analysis.

Figure 3 .Figure 3 .
Figure 3. Pipeline of the novel image processing and analysis algorithm developed in Python.

Figure 4 .
Figure 4. Grid selection of the ROI's borders of the hole image under study in the previous Matlab algorithm.

Figure 5 .
Figure 5.The effect of the selected ROIs threshold value in the previous Matlab algorithm: (a) too high, (b) too low, and (c) adequate threshold value.

Figure 4 .
Figure 4. Grid selection of the ROI's borders of the hole image under study in the previous Matlab algorithm.

Figure 4 .
Figure 4. Grid selection of the ROI's borders of the hole image under study in the previous Matlab algorithm.

Figure 5 .
Figure 5.The effect of the selected ROIs threshold value in the previous Matlab algorithm: (a) too high, (b) too low, and (c) adequate threshold value.

Figure 5 .
Figure 5.The effect of the selected ROIs threshold value in the previous Matlab algorithm: (a) too high, (b) too low, and (c) adequate threshold value.

Processes 2024 ,Figure 6 .
12,  x FOR PEER REVIEW 7 of 15 must be reinitiated to continue.A similar process starts for the user to select a pixel on the delamination contour.Figure6aand 6b represent the hole and delamination contour detection, respectively, on the top left corner region of the image in Figure 5c.Results obtained by the previous Matlab algorithm: the (a) hole and (b) delamination contour detection on the top left corner region of the image in Figure 5c.

Figure 7 .
Figure 7. Results obtained by the previous Matlab algorithm: (a) the hole region, (b) the hole + damaged regions, and (c) the final binary image to be assessed.

Figure 6 .
Figure 6.Results obtained by the previous Matlab algorithm: the (a) hole and (b) delamination contour detection on the top left corner region of the image in Figure 5c.

Processes 2024 ,Figure 6 .
12,  x FOR PEER REVIEW 7 of 15 must be reinitiated to continue.A similar process starts for the user to select a pixel on the delamination contour.Figure6aand 6b represent the hole and delamination contour detection, respectively, on the top left corner region of the image in Figure 5c.Results obtained by the previous Matlab algorithm: the (a) hole and (b) delamination contour detection on the top left corner region of the image in Figure 5c.

Figure 7 .
Figure 7. Results obtained by the previous Matlab algorithm: (a) the hole region, (b) the hole + damaged regions, and (c) the final binary image to be assessed.

Figure 7 .
Figure 7. Results obtained by the previous Matlab algorithm: (a) the hole region, (b) the hole + damaged regions, and (c) the final binary image to be assessed.

Figure 8
Figure 8  shows an example of a grayscale image imported to the new Python algorithm.

Figure 8 .
Figure 8.An example of a hole image imported to the new Python algorithm.

Figure 9 .
(a) The grayscale histogram of the image in Figure 8 and (b) the respective histogr

Figure 8 .
Figure 8.An example of a hole image imported to the new Python algorithm.

Processes 2024 , 15 Figure 8 .
Figure 8.An example of a hole image imported to the new Python algorithm.

Figure 9 .
(a) The grayscale histogram of the image in Figure 8 and (b) the respective histogram peaks.

Figure 9 .
Figure 9. (a) The grayscale histogram of the image in Figure 8 and (b) the respective histogram peaks.

Figure 10 .
Figure 10.The output obtained by the new Python algorithm from the image in Figure 8: (a) the hole region, (b) the damaged region, and (c) the hole + damaged regions.

Figure 11 .
Figure 11.Images after applying the (a) Canny edges detector and (b) erosion filter to the image in Figure 10c.
Figure12adepicts the result of combining the previously applied filters with the threshold technique.Figure12bshows the damaged and hole regions merged together, derived from Figure12aby closing its borders, filling in the insides, and selecting only the region with the biggest area.At this step, the unwanted surrounding noise disappeared due to the combined action of the previously used filters.Figure12cwas obtained by replacing the central area (white pixels) of Figure12bwith the value of the hole region (black pixels), showing only the damaged region, so a proper comparison with the original image could be possible.

Figure 10 .
Figure 10.The output obtained by the new Python algorithm from the image in Figure 8: (a) the hole region, (b) the damaged region, and (c) the hole + damaged regions.

Figure 10 .
Figure 10.The output obtained by the new Python algorithm from the image in Figure 8: (a) the hole region, (b) the damaged region, and (c) the hole + damaged regions.

Figure 11 .
Figure 11.Images after applying the (a) Canny edges detector and (b) erosion filter to the image in Figure 10c.
Figure12adepicts the result of combining the previously applied filters with the threshold technique.Figure12bshows the damaged and hole regions merged together, derived from Figure12aby closing its borders, filling in the insides, and selecting only the region with the biggest area.At this step, the unwanted surrounding noise disappeared due to the combined action of the previously used filters.Figure12cwas obtained by replacing the central area (white pixels) of Figure12bwith the value of the hole region (black pixels), showing only the damaged region, so a proper comparison with the original image could be possible.

Figure 11 .
Figure 11.Images after applying the (a) Canny edges detector and (b) erosion filter to the image in Figure 10c.

Figure 12 .
Figure 12.The output obtained by the new Python algorithm from the image in Figure 8: after the (a) filter combination, (b) filled damaged + hole region, and (c) damaged region.

Figure 13 .
Figure 13.The identification process of the (a) inner diameter,  , and (b) delaminated outer diameter,  , by the new algorithm.

Figure 12 .
Figure 12.The output obtained by the new Python algorithm from the image in Figure 8: after the (a) filter combination, (b) filled damaged + hole region, and (c) damaged region.

Figure 12 .
Figure 12.The output obtained by the new Python algorithm from the image in Figure 8: after the (a) filter combination, (b) filled damaged + hole region, and (c) damaged region.

Figure 13 .
Figure 13.The identification process of the (a) inner diameter,  , and (b) delaminated outer diameter,  , by the new algorithm.

Figure 13 .
Figure 13.The identification process of the (a) inner diameter, D nom , and (b) delaminated outer diameter, D max , by the new algorithm.

Figure 14 .Figure 15 .
Figure 14.(a) The original image of Hole 1, (b) the output from the Matlab algorithm of the Hole 1 image, and (c) the corresponding output from the Python algorithm.

Figure 14 .
Figure 14.(a) The original image of Hole 1, (b) the output from the Matlab algorithm of the Hole 1 image, and (c) the corresponding output from the Python algorithm.

Figure 14 .Figure 15 .
Figure 14.(a) The original image of Hole 1, (b) the output from the Matlab algorithm of the Hole 1 image, and (c) the corresponding output from the Python algorithm.

Figure 15 .
Figure 15.(a) The original image of Hole 2, (b) the output from the Matlab algorithm of the Hole 2 image, and (c) the corresponding output from the Python algorithm.

Table 1 .
The comparison of the values of the studied delamination damage factors obtained from the images of Holes 1 and 2 using the two algorithms.