Comparative Evaluation of Marking Methods on Cast Parts of Al–Si Alloy with Image Processing

Quality issues caused by casting defects are commonly complicated to solve, because the part-specific process parameters are not traced to the individual cast part. This problem can be mitigated by the traceability of each cast part with an identifier code. Therefore, a study of the influence of marked surface topography and post-treatments on code symbol quality is desirable for a well-designed traceability system. In this work, the code symbol quality of laser, dot peen, and electrolytic marking methods on three as-cast surfaces of Al–Si alloy, after sandblasting and heat treatment, is evaluated comparatively with a customized image processing software. The result shows that the laser marking method produces the highest performance for different as-cast surfaces; electrolytic marking provides acceptable results only on the smooth surfaces of high-pressure die casting; dot peen marking produces the codes of high symbol contrasts, which are similar to those of laser marking, especially for rough as-cast surfaces of sand casting. However, for all marking methods, the code qualities of all surface topographies decrease substantially after post-treatments. Considering that dot peen marking has satisfying performances as well as low equipment and maintenance costs, this method is more suitable for small- and medium-size foundries to start to trace each cast part in an economical manner.


Introduction
It is known to metal casters that metal casting quality is strongly influenced by many casting and post-treatment production parameters as well as environmental conditions for different casting processes. This is because their production involves massive heat transfer and phase transitions, where it is difficult to assign and control the production parameters accurately based only on experience and theory. Their quality management is therefore still challenging for most foundries. There are many casting defects caused by inaccurate assignment or less strict control of production parameters. Some typical defects, their possible causes, and some examples of associated production parameters are listed in Table 1. 1 One efficient method to mitigate the casting defects is the connection of production control system to feedback data and real-time control. This intelligent quality management is only possible with accurate part-specific traceability of cast parts. 2,3 Moreover, by implementing the traceability, the manufactures can access other multiple benefits such as a certification for customers, product recall, and effective production. 4 It is also noteworthy that product traceability becomes necessary to meet compliance mandates in various areas, such as Regulation (CE) No 178/2002 (including the regulation of food traceability in the Europe), IATF 16949 in automotive. 5,6 Most accurate traceability is achieved through different marking methods. However, it is still a big challenge for the foundries in part-specific traceability to keep code symbol quality stable during raw part post-treatments, which often expose the cast parts to high mechanical and thermal impacts. Therefore, the cast parts in most small-and medium-sized foundries can be currently traceable only per batch or even not traceable. Some descriptive information on the marking methods and their code images of cast parts is offered by marking equipment manufacturers. However, the influence of marked surface topography and post-treatments on the code symbol quality of different marking methods is not clearly investigated. 7,8 To address these issues, the code symbol qualities in different stages were comparatively evaluated in various criteria in this work. This evaluation was carried out using a customized image processing software written in Python, an open-source programming language. We have thus produced a clear concept of the interacting performances of three marking methods and three as-cast surface topographies. Ultimately, we offer a well-grounded reference to various metal industries for the selection of an appropriate marking method for their metal products. Our aim is to help small-and medium-sized foundries to establish a well-designed traceability system in the interest of smart factories.

