Quantitative Metallographic Analysis of Dual-Phase Microstructures in 5083 Aluminum Alloy: A Dual-Channel MATLAB Image-Processing System

Abstract

Recrystallized grains and β-phase (Al3Mg2) precipitates coexist in annealed 5083 aluminum alloy with overlapping gray levels, which hinders automated quantitative metallography. A semi-automated dual-channel quantitative metallographic analysis system was developed on the MATLAB platform by decoupling preprocessing and segmentation according to target scale. In the grain channel, images are standardized by combined median-Gaussian filtering, contrast stretching and rolling-ball background correction, and then segmented by an improved marker-controlled watershed algorithm incorporating multi-scale gradient information. In the β-phase channel, conservative CLAHE (ClipLimit = 0.01) locally enhances the fine precipitates without losing their contours, and a strategy adaptive to the imaging mode (OM grayscale, OM color, SEM-BSE) selects block-wise Otsu, CIELAB color masking or foreground-polarity switching. Once the four case-specific inputs have been supplied by the operator (the scale-bar endpoints, the imaging mode, the segmentation sensitivity and the minimum particle area), the system automatically extracts grain size, ASTM grain-size number G, and β-phase area fraction, morphological and distribution parameters, and supports batch processing. Validation on 13 micrographs of different processing states shows that the mean absolute relative error of the total particle number between automatic and manually assisted counting is 1.48% (maximum 3.37%) with a Pearson correlation coefficient of 0.9953 and a systematic underestimation of about 0.9%; the segmented grain boundaries match the microstructures well, the system-computed G values agree with manual ratings, the segmented second-phase features are reported as contrast-defined features (predominantly β-Al3Mg2), because their identity was established from the imaging-mode-specific contrast rather than from point-by-point EDS/XRD confirmation. Per-image comparisons of total second-phase particle counts were conducted between the proposed system and manual counting. Numerical cross-validation of grain-scale parameters, including grain-size number, equivalent grain diameter and boundary overlap, is yet to be accomplished.

Share and Cite:

Wei, L. , Yu, L. , Zheng, X. , Zhao, Q. , Huang, Y. and Jiang, Y. (2026) Quantitative Metallographic Analysis of Dual-Phase Microstructures in 5083 Aluminum Alloy: A Dual-Channel MATLAB Image-Processing System. World Journal of Engineering and Technology, 14, 903-920. doi: 10.4236/wjet.2026.144055.

1. Introduction

5083 aluminum alloy is a non-heat-treatable Al-Mg alloy that combines moderate strength, excellent seawater-corrosion resistance and good weldability and formability, and is widely used in shipbuilding, automotive lightweighting, aerospace and cryogenic storage equipment. Its properties depend strongly on the microstructure: the size and morphology of recrystallized grains govern strength and ductility, whereas continuous precipitation of the β phase (Al3Mg2) along grain boundaries is the root cause of intergranular corrosion (IGC) and stress-corrosion cracking (SCC), with the degree of sensitization correlating positively with the volume fraction and continuity of grain-boundary β phase [1] [2]. Severe plastic deformation fragments and disperses the β phase, markedly reducing the effective anodic area of the corrosion micro-galvanic couples and thereby improving corrosion resistance [3]; heat-treatment schedules likewise alter the electrochemical behavior through changes in β-phase precipitation [4]. Quantitative characterization of the grain and β-phase size, morphology and distribution therefore underpins process-microstructure-property relations for this alloy, yet the conventional chart-comparison rating is inefficient, subjective and unable to provide precise statistical parameters [5]. The growing demand for high-throughput, standardized microstructural data in integrated computational materials engineering (ICME) and data-driven materials design calls for automated quantitative solutions [6] [7].

Image segmentation is central to quantitative metallography. Global Otsu thresholding is computationally stable but sensitive to illumination non-uniformity, whereas adaptive thresholding computes a local threshold from neighborhood statistics and better resolves fine targets such as particulate precipitates [8]. The watershed transform separates touching objects by simulating immersion but is highly sensitive to spurious local minima caused by noise; marker-controlled watershed suppresses over-segmentation by pre-extracting a unique foreground marker for each object [9]. Recently, deep-learning models such as U-Net and the Segment Anything Model (SAM) have shown strong potential for microstructural segmentation [10] [11], but they require pixel-level annotation that is costly for specific alloy systems and generalize poorly across processing states. In contrast, microstructure-prior image-processing methods require no annotation, are interpretable and, once their parameter set is fixed, deterministic and reproducible, and remain of practical engineering value.

However, existing methods are generally restricted to “one method for one microstructure”. In annealed 5083 alloys the grains form a view-spanning continuous network, whereas the β phase consists of micrometer-scale particles distributed along grain boundaries, the two differing in scale by one to two orders of magnitude; preprocessing acting on global contrast therefore enhances the grain boundaries while easily annihilating the contours of the fine precipitates, and a single segmentation strategy cannot serve both targets. Moreover, most studies concentrate on the mean grain size and pay little attention to shape factors and distribution uniformity.

