Proceedings of the 7th World Congress on Mechanical, Chemical, and Material Engineering (MCM'21)
Prague, Czech Republic Virtual Conference – August, 2021
Paper No. ICMIE 115
DOI: 10.11159/icmie21.115

Metallographic Analysis for Low Carbon Steels Using Software
Developed with Python
Fredy Llulluna1, Claudio Cordova2, David Pachacama3, Darwin Pachacama4, William Paucar5
1

Deparament Sustainable Architecture / Universidad Regional Amazónica Ikiam
Parroquia Muyuna, kilómetro 7 vía a Alto Tena. Napo, Ecuador
fredy.llulluna@ikiam.edu.ec2,5
Department of Basic Sciences / Escuela Politécnica Nacional
Ladrón de Guevara E11-253, Quito, Ecuador
claudio.cordova@epn.edu.ec / william.paucar@epn.edu.ec
3,4
Deparament of Exacts Sciences / Universidad de las Fuerza Armadas ESPE
Av. Gral. Rumiñahui y Av. Ambato, Sangolquí, Ecuador
dppachacama1@espe.edu.ec/dapachacama@espe.edu.ec

Abstract - This research focuses on automating the determination of grain size, the percentage of ferritic-pearlitic phases in low carbon
steels by developing a metallographic analysis software programmed in Python. The direct count valuation method and the values of theG granulometric indices according to the UNE 7-280.72 standard are used. The process consisted of taking the micrographs of 4 typesof steels with different carbon content, each type of steel is made with 10 micrographs with a 100x zoom, once the images are enteredinto the software, the program segments the light and dark regions of the image and counts the total regions and the dark regions (ferriteand pearlite) and compares them with the standard UNE. The results of the investigation were compared with the results of the commercial
metallographic software PAX-it and using an ANOVA analysis showed that the differences between the results for the by grain size andthe percentage of ferrite obtained with the developed software and the PAX-it they are not statistically significant and present a confidence
level of 95%, validating the results.
Keywords: metallographic analysis, grain size, ferrite, pearlite.

1. Introduction
Mechanical engineering has presented great expansion and technological advances thanks to the introduction ofcomputer elements and experimental analysis tools, allowing the development of new products, optimizing time andresources. The metallographic analysis is a useful tool in engineering materials because it can determine the structuralcharacteristics, the grain size distribution component phases, and inclusions that affect the mechanical properties of metals.
This analysis predicts the behavior of materials under different conditions of service, and as always has a center or laboratory
with specialized technicians and sophisticated equipment for the characterization of materials, either for the selection ofmaterials or analysis quality control, the digital image has several advantages for its multiple and its manipulation
possibilities. [1] Images (micrographs) must be processed to obtain information by using a supplemented computer with asoftware image processing applied to the metallography (software developed with Python programming language) tomeasure the grain size, shape, structure, and determination of component phases (ferrite and pearlite), which is within thescope of correct sample preparation [2].
The main objective of metallographic analysis is to reveal the structure of metals and their alloys by means of an electron
microscope to study the structural characteristics of a metal or an alloy and the relationship that exists with its physical andmechanical properties and its thermal effects. The sample preparation metallographic evaluation and the microstructure, it ispossible to determine the grain size distribution component phases and inclusions having great effect on the mechanicalproperties of the alloy. [1] [3].

ICMIE 115-1

2. Methodology
Metallographic procedure completes the following steps: sample extraction, coarse grinding, fine grinding,polishing thickness. fine polishing, chemical attack. Proper preparation of the metallographic sample guarantees
obtaining a micrograph (digital image) quality, facilitating digital processing [4] [5].
The micrograph must comply with certain parameters for the good functioning of image processing software, so it
is necessary to calibrate the microscope at a standard magnification of 100x [6], and a suitable approach to provide
sharpen the image with a size of 2048x1536 pixels and an image format JPEG (.jpg) in each of the samples as shown in
Figure 1.

Fig. 1: Micrograph obtained by the microscope.

2.1. Low Carbon Steel Specimens
The specimens used for metallographic analysis using image processing software developed with Python are asfollows: AISI – 7210 (al 0,15% C)
 Mecaplus E- 470 (0,18% C),
 ASTM A-36 (0,15% - 0,25% C)
 SAE - 1018 (0,15% – 0,20% C)
Each of the specimens is done there are 10 high quality micrographs for metallographic analysis software developed.
2.2. Standard Methods for the Determination of Grain Size
There are several procedures to estimate grain size the ASTM (American Society for Testing and Materials) hassynthesized all these processes and they are explained in detail in the ASTM E-112 standard. Test Methods E-112 aredesigned to classify grain size: comparison method, planimetric method, intersection method [11].
These methods are didactic and easy to use to determine the grain size. But for the development of the software, theSpanish standard UNE 7-280.72 is used.
2.3. Determination of grain sizes in steels Spanish standard UNE 7-280-72
The standard establishes the metallographic methods to determine the grain size in ferritic-pearlite steels and thevaluation rules. Grain size is a characteristic of steels and constituents that influence properties. They can have ferriticstructures (mild steels), pearlitic (eutectoid or eutectic steels), or a combination of structures; ferritic - pearlitic, ferrite,and austenite, cementite, and pearlite [10].

ICMIE 115-2

The G index is a positive, null, or negative integer that is deduced from the average number m of grains that can becounted in an area of 1 mm2 of the sample section. By definition G = 1 when m = 16. The values of G and me are related byby Eqs. (1) The grain size is characterized by the index obtained by the direct count valuation method and Heyn's method.

𝑚 = 8 ∙ 2𝐺
(1)
2.3. Direct Grain Size Count.
This method counts the grains within an area of “5000 mm2”, in a micrograph captured at “100x” magnification, withthe help of Eqs (2), n1 is the number of interior grains and n2 is the number of exterior grains. To determine the grain size,
the stages of image processing are carried out (Image capture, reprocessing, segmentation, extraction of characteristics andidentification of grains). The program segments the light and dark regions of the input image and the total regions and dark
regions are counted, Fig 2. With the number of total regions found in the image (direct count assessment method) and Table
III, of the Spanish standard UNE 7-280-72, the grain size of the selected sample is determined [10].

𝑛 = 𝑛1 +1𝑛2 2(2)Fig. 2: Direct count of observed grains

The research focuses on automating the determination of grain size by developing open-source software for image
processing focused on metallographic analysis to determine the percentage of ferritic-pearlitic phases in low carbon steel.
3. Results
Object recognition, position, orientation, and spatial measurement of any property (shape and size) is an advantage that
presents Python for the development of the software. Image processing to analyze, deduce and make decisions [14], forexample in applications such as metallography perform detection of crystal structures, measuring geometric features,classification of regions of different components, and determining defects and inclusions present in the microstructure. The
toolboxes used for the software development were: Matplotlib, Scipy, Numpy, Pil.
The determination of the grain size is done in stages of image processing using the following steps: image acquisition,
preprocessing, segmentation, charge characteristics, and identification of grains and count in each area. In summary, software
segments the light and dark regions of the micrograph counts and compares them with the UNE 7-280-72 standard todetermine the grain size of the sample.

ICMIE 115-3

3.1. Graphical interface
The interface is to provide a simple visual environment to allow communication between the image processing
and the user. GUI software image processing for metallographic analysis, Figure 3, group codes to determine grain size
percentage of phases of ferrite and pearlite, both sheets of steel lower content up to 15% carbon, and steels have 0.15%
0.25% carbon content (due to the perlite content) which represent a visual environment to perform metallographic

Fig. 3: Graphical interface metallographic software developed with Python.

3.2 Direct counting using software metallographic developed in Python
Table 1 shows the results obtained by metallographic software are observed, the grain size, percentage of ferrite,and pearlite for each of the specimens.
No.
1234

Table 1: Results obtained by the software
Number of grains% deGrain size GfoundFerrite
4322
9,41
97,2765107
9,66
94,3025981
9,73
96,7565301
9,73
97,585% dePerlite
2,724
5,698
3,244
2,415

Table 2 shows the results obtained by the PAX-it software and software developed are compared, determining theerror, the same that is between "0.7 to 9%" indicating that is in an acceptable range.
Table 2: comparación entre Software desarrollado vs PAX-it
Grain size GNo
Grain size GError“PAX-it”
19,41
10.34
8,99%
2
9,66
9.83
1,73%
3
9,73
9.64
0,92%
4
9,73
9.96
0,72%

To verify the accuracy of the results of the metallographic image processing software, an analysis of variance(ANOVA) is performed by comparing the results obtained by the PAX-it software and the software developed. Oncethe analysis of variance performed Table 3 which gives rise to the hypothesis planted check is made to determine thedifferences in results.

ICMIE 115-4Therefore, it can be concluded that the differences between the results for grain size and the percentage of ferrite obtainedwith the developed software and PAX-it are not statistically significant at a 95.0% confidence level, giving validity to theresults. . For the percentage of perlite with PAX-it software, results are manipulated at the user's discretion. In this way, it
can be concluded that the results of the developed software are reliable because they do not present a significant differencewith the results of the software PAX-it.
Table 3. Verification of hypotheses
VariableP valorResults
Grain size G
P valor > 0,05 accepted Ho% de ferrita
P valor > 0,05 accepted Ho% de perlita
P valor < 0,05 accepted Ho

4. Conclusion
The main advantage of the software developed with Python is that it does not require manipulation for the determinationof component phases (ferrite-pearlite) as occurs with the PAX-it software, used in the laboratory, where the segmentation ordistribution of component phases remains at the user's discretion.
For the image processing in the developed software, no changes in the image format are required, since the image format
predetermined by the metallographic microscope (.jpg) is used, which is not the case with PAX-it, where previously must
perform an image format change for image processing. The software this developed open-source programming language canbe installed on any computer with any operating system, as many times as desired. Being open-source, it can be manipulatedfor improvement and optimization.
The software features two ranges for carbon content, allowing for greater reliability of the results. Depending on themetallographic sample can visually establish what range belongs it is observed that the sample contains as much perlite
belong to the first range it is between 0.15% to 0.25% carbon content. If it is observed that the sample has a lower amountof ferrite, it will belong to the range of less than 15% carbon. This does not happen with the PAX-it where the results are
only correct steels under 15% carbon.
The micrographs must be of high quality and sharp because the image processing software digitizes a section of themicrograph to count the number of closed regions within the number of gray regions. With the number of total regions andtable III of the Spanish standard UNE 7-280-72, the grain size is determined using the ranges for each grain size G.
If an error percentage greater than 10% is obtained, the process must be carried out once more, and to rule out the error,
it is necessary to change the micrograph to one that must have a sharper one, so the results obtained will be correct.

References
[1]
[2]
[3]
[4]
[5]

Askeland D. Science and engineering of materials. Ed., International Thomson, México, 3th Edition 1988, pp. 304- 309.
Callister W. Introduction to Materials Science and Engineering”, Ed., Reverté, Barcelona, 1ra Edition, 1992, pp 54-60.
Cáceres, R. Multivariate and non-parametric statistics with SPSS, Madrid 1ra Edition, 1995, pp. 8, 12Sydney H. AveneIntroduction to physical metallurgy, Ed McGraw-Hill, México, Second edition,1998, pp.17-36.
J R. Wainschenker; J. Massa, P. TristanStages of digital image processing. Informative guide for the Signal Processing
area. 2011. pp. 124- 138.
[6] Duffus, A.,Digital image processing techniques applied to the analysis of microstructures in steel specimens, 2010.
[7] Pérez M. Hernandez H.Application for processing metallographic images from pme3, 2011.
[8] H. K. D. H. Bhadeshia. The bainite transformation: unresolved issues. Material Science and Engineering A. Vol. 273[9] Rostoker W. and Dvorak J. Interpretation of Metallographic Structures, Science Direct,3th Edicion, 1990. Pp. 213-241[10] Determination of grain size in steels, Spanish standard UNE 7-280-72.
[11] Standard Test Methods for Determining Average Grain Size, ASTM Standards, Designation: E112 – 12.

ICMIE 115-5

[12] Miki Hori, Tadasuke Hori, Yuzo Ohno, Shozo Tsuruta, Haruhiko Iwase, Tatsushi Kawai. A novel identification method
using perceptual degree of concordance of occlusal surfaces calculated by a Python program, Forensic Science
International, 2020 , Volume 313, ISSN 0379-0738, https://doi.org/10.1016/j.forsciint.2020.110358.

ICMIE 115-6