Description and Comparison of Marking Methods
There are various marking methods for metal parts. These methods have different performance aspects such as cost, integration complexity. Ten typical marking methods are classified according to the marking efficiency, and their properties are compared in Table 2. It is noteworthy that the recognition way of topography is supposed to suffer greater influence from the light condition than the other recognition ways.
In tool mark, cast parts can be labeled in the tooling by a marking feature in the mold that produces a raised or depressed identifying surface on the casting. Typically, this marking method is utilized for the shared properties, such as alloy used and the production facility. 7 For the metal asset label, a label with marking information is attached to the metal parts, normally by welding. This method is commonly used to identify marine parts or other big facilities. 8 A permanent marking pen is usually used by the workers to mark the part as low quality for a short-term internal status identification. Because these parts will be reworked or scrapped later. In cases of marking stamps, the markings are indented on the surfaces of metal parts by hand or with the use of type holders. 7 In the scribe marking method, one pneumatically driven pin is ascribed into the metal surface and moved along the marking symbols. 9 These symbols are made of continuous engraved lines. These symbols thus are not the machine-readable codes, unlike DMC (data matrix code). However, only machinereadable codes can meet the requirement of high efficiency of the metal production line. These methods are therefore classified as simple marking methods.
Two innovative marking methods are discussed. One is RFID tags embedded in metal by an inductive track. 10 Additionally, RFID transponders directly casted into cast parts, which was firstly developed by Fraunhofer Institute for manufacturing technology and advanced materials IFAM with the patented CAST TRONICSÒ technology. 11 This method not only has a high recognition ratio during the casting process and post-treatments, but also other advantages such as working data acquisition of products in its usage. However, the high cost of RFID chips for each cast part strongly limits their wide usage in casting production. Additionally, the influence of the chip on the mechanical properties of cast parts should not be Depends on the method of label attachment 3 Indented by hand 4 Indented with the use of type holders 5 Including RFID chip inserting time 6 Depends on the insertion method 7 Depends on the camera system underestimated. The other method, marker-free ''Fingerprint'' casting, uses the as-cast surface directly as an identification like the people's fingerprints. 12 One application is the Track & Trace Fingerprint test stand developed by Fraunhofer Institute for Physical Measurement Techniques IPM. 13 This technology is the part identification based on its surface microstructure. One advantage of the fingerprint method is high data safety, because the ''fingerprint'' of a part is difficult to copy. However, recognition of this method depends strongly on the part topography, which can be changed to a large extent after post-treatments for cast parts.
Currently, some other marking methods are widely used in metal productions due to their high efficiency. These include laser marking, electrolytic, and dot peen methods.
In laser marking, a focused laser beam creates lasting marks on the surface of different materials with various power. This method has become popular for fast-moving production lines because of high symbol contrast and short marking time. 14 Additionally, there are some improvements to increase the resistance of code quality to shot blasting. 15,16 The electrolytic marking method is based on an electrochemical process, in which the marking is transferred to an electrically conductive product with a signing stencil and electrolyte. 17 This method produces minimal mechanical force on the metal surface. It is thus suitable for the surface-sensitive products. However, for different identifier codes, the corresponding templates need to be prepared before series marking, which can decrease strongly the marking flexibility. In the dot peen marking method, the marking symbols are printed on part surface by mechanical indenting with a stamping needle. This method can create automatically the machine-readable 2D codes consisting of dots. 18 Additionally, there are optimizations of code symbol quality and image acquisition for the dot peen marking method. 19,20 However, due to its high external impact, this method has a risk of causing microcracks on the products, a factor that must be considered before series marking. The laser, electrolytic, and dot peen marking methods are classified as advanced marking methods. In this work, the marking qualities of these three methods on parts of different casting processes were evaluated after sandblasting and heat treatment. Additionally, Table 3 offers their technical and commercial data, which was shared by Schilling Marking System GmbH in 2021. It is noteworthy that the equipment cost of laser marking is about six times higher than that of dot peen marking, despite the high marking speed of laser marking. In most casting processes excluding high-pressure die casting, the relative lower marking speed of dot peen marking can match the cycle time of their casting production. Additionally, for laser marking, the cost of equipment maintenance is higher than other two marking methods.
Experiment Figure 1 gives an overview of the experimental process in this work, which is divided into four steps. These steps are specimen preparation, post-treatments and data acquisition, digital image processing, and quality criterion definition and grading.

Specimen Preparation
Different casting processes produce the cast parts with different as-cast surface topographies. In this work, three common types of casting processes were chosen: sand casting, gravity die casting, and HPDC (high-pressure die casting) processes. For sand casting and gravity die casting, AlSi7 alloy was chosen as the casted material due to its wide application for these two processes. For the HPDC process, AlSi12 alloy is a more common casted material than AlSi7 because of its high fluidity. Each casting process used 20 specimens to reduce the measurement error. One specimen was randomly chosen for each casting process, and its chemical component was determined by the   Foundry-Master Pro2 spectrometer from Hitachi High-Tech Analytical Science GmbH and is listed in Table 4.
After collection, the specimens were sent to the marking company, Schilling Marking Systems GmbH, and marked by laser, electrolytic, and dot peen marking methods. The corresponding process parameters of these three marking methods are listed in Table 3. The appearance of one specimen of each casting process with markings can be seen in Figure 2. There are nine markings on each specimen. These are one DMC, one barcode, and a series number, marked by the laser marking and electrolytic marking methods. Additionally, two DMC and a series number were marked with the dot peen marking method. Codebar was chosen as the barcode type in this work.