The contributions of this work are: 1) a dual-channel preprocessing-segmentation architecture that decouples global standardization from conservative local enhancement according to target scale, resolving in principle the engineering contradiction whereby fine precipitates are lost under global enhancement; 2) an improved marker-controlled watershed algorithm in which multi-scale gradient information guides binarization-path selection, seed generation and watershed-topography construction, with large/small-grain adaptive dual paths and a two-level fallback safeguard; 3) a parameter system oriented towards industrial ASTM rating and ICME data requirements, enabling the semi-automated, simultaneous extraction of the grain-size number G and multi-dimensional β-phase parameters; and 4) a validation protocol quantifies image-wise agreement between system outputs and manual references. It provides a fully documented fixed-seed parameter set (Table 1) and per-image secondphase particle count comparisons (Table 2), and explicitly identifies pending cross-validation tasks.

2. Image Dataset and Validation Benchmark

The validation set comprises 13 micrographs covering equiaxed recrystallized, thermomechanically processed, salt-bath-annealed and sand-cast conditions, acquired in OM grayscale, OM color and SEM-BSE modes, all with readable scale bars; images of salt-bath-annealed and severely plastically deformed microstructures were taken from published studies to broaden the microstructural coverage [12]. Image metadata (processing route, etchant, magnification, etc.) were recorded for traceability. The main function schedules calibration → preprocessing → segmentation → feature extraction → report output in a unidirectional flow; the system modules and data flow are shown in Figure 1. Because no point-by-point EDS or XRD phase identification was performed on these individual micrographs, the segmented constituents are described throughout this work as contrast-defined second-phase features, predominantly β-Al3Mg2: in the OM images they are the dark, etch-revealed constituents aligned along grain boundaries, whose continuous/chain-like or spheroidized morphology is the classical signature of the β phase in 5083 alloy, whereas in the SEM-BSE images they are identified by atomic-number contrast, the Mg-rich β phase appearing brighter than the Al matrix. The term β phase is retained as shorthand for this assignment, and the phase assignment given by the original authors is retained for the two images taken from published work [12].

Figure 1. System modules and data flow of the quantitative metallographic analysis system.

Workflow and user inputs. The workflow is semi-automated rather than fully automatic: four case-specific inputs are supplied by the operator—the two scale-bar endpoints (pixel calibration), the imaging mode (OM grayscale/OM color/SEM-BSE), the segmentation sensitivity and the minimum particle area. In batch mode the pixel equivalent calibrated on the first image is inherited by all remaining images, so that only the imaging mode and the two β-phase settings have to be entered per image. All remaining operations (preprocessing, segmentation, parameter extraction and report generation) then run without further intervention, image after image, through the batch module, and the operator-selected values are written together with the fixed internal parameters into the batch summary workbook (batch_results.xlsx) generated by the module. Section 3.5 documents which parameters are operator inputs and which are fixed, and Table 1 lists the values used in the present validation study.

The manual reference was established following GB/T 6394-2017 [13] and ASTM E112 [14]: grain size was measured by the intercept method (≥5 horizontal/vertical test lines, ≥50 intercepted grains) together with the planimetric method (≥20 complete grains), and the grain-size number G was computed manually by the ASTM E112 intercept procedure; the β phase was segmented by ImageJ thresholding followed by manual correction to add missed particles and remove mis-selected regions, and the resulting values were treated as manually assisted references rather than a strict gold standard. All manual measurements were performed by the same operator in three non-consecutive sessions and averaged (re-measured when the coefficient of variation exceeded 5%), and a second experienced investigator independently re-measured part of the images to assess inter-operator deviation. Automatic-versus-manual agreement was quantified mainly by the mean absolute relative error (acceptance reference ≤5%), complemented by Bland-Altman analysis of the bias against the measurement magnitude. For the numerical cross-validation added in this revision, the total second-phase particle counts obtained by the system and by the manually assisted counting are tabulated image by image in Table 2, together with the relative deviation of each value. The grain-scale parameters (grain-size number G, equivalent grain diameter and boundary overlap) are not compared numerically in this work, for the reasons stated in Section 4.3.

3. Dual-Channel Quantitative Metallographic Method

3.1. Dual-Channel Preprocessing

Based on the MATLAB Image Processing Toolbox [15], the grain channel performs a global standardization flow: after interactive scale-bar calibration (mouse-picking the two endpoints and converting the Euclidean pixel distance and the physical length into the pixel equivalent used throughout all size computations), a 3 × 3 median filter removes salt-and-pepper noise and a Gaussian filter (σ = 1.5) smooths the residual white noise; imadjust (stretchlim clipping ratio [0.2, 0.8]) then linearly stretches the gray levels to the full dynamic range, and a large-scale Gaussian (σ = 50) estimates the background for rolling-ball background correction, removing slow illumination gradients such as the center-bright/edge-dark vignetting.

