Universal technique for information and digital analysis of steel and alloy structures using MATLAB Authors: Gulzhainat Akhmetova, Alexandr Kudrya, Evgeniy Panin Published: 2024 ABSTRACT AbstractThere are a large number of computer programs that allow you to automate computational and graphical operations for processing arrays of data and images. The foundations of these areas are very promising in the practice of solving problems of materials science, namely in metallography, based on the analysis of images of structures of metals and alloys. The standards describe various techniques, but they are all performed and calculated manually by the operator. There is no single universal automated method for quality control of metal structures. The authors of the work have developed a methodology that allows for the study (measurement and analysis) of microstructure images of steels and alloys using classical widespread software. For these purposes, MATLAB software was selected, which was adapted to solve metallographic problems described in special GOST standards for quality control of metals by structure (ASTM E45-18a, DIN EN 10247:2017-09; GOST: 5639-82; 1778-70; 54570-2011; 21073-75; R ISO 643-2015). The paper describes:•obtaining an adequate and objective image of the structure in digital form;•an information-digital method for measuring informative elements of the structure responsible for the mechanical properties and quality of the material as a whole.Method name: Methods of information and digital analysis of the structure of metals and alloysKeywords: Information and digital analysis, Binarization, MATLAB, Structure, Steel, Alloy Specifications table Subject area:Materials ScienceMore specific subject area:Metallographic analysis of the structure of metals and alloysName of your method:Methods of information and digital analysis of the structure of metals and alloysName and reference of original method:Metallographic studies described in ASTM E45-18a; DIN EN 10247:2017-09; GOST 5639-82 “Steels and Alloys. Methods for detecting and determining the grain size”; GOST 1778-70 “Steel. Metallographic methods for the determination of non-metallic inclusions”; GOST 54570-2011 “Steel. Methods for assessing the degree of banding or orientation of microstructures”; GOST 21073 -75 “Non-ferrous metals. Determination of grain size by counting grain intersections”; R ISO 643-2015 “Steel. Metallographic determination of the observed grain size” (original method, that was changed) [4,5];Resource availability:- MATLAB software adapted for mathematically accurate determination of the geometric parameters of the main structural components of images of metals and alloys, the created code for the program;- Microsoft Excel, which allows processing the obtained data arrays with quantitative parameters of all structural components and additionally mathematically analyze and, if necessary, build histograms of the distribution of certain informative indicators of the structure of the studied alloys;- scanning microscope for obtaining images of steel microstructures;- Image Expert or Image J software, to eliminate the appearance of noise in the image of microstructures, dilation and erosion procedures;- grinding and polishing machine and reagents for etching and polishing steel samples;- binarization program or technique to obtain an adequate and objective digital image for analysis. Background The quality of a metal or alloy of a metal product is determined by its chemical composition, mechanical and physical properties, which, in turn, are determined by the structure of the metal. The level of mechanical properties is determined solely by the specified metal structure. The structure can be “set” by chemical composition and technological processing modes. However, as practice shows, not all cases of maintaining strict technological regulations for the production of metal products allow us to obtain finished products of good quality. And, even with the same proven technology for the production of metal products over the years, there are often quality attacks. Accordingly, maintaining and improving the quality of metal products at the required level is a complex task, and its successful solution depends on the level of work of all parts of the technological process, starting with steel smelting and ending with finishing operations and quality control of finished metal products. This is possible only with the help of metallographic and statistical quality control of the metal structure at each stage of production (ensuring the required composition and uniformity of the structure, as well as the purity of the metal) [[1], [2], [3]]. In most cases, in industry there are disparate local control systems for a specific technological unit or process. At the same time, the production of materials is characterized by a strong technological heredity – deviations within the norm at different stages and technological operations. That is, the problem of the lack of an effective quality control tool in the field of the quality management system of metal products remains urgent. To increase its effectiveness, it is advisable to collect and analyze the causes of deviations, as well as control the metal by banding structure, grain size, metal contamination with non-metallic inclusions and mechanical properties [6]. An effective way is to process the resulting images of the structure using various mathematical packages. For example, in [7], the average disorientation as a result of electron backscattering diffraction (EBSD) was investigated, which was implemented in the MATLAB code for differentiation and quantification of microstructural components. Correlative electron channeling contrast imaging (ELSI) confirmed the results of automatic phase classification and was subsequently used to study the effect of the angle of grain deviation on classification. Currently, a huge variety of software products have been developed that allow you to work with digital and graphical data, process images, perform mathematical calculations with huge amounts of data, and so on. Real software products perform actions and manipulations at the junction of various sciences, for example, physics – computer science, mathematics – programming, metallurgy – computer science and much more. The authors of the methodology proposed to adapt digital software products to solve the problems of metallography and materials science. The main principle of operation is the use of the capabilities of classic inexpensive software products such as MATLAB and Excel, and their encoding to perform measurements of quantitative indicators of the microstructure of metal alloys. Thus, the authors of the work have developed a universal technique for information and digital analysis of structures of steels and alloys using MATLAB software. This technique allows you to determine the parameters of the microstructure – grain size, their number and shape, identify the presence of anisotropy and its indicators, quantify the presence of a hardening and/or softening (soft) phase, determine not only the presence of non-metallic inclusions, but also analyze their parameters, which, coupled with indicators of mechanical properties, will allow for a more in-depth analysis and understand the nature of alloys. This research method is aimed at overcoming the disadvantages of traditional metallographic methods by offering a computerized, universal and accurate, less labor-intensive and less energy-consuming, economical and reproducible information-digital method [8]. The developed methodology allows for a systematic transition from existing disparate expensive programs and techniques that allow performing a number of single time–consuming metallographic tasks described in ASTM E45-18a, DIN EN 10247:2017-09 and GOST: 5639-82; 1778-70; 54570-2011; 21073-75 and R ISO 643-2015 to modern methods of evaluating the quality of metal products using software available a wide range of PC users. The use of the technique for research and production purposes makes it possible to increase the accuracy of metallographic studies, eliminating subjective errors, save time on research and analyze a larger number of samples of metals and alloys, and when introduced into production, with statistics of relevant data, reduce the volume of substandard, low-grade or defective metal products. Method details The research methodology is based on solving two main tasks: 1)to obtain an adequate and objective digital image; to obtain an adequate and objective digital image; 2)to propose an algorithm for measuring informative structural elements responsible for the mechanical properties and quality of the material as a whole. to propose an algorithm for measuring informative structural elements responsible for the mechanical properties and quality of the material as a whole. The preparation of images of structures for objective quantitative assessment consists in binarization and filtering of images of structures. The algorithm for measuring quantitative parameters of the structure is based on mathematical and binary morphology with the allocation of structural elements. In order to adapt the MATLAB software to solve metallographic problems, a code was created that allows the program to calculate the geometric parameters of white objects of the input source data in pixel equivalent (mathematical morphology). The data entered into MATLAB are binarized images (photos) of microstructures (binary morphology), where white objects define the structural elements of interest to us (for example, ferrite, perlite, martensite, sorbitol or bainite); when processing an un-etched sample, non-metallic inclusions or sulfur prints of carbides are set with white objects). Schematically, the algorithm of the technique of information and digital analysis of structures using MATLAB software: 1. Image acquisition using a microscope → 2. Image binarization → 3. Noise removal in the Image Expert (or Image J) program → 4. Dilation and smart erosion → 5. Measurement of objects in MATLAB → processing and translation (in micrometers) of the received (in pixels) array of measurement data using Excel. The original photo of the microstructure is a digital image of the structure in 256 shades of gray. To prepare the image of the structure for analysis in the MATLAB program and objectively highlight the elements (components) of the structure, it is necessary to transition the images from shades of gray to a matrix of the form “1-0” ("element of the structure – background"). In this case, it is necessary to choose the optimal level of binarization (attribution of components of the structure to white and black objects) – the optimal contrast or saturation level and degree of resolution, ensuring reproducibility and comparability of the results. This operation allows you to objectively separate and identify the boundaries of individual structural components. The transition from the primary image in 256 shades of gray to a binary matrix of the form “1-0” is recommended using a logarithmic curve of the perimeter–area type, which can be calculated and constructed using Excel or the C-curve program (Fig. 1). It is believed that the linear nature of the two components of the curve reflects the self-similarity of the images of structures obtained with a stepwise change in contrast [9]. Example of a perimeter–area logarithmic curve (C-shaped curve). The bend on the C-shaped curve in this case reflects a change in the pattern of imaging of the microstructure of steel with varying levels of binarization (by analogy with the focusing procedure of an optical microscope – transition through focus), and represents the level of binarization corresponding to the most objective image of the structure when translated into a binary (black and white) matrix [10]. Images of structures often contain unnecessary information, such as noise (fuzzy or excessively clear image), non-metallic inclusions (in the case of evaluation of structural components should be excluded) and defects. To ensure objective results and the inadmissibility of errors when measuring the parameters of structural components (such as ferrite, perlite, sorbitol, bainite or martensite) by the MATLAB program, the operator must exclude the above-listed objects. For this purpose, a technique for filtering (preparing) images of structures is necessary. In modern times, there are many modern computer programs that allow image processing, for example, Adobe Photoshop, Image Expert, or Image J. After analyzing digital images of steel structures obtained with a scanning microscope, we identified the need for procedures (options) for removing small objects (noise, excessive clarity, non-metallic inclusions and other defects), erosion procedures - smoothing (thinning) or dilation - building up certain objects. After performing the specified processing of the binarized image, it is loaded into MATLAB. The result of processing a binarized image in the MATLAB program is an array of data on measurements of parameters of white objects (structural components): area, length, width, density, perimeter (in pixels) and angle of inclination. Next, the operator's task is to process the data, transfer the array from the pixel equivalent to the data in microns and determine, graphically depict the informative quantitative parameters of the structure revealed by calculation (using mathematical formulas). Moreover, a panorama (transverse or longitudinal “gluing” or composing a set of consecutive frames) allows you to more succinctly observe, measure and analyze not only structural components, but also non-metallic inclusions, as well as measure bands of structural components (Fig. 2) [11]. Panoramic image of the sample surface for analysis of: (a) non-metallic inclusions; (b) lengths of ferritic strips, their width and angle of inclination to the rolling direction (binarized image). Panoramic photography is also useful for observing the overall picture of the microstructure (dendritic pattern), for example, to determine the texture of deformation (riveting), cast structure and other structural features. Thus, the use of computerized means of obtaining and processing images of steel structures allows us to obtain quantitative characteristics of structures that can be compared with each other, objectively rank steel structures according to the geometry of their structure and associate it with qualitative indicators – mechanical properties, revealing a certain pattern of connection between mechanical properties and structure parameters. Method validation A universal technique for information and digital analysis of steel and alloy structures using MATLAB software has been developed. The possibilities of computer technologies in assessing the heterogeneity of the steel structure have been identified and adapted. The MATLAB software product and methodology have been developed, tested and implemented, which allow automated determination of quantitative parameters of structures and its components, and obtaining a contrasting image of steel structures using a computer. The developed technique is universal and allows replacing the classic standard metallographic methods, which are labor-intensive. The technique is applicable in solving such material science problems as: quality control of the main structural components of steel (ferrite, perlite, bainite, sorbitol, etc.); solid phases (carbides based on iron and other elements); evaluation of carbides, nitrides and non-metallic inclusions; determination of the anisotropy index and the linearity of the structure of steels. With the help of modern software, the problem of the lack of a universal effective tool for the quantitative description of material structures is solved. The capabilities of the software are used in performing numerical and graphical data processing operations in relation to the analysis of steel structures. Digitalization makes it possible to ensure the mass and automation of measurements and to obtain, among other things, statistical estimates of the geometric parameters of structures that were previously unavailable due to labor intensity. Limitations When comparing the quantitative parameters of the structures obtained as a result of measurements, it should be noted the probable asymmetry of the distribution of values, for example, the distribution of the same anisotropy. Hence, some caution is required when using averages to compare different samples in order to exclude the possibility of incomplete induction. There is an algorithm for the complete extraction of information (indicating the error), which is universal to the type of distribution [12]. Normalizing all the values of the geometry parameters of the structure ξ so that in the interval {ξmin – ξmax} they varied within 1 ≤ r ≤ N in the order xr+1 ≥ xr and built an empirical distribution on the interval [0-1]: The difference between the distributions Ф1(х) and Ф2(х) for two samples: At some point x* is the largest: If two empirical distributions coincide, then the value |D*| may with probability α exceed the level of the Kolmogorov-Smirnov criterion [12]: For small sample volumes (N ≤ 20), the point values of Dα (α, N1, N2) are given in the tables [13], for large volumes there is an approximate formula in [14] At α = 0.05, the error for λ is less than 2%, and the result will be more accurate [15]. The distance D* is invariant with respect to any nonlinear transformations that monotonously (with preservation of order) reflect the influence of x on some other variables [16]. Thus, the use of computer technologies in obtaining and processing images of steel structures (and other materials) with a possible assessment of the reliability of the results allows us to objectively determine the quantitative parameters of structures, compare them and rank steels among themselves. Ethics statements Not applicable. CRediT authorship contribution statement Gulzhainat Akhmetova: Conceptualization, Methodology, Formal analysis, Investigation, Writing – original draft, Visualization, Supervision, Project administration, Funding acquisition. Alexandr Kudrya: Conceptualization, Methodology, Software, Validation, Investigation, Resources. Evgeniy Panin: Software, Validation, Formal analysis, Investigation, Data curation, Writing – review & editing, Visualization. Declaration of competing interest The authors declare that they have no known competing financial interests or personal relationships that could have appeared to influence the work reported in this paper. Acknowledgments This research was funded by the Science Committee of the Ministry of Science and Higher Education of the Republic of Kazakhstan (Grant No. AP15473350). Footnotes Related research article: A.V. Kudrya, E.A. Sokolovskaya, V.Y. Perezhogin, D.U. Smagulov, G.E. Akhmetova, Measurement of Banded Microstructure Characteristics in Sheet Steels. Metallurgist. 62(11-12) (2019) 1225–1231. For a published article. Contributor Information Gulzhainat Akhmetova, Email: agulzhajnat@bk.ru. Alexandr Kudrya, Email: avkudrya@inbox.ru. Evgeniy Panin, Email: cooper802@mail.ru. Data availability Data will be made available on request. References Associated Data Data Availability Statement Data will be made available on request.