Post-Treatments and Data Acquisition
After marking, all cast parts of sand casting and gravity die casting were put in the T-REX 140 sandblasting cabin of the SAPI Company to receive a hand-operated 10-second sandblasting. Subsequently, these parts were heat-treated in the Nabertherm LE14/11 preheating oven of with the temperature settings shown in Figure 3 (a typical T6 program). 21 The small size of cast parts in this work results into less residual stresses and leads to less risks of excessive distortion of cast parts. Thus, the quenching water was slightly colder than the quenching liquid that is used in foundries.
These two treatments were meant to simulate real online sandblasting and heat treatment, which are supposed to expose the biggest mechanical and thermal impact on cast parts. The treatments were simulated on all specimens excluding parts of HPDC in this work. There are mostly no raw part treatments after HPDC in foundry, because the cast parts of HPDC already have high mechanical properties and surface qualities.
Low surface quality creates background noise that reduces the symbol readability. 22 Thus, both the code symbol quality and its corresponding surface were analyzed in each stage. There are currently different methods to characterize as-cast surfaces in the standards and literature, the ASTM A802 standard of using comparator plates and the MSS SP-55 of using photographs. 23,24 Both methods are only qualitative and subjective. 25 For objective surface characterization, 3D scanning, the digital non-contact surface measurement technology, is popular for surface roughness measurements. 26,27 Considering the cost and efficiency of surface characterization, visual inspection of surfaces was combined with contact-type surface roughness measurement in this work.   The images of the casting surfaces were photographed with the equipment in Figure 4. The Canon EOD 200D camera was fixed at a distance of 35 cm above the table. A background ring light with a 6500 K light color was installed as the typical diffuse bright-field vertical illuminator. 28 The roughness was measured using the MarSurf M400 contact-type surface measuring instrument of Mahr GmbH.

Digital Image Processing
After the digital image acquisition of the photographs, the code images were analyzed in various criteria with an image processing software package written in Python.
In the digital image processing, camera correction was first applied to reduce the error created by camera lens   Figure 5). 29 Afterward, the RGB (red/green/ blue) images of the markings were converted into 8-bit grayscale images and further into binary images ( Figure 6). The as-cast surfaces and the marking symbols had hardly any colors. Thus, the histogram curves of RGB pixel values were overlapped to a great degree. These grayscale images quantified the symbol contrast (k 2 ) as one criterion for code symbol quality evaluation. To analyze the marking dimensional accuracy and code/background noise, the grayscale images need to be converted further into binary images, which have only white and black pixels. The converting of binary images was determined by a dynamic luminance threshold. The pixels of grayscale image were replaced with white pixels (pixel value: 1), when the gray value of pixels is greater than the threshold. All other pixels with lower gray values were replaced with black pixels (pixel value: 0). This threshold automatically separates the marking area from the background with an acceptable tolerance. Figure 6 illustrates the luminance threshold at the middle of two peaks in the histogram curve of the grayscale image. 29 The results of other criteria for code symbol quality evaluation were derived from binary images, regarding dimension (k 3 , k 4 ), code area (k 5 ), and background (k 6 ).
Since decoding codes in Python has a high requirement of code readability, there were two methods to improve readability in this work. One method was morphology processing, i.e., erosion and dilation. 30 The method reduced the image background noises and located the code area. Afterward, the other method of an inconstant threshold of black pixel ratio reconstructs the damaged codes to meet the standard cell/ bar amount. In detail, the code area of the DMC/barcode was divided into small cells/bars to calculate the black pixel ratio in each cell/bar. The inconstant threshold was determined by sorting and clustering of black pixel ratios. 31 The comparison of code readability with the constant threshold and inconstant threshold can be seen in Table 5. 32 The red cells in DMC stand for the recognized cells, and the yellow cells are for unrecognized cells. After outlier elimination and classification in the bar width matrix, by using the inconstant threshold, the barcodes that lost some code area were reconstructed into a standard barcode with 28 bars. Thus, the inconstant threshold improved the readability of DMCs and barcodes by minimizing the influence of unclear or damaged areas. These two methods of image denoising were performed prior to the detection of bars.