Because β-phase particles often occupy fewer than several hundred pixels and are readily blurred or annihilated by global contrast enhancement, the β-phase channel encapsulates an independent light pipeline: after a 3 × 3 median filter, a very conservative CLAHE (ClipLimit = 0.01, NumTiles = [32 32]) performs local enhancement—the parameters being fixed by trial on multiple images, since stronger gain amplifies noise and weaker gain leaves the particles indistinguishable from the background—which is fully isolated from the global processing of the main flow.

3.2. Grain Segmentation: Multi-Scale-Gradient-Guided Marker-Controlled Watershed

The algorithm flow is shown in Figure 2. Its core idea is to unify binarization, seed generation and topography construction under multi-scale gradient information. 1) Gaussian gradient magnitudes at three scales (σ = 0.5, 1.0, 2.0) are fused with weights 0.4, 0.35 and 0.25 and non-maximum suppression, the smallest scale carrying the largest weight to capture fine grain boundaries and the largest scale suppressing noise-induced false edges; the mean gradient (threshold 0.05) distinguishes large-grain from small-grain images, the former using a global Otsu threshold (level scaled by 1.1 for dark boundaries and by 0.8 for bright ones) and the latter a local adaptive threshold (adapt thresh with a sensitivity of 0.4), with the foreground polarity set automatically from the brightness of the boundaries (mean-to-maximum gray-level ratio, threshold 0.6), and when the binarized foreground contains fewer than 300 pixels the routine falls back to global Otsu supplemented by closing (disk of radius 2) and hole filling. 2) A gradient-enhanced distance map (distance − 0.5 × gradient × max(size)) is processed by an h-minima transform (h = 3 for large grains, h = 1.5 for small grains; the depth is therefore selected by the large-/small-grain path and is not an operator input), which suppresses spurious local minima that are shallower than h, retaining only the true grain basins as seeds; when fewer than five seeds remain they are supplemented by random sampling of the residual distance-map minima, carried out under a fixed random seed (rng(42) is set once at the start of the pipeline, so that repeated runs on the same image with the same parameter set generate identical seeds and identical segmentations), and nearby seeds of the same grain are merged by an opening with adaptive radius (3 pixels/1 pixel) to prevent over-segmentation. 3) The watershed input is the negative distance map plus a weighted gradient (watershed_input = -distance + 0.3 × grad × max(size)), with seed values implanted at the markers, guaranteeing continuous, one-pixel-wide grain boundaries; after segmentation, a 5% border width is cleared to suppress edge artifacts and an area threshold removes spurious regions.

Figure 2. Flowchart of the improved marker-controlled watershed algorithm integrating multi-scale gradient information.

3.3. β-Phase Segmentation: Imaging-Mode-Adaptive Thresholding

β-phase segmentation switches strategy according to the imaging mode selected by the user. For OM grayscale images, block-wise adaptive Otsu thresholding computes a maximum-between-class-variance threshold independently in each image block, avoiding mis-segmentation caused by non-uniform illumination and by the close gray levels of grain boundaries and the β phase. For OM color images, the image is converted to the CIELAB space, where a colour mask is built from the multi-channel CIELAB/HSV/YCbCr signature of the β phase and combined with the gray-level threshold mask—by union on low-contrast images that contain many dark regions and by intersection otherwise—so that the colour evidence can widen but never narrow the detection on difficult images.

For SEM-BSE images, atomic-number contrast renders the β phase brighter than the matrix, and the foreground polarity is automatically switched to bright. The segmentation sensitivity (default 0.35) and minimum particle area (default 1 μm2) are set interactively by the operator, and the values actually used for each image are written by the batch module into the batch summary workbook (batch_results.xlsx) and into the per-image text report (Section 3.5, Table 1); post-processing applies, with a disk structuring element of radius 1 pixel, opening (to separate touching particles), closing (to bridge broken particles), hole filling and area-threshold denoising (the threshold is max(5 pixels, round(A_min/scale2)), so that the minimum particle area is enforced in physical units with a five-pixel floor). In all three imaging modes, the classification of the segmented objects as β-Al3Mg2-type constituents rests on the consensus of the imaging evidence—etch response, grain-boundary-aligned morphology and gray-level signature in the OM images, atomic-number contrast in the BSE images—rather than on point-by-point EDS/XRD identification, and the objects are therefore reported as contrast-defined second-phase features (predominantly β-Al3Mg2).

3.4. Parameter Extraction

Grain parameters include area, equivalent diameter deq = 2(A/π)0.5, perimeter and total grain-boundary length; the mean grain-boundary spacing is obtained by the intercept method of GB/T 6394 with 50 random test lines in each of the horizontal and vertical directions (rng(42) fixes the random seed; it is set at the start of the pipeline, before any stochastic step, so that both these test lines and the seed-fallback sampling of Section 3.2 are deterministic); the grain-size number G is computed by the ASTM E112 [14] intercept procedure from the number of intercepts per unit length NL (mm-¹) along 45° test lines, with the test-line/intercept overlay plotted for inspection. β-phase parameters include the area fraction, mean equivalent diameter, aspect ratio (the key morphological index distinguishing chain-like sensitized β phase from equiaxed spheroidized β phase), circularity C = 4πA/P2, Feret diameter (approximated by the bounding-box diagonal when bwferet is unavailable) and number density.

Two caveats apply: first, parameter extraction uses imclearborder to count only complete interior grains, so the total grain-boundary length is systematically underestimated (typically <5%) and the mean spacing correspondingly overestimated, the bias direction being consistent across processing comparisons; second, the distribution uniformity of the β phase expressed by the coefficient of variation of nearest-neighbor distances is inflated by image boundary effects and must be quoted with caution in absolute terms. The system also integrates second-phase statistics and a batch_process module, and automatically generates PDF and text reports containing charts and data tables; in batch mode all per-image parameter values and all extracted parameters are additionally written into a single Excel summary workbook (batch_results.xlsx), one row per image.

3.5. User Inputs, Tuned Parameters and Reproducibility

Only four quantities are case-specific operator inputs; every other parameter is an internal constant of the algorithm. Table 1 documents the complete parameter set as it is implemented in the module listing: the quantity, its default value in the code, whether it is set by the operator for individual images or fixed once, and the values used for the 13 validation micrographs of the present study. The operator-set quantities (pixel equivalent, imaging mode, β-phase segmentation sensitivity and minimum particle area) are written by the batch module, one row per image, into the batch summary workbook (batch_results.xlsx) together with the fixed internal parameters and the random seed, so that any reported result can be traced back to the exact parameter set that produced it. Note that the h-minima depth is not among the operator inputs: it is selected by the algorithm as h = 3 or h = 1.5 according to the large-/small-grain path, and the same is true of the polarity rule, the Otsu level multipliers and the adaptive-threshold sensitivity of the grain channel. This is what distinguishes the present workflow from a fully automatic one: the manual intervention is reduced to a small, explicit and auditable set of choices, while the image-by-image processing itself is deterministic.

Table 1. Parameter set of the semi-automated dual-channel workflow: defaults, operator-set quantities and the values used for the 13 validation micrographs.

Parameter

Default/value in the code

Operator-set

Value used for the 13 validation micrographs

Pixel equivalent (scale-bar calibration)

interactive: two mouse-picked endpoints plus the entered physical length

Yes, per image (in batch mode entered once and inherited by the remaining images)

calibration targets: 50 μm scale bar (images 1 - 9), 100 μm (image 10), 150 μm (image 11), x200 objective (images 12 - 13); the resulting μm/pixel values are recorded in the batch summary workbook

Imaging mode (OM grayscale/OM color/SEM-BSE)

interactive selection

Yes, per image

operator-selected per image; the etching and acquisition annotation of the 13 validation micrographs is given in Table 2

Median filter + Gaussian smoothing

3 × 3 median; σ = 1.5

No (fixed)

-

Contrast stretching (imadjust, stretchlim)

clip ratio [0.2 0.8]

No (fixed)

-

Rolling-ball background correction (large Gaussian)

σ = 50, with a 95th-percentile floor

No (fixed)

-

CLAHE local enhancement (β-phase channel)

ClipLimit = 0.01, NumTiles = [32 32]

No (fixed)

-

Multi-scale gradient (scales/weights)

0.5, 1.0, 2.0/0.4, 0.35, 0.25

No (fixed)

-

Large-/small-grain decision (mean gradient)

0.05

No (fixed)

-

Boundary-polarity rule (mean-to-maximum gray-level ratio)

0.6

No (fixed)

-

Otsu level multipliers, large-grain path

1.1 (dark boundaries)/0.8 (bright boundaries)

No (fixed)

-

Local adaptive-threshold sensitivity, small-grain path

adaptthresh, sensitivity = 0.4

No (fixed)

-

Binarization fallback threshold

<300 foreground pixels (global Otsu + closing with a disk of radius 2 + hole filling)

No (fixed)

-

h-minima depth h

3 (large-grain path)/1.5 (small-grain path), selected by the path

No - algorithm-selected, not tuned per image

3 or 1.5 according to the path; no operator input

Gradient weight in the seed map/in the watershed input

0.5/0.3

No (fixed)

-

Seed merging (opening radius)/minimum seed area

disk 3 px (large grains)/1 px (small grains); 3 px

No (fixed)

-

Border width cleared after segmentation

5% of min(rows, cols)

No (fixed)

-

β-phase segmentation sensitivity

0.35

Yes, per image

recorded per image in the batch summary workbook (batch_results.xlsx)

Minimum particle area

1 μm2, enforced with a five-pixel floor: max(5, round(A_min/scale^2))

Yes, per image

recorded per image in the batch summary workbook (batch_results.xlsx)