Quality Criterion Definition and Grading
In this work, ISO/IEC TR 29158 was chosen for the reference of DMC symbol quality evaluation. 33 For barcode inspection, ISO/IEC 15416 is the reference. 34 Each of the two norms has over ten criteria under strict scanning conditions. However, not all of these criteria are critical for code symbol quality. Therefore, five critical criteria of each norm were carefully chosen and modified to evaluate the code symbol efficiently under the tested photograph condition.
The criteria of each symbol type, i.e., DMC, barcode, and number, are explained with graphical illustrations and mathematic formulas (Tables 6, 7 and 8). Only decoding (k 1 ) and symbol contrast (k 2 ) are directly employed from the norms. The other criteria are based on the overall symbol instead of each bar/cell level required in the norms. This simplification can analyze code dimension accuracy  DMC evaluation has six criteria: decoding (k 1 ), symbol contrast (k 2 ), side ratio (k 3 ), included angle (k 4 ), code area ratio (k 5 ), and background noise ratio (k 6 ). Barcode also has six criteria, decoding (k 1 ), symbol contrast (k 2 ), number of bars (k 3 ), bar width ratio (k 4 ), code area ratio (k 5 ), and background noise ratio (k 6 ). Number symbol has only three criteria, namely symbol contrast (k 2 ), code area ratio Barcode criteria grading Number criteria grading To obtain the code symbol quality level, each criterion was graded and scored. The grading and scoring also refer to the ISO/IEC TR 29158 and ISO/IEC 15416 norms. In the norms, each criterion has 5 numeric grades, from 4 to 0. These altered standards are shown in Table 9. Since the decoding result only has two statuses, decoded and not decoded, with two grades with the points of 4 and 0, respectively. All symbol types share the same grading and scoring of symbol contrast (k 2 ), code area ratio (k 5 ), and background noise ratio (k 6 ). Other criteria are graded separately for each marking symbol type.
Three main aspects, i.e., decoding system, code symbol, and background, were taken into account in the setting of the criteria. In this way, the code symbol quality and its influences can be analyzed comprehensively.

Results and Discussion
The surfaces of the specimens and their code symbol qualities in each stage were analyzed and compared. The results consist of three aspects: surface images of the specimens, code images with visual assessment, and code symbol evaluation with image analysis.
Surface Images of the Specimens Figure 7 shows the appearances of No.20 specimens of different casting processes along the post-treatments. The photograph of the cast part of HPDC reveals the highest surface quality, which is close to a finished surface. The ascast surfaces of gravity die casting and sand casting show similar surface qualities with medium roughness. After the sandblasting, the codes instead of as-cast surfaces were damaged to a large extent. The sandblasting reduces the background brightness by increasing surface roughness and dilutes the symbol color due to the near-surface abrasion.
After heat treatment, the surfaces of cast parts appeared to become darker to some degree and codes were further  damaged. Unlike sandblasting, the main reason for brightness reduction after heat treatment is oxidation.  35 The causes of this phenomenon they referred to are changing the size of eutectic silicon particles and oxidizing the alloy surface. A similar phenomenon of the metal surface roughness decrease after heat treatment was investigated by using statistical analysis. 36