β-phase structuring element (opening, closing, hole filling)

disk of radius 1 px

No (fixed)

-

Intercept test lines (mean grain-boundary spacing)

50 horizontal + 50 vertical random lines

No (fixed)

-

Random seed for all stochastic steps

rng(42), set once at the start of the pipeline (revised)

No (fixed)

-

Batch summary output

batch_results.xlsx (one row per image) plus the per-image text/PDF report

No (fixed)

-

The operator-set values and the random seed are written by the batch module into the batch summary workbook and into the per-image text report; the calibration targets and annotations quoted in the last column are those of the validation record.

4. Validation Results

4.1. Grain Segmentation and Grain Size

The superimposed grain boundaries (Figure 3) show that, for micrographs of different complexity, the automatically segmented boundaries conform well to the true boundaries: the contours are complete and closed in regular equiaxed regions, and the algorithm still tracks the boundary path accurately in complex regions containing twins or locally curved boundaries, with only slight deviations at extremely low-contrast sites or boundary junctions. The comparison of the automatic boundaries with a Canny-edge map used in the previous version of this work has been removed, because an edge detector is not an independent reference for boundary accuracy: what such a comparison measures is dominated by the shared gradient content of the two maps rather than by the correctness of the grain boundaries. The boundary assessment in this work is therefore presented explicitly as the visual conformity check described above, and a quantitative boundary-overlap metric computed against manually annotated boundaries is identified in Section 4.3 as the first task of the ongoing validation work. Repeated comparison of the system-computed G with manual ASTM E112 ratings (Figure 4) shows that their deviations are generally small and satisfy the accuracy requirement of quantitative rating, indicating the applicability of the system to industrial grain-size inspection.

Figure 3. Superimposition of automatically segmented grain boundaries on micrographs of different complexity.

It should be noted that the grain-level validation rests on two levels of evidence only: the visual assessment of boundary conformity (Figure 3) and the rating consistency of the grain-size number G (Figure 4). The corresponding numerical comparison—image-by-image automatic and manual values of G and of the equivalent grain diameter, together with a boundary-overlap metric computed against manually annotated grain boundaries—is not available for these specimens and is the first task of the ongoing work (Section 4.3). The validation set (13 micrographs, four processing states) also remains modest in size and does not cover all artifacts met in industrial practice, such as very fine grains, heavy etching or weld-nugget substructures.

Figure 4. Example of automatic determination of the ASTM grain-size number G.

4.2. β-Phase Segmentation and Second-Phase Statistics

The superimposed β-phase masks (Figure 5) show that, for well-dispersed particles, the mask fully labels the precipitates with contours matching the true boundaries, and that in aggregated/touching regions there is no large-scale omission or mis-detection, although separating the very small particles remains difficult. The total number of second-phase particles obtained automatically and by manually assisted counting for the 13 micrographs is compared in Figure 6.

Figure 5. Segmentation masks superimposed on micrographs with different β-phase contents.

As seen in Figure 6, the automatic and manually assisted particle counts follow essentially the same trend, with the automatic counts slightly lower for most samples. The mean absolute relative error is 1.48% (maximum 3.37%), the Pearson correlation coefficient is 0.9953 and the linear-fit slope is 0.980, the automatic result being systematically low by about 0.90%. The negative bias is concentrated in images with complex boundary contrast where the β phase and grain boundaries have close gray levels, because very small particles buried in the boundaries are removed by the area threshold or merged with the boundaries and thus missed. Because the area fraction and the particle number are derived from the same binary mask, an accurate particle count does not by itself establish the accuracy of the derived parameters, and the per-image agreement of the count is therefore tabulated rather than inferred. The area fraction and the mean equivalent diameter, which follow the statistics of the same mask, were checked against the manually corrected masks at the level of the overall trend only, and no image-by-image values are reported here; the second-order morphological quantities (aspect ratio and circularity) are the most sensitive outputs, the aspect ratio of fine touching particles tending to be overestimated after the regularizing opening/closing operations. Such parameters are best used as relative references for processing comparisons, with manual verification for absolute morphological descriptions.

Figure 6. Comparison of the total number of second-phase particles between automatic and manually assisted counting.

4.3. Numerical Cross-Validation and Its Limits

The grain-scale outputs are not cross-validated numerically in this work, and we prefer to state this openly rather than to report a validation that our present data cannot support. The grain-level evidence is limited to the two checks reported above: the visual conformity of the superimposed boundaries (Figure 3) and the consistency of the system-computed grain-size number G with the manual ASTM E112 rating (Figure 4). The comparison of the automatic boundaries with a Canny-edge map used in an earlier version of this work has been removed, because an edge detector is not an independent reference for boundary accuracy.

A quantitative grain-scale validation therefore requires (i) manually annotated grain boundaries on a defined subset of the validation images together with a single boundary-overlap metric, for example the Dice coefficient of the boundary pixel sets at a fixed tolerance, and (ii) image-by-image automatic and manual values of G and of the equivalent grain diameter. The annotated references are not yet available for these specimens, and completing both items is the first task of the ongoing validation work.

For the second-phase channel, the per-image comparison that our data do support is reported in Table 2: the total particle count of each of the 13 micrographs is listed together with the relative deviation of the system value with respect to the manually assisted count. Over the whole set the mean absolute relative deviation is 1.48% and the maximum is 3.37%, with a Pearson correlation coefficient of 0.9953 and a systematic underestimation of about 0.90% (Figure 6); the largest deviations occur in the images in which the β phase and the grain boundaries have close gray levels. The remaining β-phase outputs are qualified as follows: the area fraction and the mean equivalent diameter are derived from the same binary mask as the count and were checked against the manually corrected masks

Table 2. Per-image comparison of the total second-phase particle count obtained by the system and by manually assisted counting; the relative deviation is referred to the manual count.

Image

Alloy state and etchant

Particles (system)

Particles (manual)

Relative deviation (%)

I1

thermomechanically treated, Keller's reagent

1429

1459

-2.06

I2

annealed, Keller's reagent

898

917

-2.07

I3

process route 1-1, Keller's reagent

1369

1389

-1.44

I4

process route 1-1, Keller's reagent

1610

1591

+1.19

I5

intermediate and recrystallization annealed, mixed acid

1547

1601

-3.37

I6

intermediate and recrystallization annealed, mixed acid

1151

1171

-1.71

I7

intermediate and recrystallization annealed, mixed acid

1023

1025

-0.20

I8

intermediate and recrystallization annealed, mixed acid

1210

1192

+1.51

I9

intermediate and recrystallization annealed, mixed acid

1102

1121

-1.69

I10

annealed, mixed acid

1350

1362

-0.88

I11

salt-bath annealed, anodic etching

1254

1241

+1.05

I12

Na-modified, 0.5% HF

1421

1440

-1.32

I13

sand cast, 0.5% HF

1342

1352

-0.74

Mean absolute deviation

-

-

-

1.48

Maximum deviation

-

-

-

3.37

at the level of the overall trend, but no image-by-image numerical values are reported here; the second-order morphological parameters (aspect ratio, circularity) are the outputs most sensitive to the segmentation post-processing and are therefore presented as relative references for processing comparisons only.

I1-I13 denote the 13 validation micrographs in the same order as Figure 6; the relative deviation is (system − manual)/manual × 100%. The mean signed deviation (systematic bias) is −0.90% and the Pearson correlation coefficient between the two counts is 0.9953.

The purpose of this section is not to demonstrate an unqualified agreement, but to delimit, with explicit numbers, which outputs can be used directly and which still require manual verification.

5. Discussion

5.1. Physical Basis of the Dual-Channel Architecture

A typical failure mode in quantitative metallography is not that the segmentation algorithm fails to converge, but that the preprocessing scale is mismatched with the target scale: the grain-boundary network is a view-spanning continuous topology requiring global contrast stretching and background correction for large-scale gray-level uniformity, whereas β-phase particles are only a few micrometers in size and often occupy fewer than several hundred pixels, so that global enhancement pushes them into over- or under-exposed regions where they are then confused with grain boundaries and etch pits. Placing global standardization and conservative local enhancement (CLAHE, ClipLimit = 0.01) in two separate channels is an explicit modelling of the match between the enhancement scale and the target scale, and is the essential feature distinguishing the present system from single-pipeline general-purpose schemes.

5.2. Adaptivity Mechanisms and Failure Boundaries

The adaptive design of grain segmentation (dual-path binarization, gradient-enhanced seeding and the two-level fallback) keeps the algorithm robust under image-quality fluctuation. Its failure boundaries are nonetheless clear.

1) the watershed accuracy is limited by the input gradient quality, and for images with blurred boundaries or abundant substructures, such as weld nuggets and severely deformed microstructures, the multi-scale gradient cannot provide a unique watershed cue, so under- or over-segmentation becomes more likely [16].

2) the β-phase segmentation sensitivity and the minimum particle area are still set by the operator for individual images, so the pipeline is semi-automated rather than fully automatic; the h-minima depth, by contrast, is not a free parameter, because it is selected by the algorithm as h = 3 or h = 1.5 according to the large-/small-grain path; the operator-set values used for the 13 micrographs of this study are recorded in Table 1 and in the batch summary workbook (batch_results.xlsx) written by the system, which makes every adjustment explicit, auditable and repeatable, and all stochastic steps are seeded (rng(42)), so that repeated runs with the same parameter set give identical results; the residual operator dependence lies in the choice of the sensitivity itself, and a standard rule for that choice has yet to be incorporated into the operating procedure.

3) etch quality is the most critical front-end error source-under-etching leaves an insufficient gray-level difference between the β phase and the matrix, which no algorithmic parameter can remedy. Quantitative images intended for β-phase sensitization rating must therefore strictly control the etch depth and time, and the segmentation-sensitivity calibration must be incorporated into the standard operating procedure to guarantee cross-batch comparability.