Code Images with Visual Assessment
This section illustrates a visual assessment of typical code images in each stage. To reduce the visual error, the background brightness of each code image is adjusted to a similar level. Additionally, we compare the code images using a rating scale as defined in Table 10. The code images with rating scales are shown in Table 11 and are sorted out by marking methods.
Laser marking produces codes with the highest symbol contrast on different as-cast surfaces. That is, the code symbol quality of laser marking develops minimal sensitivity to as-cast surface topography. Nevertheless, all code contrasts of laser marking decrease significantly after sandblasting. Interestingly, after heat treatment, the readability of codes on the parts of gravity die casting becomes slightly higher. The engraved area becomes brighter than the background after heat treatment.
The code symbol quality of electrolytic marking is much more sensitive to as-cast surface topography than these of laser marking. Electrolytic marking produces code symbols with blurred code edges on the cast parts of sand casting, code symbols with recognizable symbol outline on those of gravity die casting, and code symbols with sharp marking edges on those of HPDC. However, after sandblasting, it appears that most code symbols of electrolytic marking are eliminated. Unlike the code symbol quality of the laser marking, that of electrolytic marking appears to be not positively influenced by heat treatment.
The code symbol quality of dot peen marking is also sensitive to as-cast surface topography, but in the opposite direction. Dot peen marking produces codes with the similar high contrast on cast parts of sand casting like those of laser marking. The potential cause is that the as-cast surfaces of sand casting are supposed to have the lowest hardness that allows the pin deep into the cast part. The deep dot holes produce clear shadows under the ring light and an increase in image contrast. The smooth surface topography of HPDC has therefore an insignificant influence on the image contrast of dot peen marking. Due to the limitation of dot dimension and size, dot peen marking cannot produce barcodes and the number symbols of dot   peen marking are bigger than these of the other marking methods.

Code Quality Evaluation with Image Analysis
The statistical results of image analysis illustrate the change degrees of the code quality in various criteria along post-treatments, which is agreement with the visual assessment in Table 11.
In Figure 9, the performances of DMCs in different stages are compared in six criteria using radar charts. Generally, the scores in most criteria decrease substantially after posttreatments. For laser marking, except for side ratio ðk 3 Þ, the scores of code quality in most criteria are the highest when the parts have no post-treatments. The inaccurate location of the laser beam during marking may be attributed to the low score of side ratio ðk 3 Þ. The general code symbol quality of laser marking increases slightly after heat treatment, only on parts of gravity die casting. For electrolytic marking, the scores in most criteria are the lowest at each stage, except codes on parts of HPDC. Particularly, for codes on the parts of gravity die casting, the covered area of scores is near zero in the radar chart.
Smoother surface topography appears to increase the code symbol quality of electrolytic marking. For dot peen marking, the scores in most criteria of codes are high, close to those of laser marking on parts of sand casting. However, the high performance of codes by dot peen marking is not found on the parts of HPDC.
For the barcode quality evaluation, Figure 10 shows a steady decrease in the covered area in radar charts after each post-treatment, which is similar to the DMCs in Figure 9. For laser marking, the code quality is also higher than that of electrolytic marking. For electrolytic marking, the same influence of as-cast surface topography on the code quality is observed. For codes on the parts of gravity die casting, they produce also the smallest covered area of scores in the radar chart, though the area is not near zero. The barcode quality increases along with the increase in surface quality. On parts of HPDC, electrolytic marking produces high code quality, which is close to that of laser marking. For number symbol quality evaluation, Figure 11 also shows substantial decreases of symbol quality after posttreatments, which are similar to the evaluation of DMC and barcode in Figures 8 and 9. For laser marking, the scores in most criteria of symbol quality are also the highest when the parts have no post-treatments. The scores of dot peen marking are in second place, followed by those of electrolytic marking. Only on parts of HPDC, the performance of electrolytic marking is superior to that of dot peen marking in all criteria.

Conclusion
The research focuses on the marking symbol evaluation at different stages along two post-treatments. This work illustrates and compares the interactions of marking method and marked surface topography. Taking into account visual inspection and the statistical results, we can draw the following conclusions: • The highest code symbol quality of laser marking and the satisfying quality of dot peen marking are observed on different as-cast surfaces. Electrolytic marking produces an acceptable code symbol quality only for those of HPDC. After sand blasting and heat treatment, the code symbol quality of all marking methods decreases significantly and continuously. • Considering low equipment cost (about one-seventh of laser marking equipment cost) and satisfying performance of dot peen marking method, this method appears to be more suitable for smalland medium-size foundries to establish a welldesigned traceability system at a reasonable cost. • In the future, further optimization of dot peen marking system will be developed to improve the code symbol quality. For example, different camera-light settings will be tested to produce clearer shadows of dot holes; dark heat resistance paint will be dropped into the dot holes to increase the symbol contrast of codes.