5.3. Engineering and Scientific Value of the Quantitative Data

A mean absolute relative error of 1.48% and a correlation coefficient of 0.9953 indicate that the system can replace manual counting in high-throughput screening, while the workflow itself remains semi-automated: the pixel equivalent, the imaging mode, the segmentation sensitivity and the minimum particle area are operator inputs (Table 1). Its systematic underestimation of about 0.9% has a definite direction that can be further corrected by an empirical compensation factor. The standardized multi-dimensional parameters output by the system serve three kinds of demand: 1) industrial grain-size inspection, where automatic G computation connects directly to ASTM/GB rating procedures; 2) ICME and data-driven research, providing microstructural inputs for materials databases and constitutive-model calibration [6] [7]; and 3) fusion with deep learning, where the modular interface allows embedding U-Net or SAM for boundary refinement, forming a hybrid “conventional initial segmentation + deep-model refinement”architecture that balances accuracy and generalization with limited annotation data [10] [11] [17]. Compared with similar MATLAB-based quantitative pipelines [15], the present system is more complete in dual-channel parallel segmentation and parameter dimensionality, and provides evidence controlled both by publicly sourced images and by a manual benchmark, the validation now including the image-by-image comparison of the second-phase particle counts (Section 4.3, Table 2).

6. Conclusions

1) A dual-channel preprocessing-segmentation architecture for the dual-phase microstructure of 5083 aluminum alloy is proposed, decoupling global standardization (median-Gaussian filtering, imadjust stretching, rolling-ball background correction) from conservative local enhancement (CLAHE, ClipLimit = 0.01) by target scale, thereby resolving in principle the contradiction of fine precipitates being lost under global enhancement.

2) Grain segmentation adopts a multi-scale-gradient-guided improved marker-controlled watershed with adaptive dual-path binarization, gradient-enhanced seeding and a two-level fallback to suppress over-segmentation; the segmented boundaries conform well to the true microstructure, and the system-computed ASTM grain-size number G agrees with manual ratings.

3) β-phase segmentation switches adaptively among block-wise Otsu, CIELAB color masking and foreground-polarity strategies according to the OM grayscale, OM color and SEM-BSE imaging modes; the total number of second-phase particles obtained automatically and by manually assisted counting for 13 micrographs shows a mean absolute relative error of 1.48% and a correlation coefficient of 0.9953. It shows the capability to replace manual counting in semiautomated high-throughput screening, with per-image particle counts and their deviations quantified.

4) The system outputs multi-dimensional standardized grain and β-phase parameters within a fixed-seed, fully documented parameter set, supporting process-microstructure-property studies and data-driven materials design; boundary-grain exclusion, edge clearing and the nearest-neighbor boundary effect are the main methodological bias sources. The remaining limitations are the modest size of the validation set, the per-image adjustment of the β-phase segmentation sensitivity and the absence of point-by-point phase identification; enlarging the annotated validation set, standardizing the sensitivity selection and extending the fusion with deep models and three-dimensional characterization define the directions of future improvement.

Highlights

  • A dual-channel preprocessing-segmentation architecture decouples global standardization from conservative local enhancement, preserving micron-scale β-phase (Al3Mg2) precipitates that would otherwise be lost under global contrast stretching.

  • A multi-scale-gradient-guided marker-controlled watershed with adaptive dual-path binarization and a two-level fallback reliably segments recrystallized grains of varying complexity.

  • An imaging-mode-adaptive thresholding strategy (OM grayscale/OM color/SEM-BSE) in a semi-automated workflow achieves a mean absolute relative error of 1.48% (r = 0.9953) for second-phase particle counting against manually assisted counting.

Funding

This work was supported by the Guangxi Science and Technology Program (Project No. Guike AB25069214/2024AB33384), the Open Fund of the Key Laboratory of New Processing Technology for Nonferrous Metal & Materials, Ministry of Education/Guangxi Key Laboratory of Optical and Electronic Materials and Devices (Nos. 22AA-11 and 20KF-4), and the Guangxi Innovation Driven Development Project (Grant No. AA17204021).

Author Contributions

Conceptualization, L.W. and Y.J.; methodology, L.W.; software, L.W.; validation, L.W., L.Y. and X.Z.; formal analysis, L.W.; investigation, L.W., L.Y. and Q.Z.; resources, X.Z. and Q.Z.; data curation, L.W.; writing-original draft preparation, L.W.; writing-review and editing, L.W. and Y.J.; visualization, L.W.; supervision, Y.J.; project administration, Y.J.; funding acquisition, Y.J. All authors have read and agreed to the published version of the manuscript.

Conflicts of Interest

The authors declare no conflicts of interest regarding the publication of this paper.

References

[1] Peng, C., Zhang, L., Fu, Q. and Huang, Y. (2025) The Effect of Low Temperature Sensitization on the Corrosion Process of the 5083 Al Alloy in Artificial Seawater. Electrochimica Acta, 544, Article ID: 147662.[CrossRef]
[2] Ding, Y., Wu, X., Gao, K., Huang, C., Xiong, X., Huang, H., et al. (2020) The Influence of Stabilization Treatment on Long-Term Corrosion Resistance and Microstructure in Er and Zr Containing 5083 Aluminum Alloy. Materials Characterization, 161, Article ID: 110143.[CrossRef]
[3] Karimi, S., Fakhar, N., Faraji, M. and Fereshteh-Saniee, F. (2024) Simultaneous Improvement of Mechanical Strength and Corrosion Resistance in Aluminum Alloy 5083 via Severe Plastic Deformation. Materials Chemistry and Physics, 313, Article ID: 128755.[CrossRef]
[4] Yang, Y., Zhou, W., Tong, Z., Chen, L., Yang, X., Larson, E.A., et al. (2019) Electrochemical Corrosion Behavior of 5083 Aluminum Alloy Subjected to Laser Shock Peening. Journal of Materials Engineering and Performance, 28, 6081-6091.[CrossRef]
[5] Holm, E.A., Cohn, R., Gao, N., Kitahara, A.R., Matson, T.P., Lei, B., et al. (2020) Overview: Computer Vision and Machine Learning for Microstructural Characterization and Analysis. Metallurgical and Materials Transactions A, 51, 5985-5999.[CrossRef]
[6] Rickman, J.M., Lookman, T. and Kalinin, S.V. (2019) Materials Informatics: From the Atomic-Level to the Continuum. Acta Materialia, 168, 473-510.[CrossRef]
[7] Raguraman, S., Priyadarshini, M.S., Nguyen, T., McGovern, R., Kim, A., Griebel, A.J., et al. (2024) Machine Learning-Guided Accelerated Discovery of Structure-Property Correlations in Lean Magnesium Alloys for Biomedical Applications. Journal of Magnesium and Alloys, 12, 2267-2283.[CrossRef]
[8] Subbarayan, S. and Ramanathan, S.K. (2009) Effective Watermarking of Digital Audio and Image Using Matlab Technique. 2009 2nd International Conference on Machine Vision, Dubai, 28-30 December 2009, 317-319.[CrossRef]
[9] Vincent, L. and Soille, P. (1991) Watersheds in Digital Spaces: An Efficient Algorithm Based on Immersion Simulations. IEEE Transactions on Pattern Analysis and Machine Intelligence, 13, 583-598.[CrossRef]
[10] Luengo, J., Moreno, R., Sevillano, I., Charte, D., Peláez-Vegas, A., Fernández-Moreno, M., et al. (2022) A Tutorial on the Segmentation of Metallographic Images: Taxonomy, New Metaldam Dataset, Deep Learning-Based Ensemble Model, Experimental Analysis and Challenges. Information Fusion, 78, 232-253.[CrossRef]
[11] Kirillov, A., Mintun, E., Ravi, N., Mao, H., Rolland, C., Gustafson, L., et al. (2023) Segment Anything. 2023 IEEE/CVF International Conference on Computer Vision (ICCV), Paris, 2-6 October 2023, 3992-4003.[CrossRef]
[12] Xia, S.L., Ma, M., Zhang, J.X., Wang, W.X. and Liu, W.C. (2014) Effect of Heating Rate on the Microstructure, Texture and Tensile Properties of Continuous Cast AA 5083 Aluminum Alloy. Materials Science and Engineering: A, 609, 168-176.[CrossRef]
[13] GB/T 6394-2017 (2017) Determination of Estimating the Average Grain Size of Metal. Standards Press of China.
[14] ASTM E112-13 (2013) Standard Test Methods for Determining Average Grain Size. ASTM International.
[15] Akhmetova, G., Kudrya, A. and Panin, E. (2024) Universal Technique for Information and Digital Analysis of Steel and Alloy Structures Using Matlab. MethodsX, 13, Article ID: 103059.[CrossRef] [PubMed]
[16] Tobar, M.J., Lamas, M.I., Yáñez, A., Sánchez-Amaya, J.M., Boukha, Z. and Botana, F.J. (2010) Experimental and Simulation Studies on Laser Conduction Welding of AA5083 Aluminium Alloys. Physics Procedia, 5, 299-308.[CrossRef]
[17] Furqan, A. and Kumar, M. (2015) Study and Analysis of Robust DWT-SVD Domain Based Digital Image Watermarking Technique Using Matlab. 2015 IEEE International Conference on Computational Intelligence & Communication Technology, Ghaziabad, 13-14 February 2015, 638-644.[CrossRef]

Copyright © 2026 by authors and Scientific Research Publishing Inc.

Creative Commons License

This work and the related PDF file are licensed under a Creative Commons Attribution 4.0 International License.