Aluminum alloy surface oxidation spot defect identification method and device based on machine vision
By employing a multi-level collaborative innovation approach based on machine vision, the problem of detecting oxide spot defects on aluminum alloy surfaces has been solved. This approach achieves high precision, low false alarm rate, and efficient defect identification, adapting to oxide spot detection on curved workpieces and reducing inspection costs.
Patent Information
- Application Number
- CN202511403471.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-09-29
- Publication Date
- 2025-11-04
- Estimated Expiration
- 2045-09-29
AI Technical Summary
Existing technologies for detecting oxide spot defects on aluminum alloy surfaces suffer from poor surface adaptability, high false alarm rate, high false alarm rate, and insufficient process response. In particular, in the manufacturing of high-end automotive wheels, it is difficult to effectively identify 0.5-3mm cloud-like patches and 0.1-0.8mm micro-pinhole-like pits.
A multi-level collaborative innovation approach based on machine vision is adopted, including optical preprocessing, algorithm segmentation, geometric modeling and dynamic process compensation. A ring diffuse reflection light source array is used to eliminate surface reflection interference, CLAHE and improved Sauvola threshold segmentation are used to enhance defect segmentation, multi-scale B-spline curvature detection is used to optimize the boundary, Kirkpatrick trapezoidal graph decomposition is used to establish a spatial topology index, and CART decision tree is used to encode defect type and determine level.
It achieves high-precision identification of oxide spot defects on aluminum alloy surfaces, reduces the false alarm rate of reflective areas, improves the pinhole detection rate, shortens the detection time, reduces costs, and solves the problems of poor surface adaptability and insufficient process response.
Smart Images

Figure CN120894358A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of intelligent manufacturing and industrial automation technology, and in particular to a method and device for identifying oxide spot defects on aluminum alloy surfaces based on machine vision. Background Technology
[0002] In high-end automotive wheel manufacturing plants, 6061 aluminum alloy is used to produce lightweight wheels. During the anodizing process, fluctuations in electrolyte concentration can easily lead to hidden oxide spot defects on the wheel surface. These defects manifest as hazy patches with indistinct boundaries (0.5-3mm) and micro-pinhole-like pits (0.1-0.8mm in diameter and ≤50μm in depth). These defects not only damage the product's appearance but also cause stress concentration, resulting in a decrease in component fatigue strength of over 60%, seriously threatening equipment safety. Current inspection technologies face three limitations: high missed detection rate (18-25% missed detection for pinholes <0.3mm), low efficiency (over 2 minutes for single-piece inspection of curved workpieces), and strong subjectivity (30% discrepancy rate in judging hazy spots).
[0003] Traditional machine vision methods suffer from poor adaptability to curved surfaces, leading to 12.7% feature drift and 15% false alarms in the spoke area due to fixed mesh segmentation. Micro-defect capture fails, manifested by the inability of global thresholds to identify low-contrast cloud-like spots with a grayscale difference of <8, and morphological processing to eliminate real pinholes <3 pixels. Furthermore, insufficient dynamic process response makes it difficult for static feature libraries to adapt to changes in oxide spot diffusion morphology. Fundamentally, existing algorithms suffer from a triple disconnect: a spatial dimension (the mismatch between rigid meshes and curved surface geometry), a scale dimension (the inability of fixed operators to simultaneously address macro / micro defects), and a process dimension (the lack of a dynamic oxide spot growth quantification mechanism). Summary of the Invention
[0004] The technical problem to be solved by this invention is to provide a method and device for identifying oxide spot defects on aluminum alloy surfaces based on machine vision. Through three-level collaborative innovation of optics, algorithm and process, it can achieve a breakthrough in reducing the false alarm rate of curved surface reflection, increasing the detection rate of pinholes and achieving a boundary accuracy of ±0.2 pixels. Combined with dynamic process compensation to cover concentration fluctuations of 10-30g / L, it ultimately achieves a closed-loop solution to the pain points of the entire industry with a single-piece inspection time of 9.3 seconds and annual cost savings of 4.8 million yuan.
[0005] To solve the above-mentioned technical problems, the technical solution of the present invention is as follows: In a first aspect, a machine vision-based method for identifying oxide spot defects on aluminum alloy surfaces, the method comprising: Step S1: Acquire a color image of the aluminum alloy surface and preprocess the image to extract the brightness component image; Step S2: Perform adaptive threshold segmentation for local contrast enhancement on the brightness component image, generate a binary mask for the defect region, extract morphological connected components based on the mask, and calculate three basic feature indicators: area pixel value, contour Fourier descriptor complexity, and regional grayscale standard deviation contrast of each connected component. Step S3: Extract the labeled connected domain boundaries, verify the boundary closure topology, and dynamically generate curvature-driven adaptive sampling points through multi-scale B-spline curvature extremum detection; Step S4: Based on the sampling point set, construct the minimum convex hull boundary, perform non-uniform quadtree partitioning on the convex hull boundary, and generate the surface Bezier fragments of the boundary constraints of the defect region. Step S5: Based on the curved Bezier fragments, a spatial topological index is established by hierarchical decomposition using Kirkpatrick trapezoidal diagrams. The regularized area deformation rate of each element relative to the ideal oxide film region is calculated, and a dynamic morphological compensation factor is generated based on the standard deviation of the deformation rate set. Step S6: The generated compensation factor and the three basic indicators are fused and corrected through the nonlinear mapping of the feature space of the radial basis function kernel to obtain the optimized defect feature tensor; Step S7: Input the defect characterization vector into the CART decision tree classifier, embed the dynamic compensation coefficient of the electrolyte concentration process parameter, and obtain the type code and standard defect level of the oxide spot defect.
[0006] Further, in step S2, adaptive threshold segmentation with local contrast enhancement is performed on the luminance component image to generate a binary mask of the defect region. Morphological connected components are extracted based on the mask, and three basic feature indicators are calculated for each connected component: area pixel value, contour Fourier descriptor complexity, and region gray-level standard deviation contrast. Step S21: Divide the brightness component image into local sub-regions and limit the slope of the histogram distribution to enhance the low-contrast cloud-like oxide spots, so as to obtain an image with contrast enhancement. Step S22: Perform improved Sauvola local thresholding on the enhanced image, obtain the mean and standard deviation of gray levels within the local window, and dynamically calculate the pixel-level threshold function based on the mean and standard deviation to generate a high-precision defect binary mask. Step S23: By scanning the mask pixels, establish connected region labels, filter out noise and pseudo-defects with an area of less than 5px, and obtain a set of independent connected regions; Step S24: Based on the set of independent connected components, count the total number of valid pixels within the connected components and calculate the pixel-level geometric area features; Step S25: Extract the boundary point sequence based on the set of independent connected components, calculate the 7th order Zernike orthogonal moments, quantify the contour irregularity through the variance of the moment modulus, and obtain the contour spectral complexity based on Zernike moments; Step S26: Calculate the standard deviation of pixel grayscale within the connected region based on the connected region, and use the standard deviation value to characterize the contrast difference between the defect and the background to obtain the local grayscale standard deviation contrast.
[0007] Further, in step S3, the boundaries of the labeled connected components are extracted and the boundary closure topology is verified. Curvature-driven adaptive sampling points are dynamically generated through multi-scale B-spline curvature extremum detection, including: Step S31: Based on the set of independent connected components, extract the complete boundary coordinate point set of each connected component to obtain the marked connected component boundary; Step S32: Select any reference point from the set of marked connected domain boundary points and emit a four-way ray. Detect the odd number of intersections between the ray and the boundary edge, identify non-closed boundaries and remove the corresponding connected domains to obtain a set of verified closed boundaries. Step S33: Based on the closed boundary set, fit the smooth parameter curve using cubic B-spline basis functions, iteratively adjust the control point density in scale space, eliminate pixel-level jagged noise and retain the true geometric features, and obtain the multi-scale B-spline fitting curve. Step S34: Calculate the Gaussian curvature value at each point on the parameter fitting curve, locate the local extrema of curvature in the scale space, filter out invalid extrema points whose absolute curvature value is less than the threshold, and obtain the curvature distribution; Step S35: Dynamically generate sampling points based on curvature distribution to obtain curvature-driven adaptive sampling points.
[0008] Further, in step S4, based on the sampling point set, a minimum convex hull boundary is constructed, and the convex hull boundary is non-uniformly partitioned into quadtrees to generate surface Bezier fragments for the boundary constraints of the defect region, including: Step S41: Based on the curvature-driven adaptive sampling point set, sort the point set by polar coordinates and establish a convex hull topology chain, filter out all internal concave points to eliminate local distortion, and generate the minimum convex polygon closed boundary that encloses the defect area. Step S42: Based on the closed boundary of the smallest convex polygon, perform a first-level subdivision with the convex hull as the initial bounding box, calculate the average curvature of the boundary of each sub-partition, and obtain a quadtree structure with non-uniform depth. Step S43: Based on the non-uniform depth quadtree structure, extract the leaf node corner points as Bezier control points, use bicubic parametric surface fitting to fit the local geometry, force the convex hull boundary to be the common edge of adjacent fragments, and generate the surface Bezier fragments with boundary constraints of the defect region.
[0009] Further, in step S5, based on the surface Bezier fragments, a spatial topological index is established using Kirkpatrick trapezoidal decomposition. The regularized area deformation rate of each element relative to the ideal oxide film region is calculated. A dynamic morphological compensation factor is generated based on the standard deviation of the deformation rate set, including: Step S51: Organize the curved Bezier fragments into a tree-like index structure to establish a fast query mechanism for cell adjacency relationships, so as to construct a spatial topology index; Step S52: Based on the constructed spatial topology index, obtain the actual pixel area of the current unit, calculate the theoretical area based on the ideal oxide film uniform thickness model, and generate a regularized deformation rate through the area ratio to obtain a set of regularized area deformation rates; Step S53: Based on the set of deformation rates, statistically analyze the discrete distribution of deformation rates of all grid elements, calculate the standard deviation of the set of deformation rates, and obtain the dynamic morphological compensation factor.
[0010] Further, in step S6, the generated compensation factor and the three basic indices are fused and corrected through a nonlinear mapping of the feature space of the radial basis function kernel to obtain the optimized defect feature tensor, including: Step S61: The heterogeneous features of the generated compensation factor and the three basic indicators are subjected to dimensional unification processing, including linearly scaling the area feature to the [0,1] interval, compressing the dynamic range of the contour complexity through logarithmic transformation, standardizing the grayscale contrast with Z-score, and retaining the original physical value of the compensation factor. Step S62: Based on the compensation factor and three basic indicators after the unified processing, and using the compensation factor as the kernel function scale parameter, calculate the nonlinear similarity relationship between the basic indicators, and map the original three-dimensional features to a higher-dimensional latent space to achieve radial basis function kernel space mapping; Step S63: Based on the radial basis function kernel space mapping, generate feature tensors through tensor structure recombination to obtain the optimized defect feature tensor.
[0011] Further, in step S7, the defect characterization vector is input into the CART decision tree classifier, and the dynamic compensation coefficients of the electrolyte concentration process parameters are embedded to obtain the type code and standard defect level of the oxide spot defect, including: Step S71: Real-time acquisition of the process parameters of electrolyte molar concentration in the anodizing tank, generation of dynamic compensation function based on concentration offset, and adjustment of node splitting threshold of CART decision tree classifier accordingly to obtain process-compensated decision tree classifier; Step S72: Input the defect feature tensor into the process-compensated decision tree classifier, perform multi-level feature splitting, and obtain the type code and standard defect level of oxide spot defects. The multi-level feature splitting includes the first-level splitting node performing threshold segmentation based on pixel-level geometric area features; the second-level splitting node separating cloud-like and pinhole-like defects based on Zernike moment contour spectral complexity; and the leaf node decision rule embedding a joint discriminant function of local gray-level standard deviation contrast and dynamic morphological compensation factor.
[0012] Secondly, a machine vision-based device for identifying oxide spot defects on aluminum alloy surfaces includes: The acquisition module is used to acquire color images of aluminum alloy surfaces, preprocess the images, and perform YUV color space conversion on the preprocessed images to extract the luminance component images. The extraction module performs CLAHE contrast-limited adaptive histogram equalization on the luminance component image, and generates a defect binary mask by combining it with Sauvola local dynamic thresholding. The mask is then labeled with 8-connected components, and three basic indicators are calculated: pixel-level geometric area features of each connected component, contour spectral complexity based on Zernike moments, and local gray-level standard deviation contrast. The boundaries of the labeled connected components are extracted and the boundary closure topology is verified. Curvature-driven adaptive sampling points are dynamically generated through multi-scale B-spline curvature extremum detection. The calculation module is used to construct the minimum convex hull boundary based on the sampling point set, perform power-weighted Voronoi diagram spatial partitioning on the convex hull boundary, and generate constrained Delaunay triangular mesh elements for the defect region. Based on the triangular mesh elements, a spatial topological index is established by hierarchical decomposition using Kirkpatrick trapezoidal diagram, and the regularized area deformation rate of each element relative to the ideal oxide film region is calculated. A dynamic morphological compensation factor is generated based on the standard deviation of the deformation rate set. The processing module is used to fuse and correct the generated compensation factor and three basic indicators through nonlinear mapping of the feature space of the radial basis function kernel to obtain the optimized defect feature tensor; the defect characterization vector is input into the CART decision tree classifier, and the dynamic compensation coefficient of the electrolyte concentration process parameter is embedded to obtain the type code and standard defect level of the oxide spot defect.
[0013] Thirdly, a computing device includes: One or more processors; A storage device for storing one or more programs that, when executed by one or more processors, cause the one or more processors to implement the method.
[0014] Fourthly, a computer-readable storage medium storing a program that, when executed by a processor, implements the method.
[0015] The above-described solution of the present invention has at least the following beneficial effects: Firstly, in terms of detection accuracy, the ring diffuse light source array combined with Retinex multi-scale illumination correction eliminates interference from curved surface reflections, reducing the false alarm rate in strong reflective areas from 18% to 1.8%. The cascaded processing of CLAHE histogram slope constraint and improved Sauvola dynamic threshold segmentation increases the detection rate of low-contrast cloud spots to 98% and accurately retains pinhole defects ≥3px. Combined with curvature-driven adaptive sampling, it achieves 0.05mm-level star pattern capture with a boundary approximation accuracy of ±0.2 pixels. Furthermore, in terms of process adaptability, the regularized area deformation rate compensates for surface projection distortion, and the standard deviation of the deformation rate quantifies the diffusion degree, enabling a severe cloud spot detection rate of 99.1%. Dynamic compensation factors and real-time electrolyte concentration are used to collaboratively drive decision tree threshold adjustment, covering a process fluctuation range of 10-30 g / L. Finally, in terms of industrial effectiveness, the single-piece inspection time is reduced to 9.3 seconds, the defect classification accuracy is 99.1%, and annual cost savings are 4.8 million yuan. This completely solves the three major industry problems in the background technology: poor surface adaptability leading to 12.7% feature drift, 25% missed detection of <0.3mm pinholes, and failure of static feature library process response. Attached Figure Description
[0016] Figure 1 This is a schematic flowchart of a machine vision-based method for identifying oxide spot defects on aluminum alloy surfaces, provided by an embodiment of the present invention.
[0017] Figure 2 This is a schematic diagram of a machine vision-based aluminum alloy surface oxide spot defect identification device provided by an embodiment of the present invention. Detailed Implementation
[0018] Exemplary embodiments of the present disclosure will now be described in more detail with reference to the accompanying drawings. While exemplary embodiments of the present disclosure are shown in the drawings, it should be understood that the present disclosure may be implemented in various forms and should not be limited to the embodiments set forth herein. Rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the scope of the disclosure to those skilled in the art.
[0019] like Figure 1 As shown, an embodiment of the present invention proposes a machine vision-based method for identifying oxide spot defects on aluminum alloy surfaces. The method includes the following steps: Step S1: Acquire a color image of the aluminum alloy surface and preprocess the image to extract the brightness component image; Step S2: Perform adaptive threshold segmentation for local contrast enhancement on the brightness component image, generate a binary mask for the defect region, extract morphological connected components based on the mask, and calculate three basic feature indicators: area pixel value, contour Fourier descriptor complexity, and regional grayscale standard deviation contrast of each connected component. Step S3: Extract the labeled connected domain boundaries, verify the boundary closure topology, and dynamically generate curvature-driven adaptive sampling points through multi-scale B-spline curvature extremum detection; Step S4: Based on the sampling point set, construct the minimum convex hull boundary, perform non-uniform quadtree partitioning on the convex hull boundary, and generate the surface Bezier fragments of the boundary constraints of the defect region. Step S5: Based on the curved Bezier fragments, a spatial topological index is established by hierarchical decomposition using Kirkpatrick trapezoidal diagrams. The regularized area deformation rate of each element relative to the ideal oxide film region is calculated, and a dynamic morphological compensation factor is generated based on the standard deviation of the deformation rate set. Step S6: The generated compensation factor and the three basic indicators are fused and corrected through the nonlinear mapping of the feature space of the radial basis function kernel to obtain the optimized defect feature tensor; Step S7: Input the defect characterization vector into the CART decision tree classifier, embed the dynamic compensation coefficient of the electrolyte concentration process parameter, and obtain the type code and standard defect level of the oxide spot defect.
[0020] In the embodiments of this invention, a seven-level collaborative innovation mechanism is used to address the core pain points of detecting oxide spots on aluminum alloy surfaces: In the optical preprocessing stage, diffuse reflection compensation from a ring light source combined with Retinex theoretical correction eliminates interference from mirror reflection on the wheel hub surface, reducing the false alarm rate in strong reflective areas from 18% to 1.8%; In the defect segmentation stage, cascaded processing of CLAHE enhancement and Sauvola dynamic threshold segmentation increases the detection rate of low-contrast hazy spots to 98% while retaining pinhole defects ≥3px, reducing the over-detection rate to 1.2%; In the geometric modeling layer, curvature-driven sampling point density optimization combined with boundary-constrained Bezier fragment parametric modeling reduces memory usage compared to traditional meshes. With a 66% reduction in the number of particles and a boundary approximation accuracy of ±0.2 pixels, it achieves precise capture of star-shaped radial patterns at the 0.05mm level. In the process quantification stage, regularized area deformation rate eliminates surface projection distortion, and deformation rate standard deviation quantifies the degree of oxide spot diffusion, resulting in a severe cloud spot detection rate of 99.1%. In the multi-source fusion layer, radial basis kernel mapping captures the process-morphology nonlinear correlation, and feature tensor drives a 37 percentage point improvement in cloud spot classification accuracy. At the decision output end, the electrolyte concentration compensation mechanism covers the process fluctuation range of 10-30g / L, combined with ASTM standard graded output, reducing the single-piece inspection time to 9.3 seconds, providing the first fully automated quality inspection solution for new energy vehicle wheel hub manufacturing.
[0021] In a preferred embodiment of the present invention, step S1, acquiring a color image of the aluminum alloy surface and preprocessing the image to extract the luminance component image, may include: A color image of the aluminum alloy surface is acquired, illuminance compensation is performed using a ring-shaped diffuse light source array, and illumination correction preprocessing based on Retinex theory is executed. The luminance component is then extracted by YUV color space conversion of the corrected image.
[0022] The specific process includes: First, a ring-shaped diffuse reflection light source array is configured to surround the surface of the aluminum alloy being tested. Precise optical design ensures a gradient distribution of the light source's incident angle within the range of 15°-75°, thus creating a uniform irradiance field on the curved surface of the hub. A high-resolution industrial linear scan camera is used to acquire original color images along the axial movement trajectory of the workpiece. During this process, the diffuse reflection characteristics of the light source array suppress specular highlight interference. The acquired images are then input into an image processing module based on Retinex theory. Multi-scale Gaussian convolution kernels are used to decompose the image into illuminance and reflectance components. The illuminance component represents the ambient light distribution, while the reflectance component represents the intrinsic characteristics of the object. Component reweighting and fusion eliminates local overexposure areas and enhances shadow details. Subsequently, a color space conversion operation is performed. The RGB pixel values of the corrected image are input into a transformation matrix defined by the CIE 1931 standard. A linear transformation is then performed to calculate the YUV three-channel components. Finally, the Y channel luminance component is extracted as the key input data for defect identification.
[0023] In a specific example of this invention, in the device for detecting oxide spots on the surface of aluminum alloy wheel hubs for new energy vehicles, a ring-shaped diffuse reflection light source array is first arranged coaxially around the wheel hub workpiece. The spoke area uses a 45°±5° incident angle to compensate for surface reflection, while the rim groove area uses a 75°±5° large-angle incident angle to enhance the illumination in dark areas. A high-resolution line-scan camera is driven to move uniformly along the wheel hub's rotation axis, acquiring the original RGB image under the synergistic irradiation of the light source array, successfully suppressing overexposed areas caused by specular reflection from the spoke curved surface. The acquired image is then input into a preprocessing module based on Retinex theory. A multi-scale decomposition algorithm separates the intrinsic reflectivity of the oxide film on the wheel hub surface, eliminating the influence of uneven ambient lighting and reducing the grayscale variance of the rim groove bottom area from the original value of 128 to 32. Subsequently, a transformation matrix defined by the CIE 1931 standard is used to convert the corrected image from RGB space to YUV space. The extracted Y channel brightness component clearly presents the 0.1mm-level oxide spot texture on the spoke surface, with a grayscale contrast ratio ≥8.
[0024] In this embodiment, by designing the gradient incident angle of the annular diffuse reflection light source array, an irradiance field with a uniformity of 92% is formed on the surface of the aluminum alloy wheel hub, completely eliminating the shadow bands and bright spots caused by traditional axial light sources, ensuring the integrity of defect imaging from the optical source; based on Retinex theory, multi-scale decomposition removes environmental illumination interference, reducing the overexposed area of the wheel spoke mirror reflection area by 98%, and increasing the signal-to-noise ratio of the dark part of the rim groove from 3.2dB to 18.5dB, providing a physically realistic image substrate for micro-defect identification; combined with CIE The 1931 standard Y-channel conversion focuses on the oxide film thickness-sensitive band, achieving a doubling of defect sensitivity for oxide spots at the 0.1mm level: the average contrast of cloud-like spots is improved from 5.3 to 11.7; the edge sharpness of pinhole-like pits is enhanced by 300%, laying the foundation for sub-pixel defect detectability; its brightness component has a correlation coefficient of 0.93 with the thickness of the anodic oxide film, which is 22% higher than that of the RGB channel; the imaging stability error is <1.5% under electrolyte concentration fluctuation of ±10%; the defect contrast maintains a linear response in the film thickness range of 15-25μm, significantly enhancing process adaptability; finally, in actual testing on a production line with an annual output of 500,000 wheel hubs, the optical debugging time is reduced by 67%, replacing the need to purchase high dynamic range cameras, forming a closed-loop optimization from optical design to economic benefits.
[0025] In a preferred embodiment of the present invention, step S2 involves performing adaptive threshold segmentation for local contrast enhancement on the luminance component image, generating a binary mask for the defect region, extracting morphological connected components based on the mask, and calculating three basic feature indicators for each connected component: area pixel value, contour Fourier descriptor complexity, and region grayscale standard deviation contrast. Step S21: Divide the brightness component image into local sub-regions and limit the slope of the histogram distribution to enhance the low-contrast cloud-like oxide spots, so as to obtain an image with contrast enhancement. The specific process includes: First, the luminance component image data transmitted in step S1 is received and divided into multiple rectangular processing units of predefined size. The unit size is dynamically adjusted according to the image resolution to balance local adaptability and computational efficiency. Then, a histogram redistribution operation is performed in each unit. By constraining the upper limit of the slope of the pixel value accumulation distribution function, the irrational amplification of background noise is suppressed, while the development of low-contrast cloud-like oxide spots is directionally enhanced. This slope constraint mechanism can effectively prevent the loss of detail in the highlight area. Finally, an enhanced image with global contrast balance is generated. Its key feature is the synergistic optimization of improving the visibility of dark textures and preserving the level of highlight areas.
[0026] Step S22: Perform improved Sauvola local thresholding on the enhanced image, obtain the mean and standard deviation of gray levels within the local window, and dynamically calculate the pixel-level threshold function based on the mean and standard deviation to generate a high-precision defect binary mask. The specific process includes: Based on the aforementioned enhanced image data stream, an improved Sauvola dynamic thresholding segmentation device is deployed: a configurable sliding calculation window is established on the image plane, and the coverage area of the window is adaptively adjusted according to the defect scale characteristics; the statistical distribution characteristics of pixel gray values within the window are captured in real time, including the arithmetic mean representing the brightness and darkness of the region and the standard deviation quantifying the local contrast intensity; a pixel-level adaptive threshold function is constructed based on the statistical quantities, specifically including: establishing a rectangular sliding window with an adaptive size centered on the pixel, and calculating the arithmetic mean and standard deviation of the gray values of all pixels within the window in real time. For example, in the wheel hub rim groove area, the window automatically expands to 25×25 pixels to cover low-light features; an initial threshold benchmark is generated by a linear combination of the mean and standard deviation, and the morphological opening operation prediction result is introduced as a correction term, wherein the correction amount is dynamically generated based on the preview result: if the current window center is located within the preview defect area, then the correction amount = +k×standard deviation, where k is the gain coefficient, with a typical value of 0.2; if it is located in the background area, then the correction amount = -k×standard deviation; The weighting coefficient of the standard deviation term is automatically adjusted according to the gray-level variance value within the window: high variance regions enhance local contrast contribution, and low variance regions weaken noise interference; Finally, a threshold surface that dynamically evolves with spatial location is generated, and its functional form can be expressed as: Dynamic threshold = mean × [1 + weighting coefficient × (standard deviation / maximum standard deviation)] + correction amount. This function introduces a morphological topological constraint factor to distinguish between real micro-defects and imaging noise; Through pixel-by-pixel threshold decision operation, the original gray-level image is converted into a binary mask, where the defect region is marked with the highest bit width value, and the background region is processed to zero. The gray-level value of each pixel in the enhanced image is compared with the dynamic threshold at the corresponding position in real time: if the pixel value is lower than the threshold: it is marked as a defect and assigned a value of 1; if the pixel value is higher than the threshold: it is marked as background and assigned a value of 0. Finally, a defect segmentation mask that retains sub-pixel boundary accuracy is output.
[0027] Step S23: By scanning the mask pixels, establish connected region labels, filter out noise and pseudo-defects with an area of less than 5px, and obtain a set of independent connected regions; The specific process includes: Full-pixel domain connectivity analysis is performed on the binary mask: First, a two-pass scanning strategy is used to traverse the mask matrix. The first pass performs temporary label assignment and equivalence relation recording, and the second pass parses the equivalence table to complete the label unification mapping. Based on a preset morphological area threshold, pseudo-defect regions caused by dust adhesion or imaging noise are filtered out, while the boundary chain codes and topological adjacency relationships of effective connected regions are recorded. Finally, a set of connected regions with spatial independence and topological integrity is output, which includes basic descriptors such as the geometric centroid and circumscribed rectangle of each connected region.
[0028] Step S24: Based on the set of independent connected components, count the total number of valid pixels within the connected components and calculate the pixel-level geometric area features; The specific process includes: Based on the spatial topological information of the connected component set, the total number of pixels marked as defective states within each independent connected component is counted, and this value directly maps to the physical coverage area of the defect. The number of pixels is converted into the actual geometric area value through the pixel size calibration coefficient, and a primary quantitative index of defect size is established. This area feature value serves as the basic parameter for defect severity classification, and its numerical distribution range covers the full-scale defect characterization needs from micron-level pinholes to millimeter-level patches.
[0029] Step S25: Extract the boundary point sequence based on the set of independent connected components, calculate the 7th order Zernike orthogonal moments, quantify the contour irregularity through the variance of the moment modulus, and obtain the contour spectral complexity based on Zernike moments; The specific process includes: First, the chain code sequence of the connected domain boundary is parsed and converted into a closed contour point set in Cartesian coordinates. Then, the set of moduli of the seventh-order Zernike orthogonal moments is calculated for this point set. These orthogonal moment basis functions possess rotation invariance and noise robustness. Next, the statistical variance of the moduli set is calculated. The variance quantifies the geometric irregularity of the contour boundary: high variance indicates sharp transitions or fractal features, while low variance indicates a smooth boundary. Specifically, this includes: First, extract the sequence of closed boundary points of the connected domain, translate the original point set in the Cartesian coordinate system to the geometric center, and perform polar coordinate normalization: translation centering: calculate the mean of the coordinates of all boundary points as the new origin, and translate each point to the central coordinate system; polar radius normalization: use the distance of the farthest boundary point as the reference unit, and scale the radial coordinates of all points to the unit circle. Define 7th-order Zernike orthogonal polynomial basis functions within the unit circle domain. Generate 36 orthogonal bases by combining order and repetition, with order n=7 and repetition m taking an even number between [-7,7]. The bases include: radial component: constructing an nth-order orthogonal function of radius r using Jacobi polynomials; angular component: expressing the mth-order periodicity of angle θ in trigonometric function form. Perform discrete integration on the normalized boundary point sequence: traverse each boundary point, calculate its product with the 36 Zernike basis functions, and sum them. Generate complex form moment values: =Real part + j × Imaginary part These are the moment values; the modulus of each moment value is then calculated. ; The complexity of the contour spectrum is calculated based on the statistical distribution of 36 modulus values: Variance calculation: Calculate the statistical variance of the set of modulus values: Where μ is the mean modulus, For variance, The total number of modulo values is used to map the complexity: the larger the variance value, the higher the irregularity of the contour. Among them, the variance of star-shaped fringe is 0.35 > that of smooth contour is 0.05.
[0030] The final output is a spectral complexity index based on Zernike moments, which maintains mathematical invariance to workpiece rotation, translation and dimensional changes, overcoming the feature drift defect of traditional contour factors under random poses on the production line.
[0031] Step S26: Calculate the standard deviation of pixel grayscale within the connected region based on the connected region, and use the standard deviation value to characterize the contrast difference between the defect and the background to obtain the local grayscale standard deviation contrast.
[0032] The specific process includes: The pixel regions corresponding to the connected components are precisely located on the original brightness image, and the gray value sample set of all pixels in the region is extracted. The standard deviation statistic of the sample set is calculated using the standard deviation formula. This value characterizes the intensity of gray value fluctuation within the defect region: a high standard deviation indicates that the defect has significant edge gradients or internal texture variations, while a low standard deviation reflects the homogenization of gray value distribution. The standard deviation value is used as a proxy variable for the visual contrast between the defect and the background to establish a positive correlation model with the visual saliency of oxide spots. Finally, a local gray value standard deviation contrast index is generated. This index has a strong tolerance to changes in lighting conditions, ensuring feature stability.
[0033] In a specific example of this invention, in a surface quality inspection device for new energy vehicle wheel hubs, the brightness component output by S1 is first divided into 32×32 pixel rectangular sub-regions. By constraining the upper limit of the slope of the histogram of each region to 2.5, the low-contrast cloud spots on the wheel spoke surface are successfully rendered. The original grayscale difference is 5.3, and the development is improved by 120%, while avoiding the false enhancement of the normal texture of the anodized layer. Improved Sauvola segmentation is applied to the enhanced image, and a 15×15 sliding window is used to calculate local statistics in real time. When dynamically generating the threshold function, a morphological opening operation constraint factor is introduced to accurately capture the 0.2mm pinhole defect at the bottom of the rim groove, with an area of 4px. The traditional method has a 78% false detection rate due to noise interference. Then, the connected components are marked by two scans to filter out grinding dust false defects with an area of <5px, reducing the over-detection rate to 1.1%. The output contains a set of 87 effective connected components, including a typical 1.5mm cloud spot in the wheel spoke area, with ID: A0032, and a star-shaped radial pattern on the wheel rim, with ID: A0087; Calculate the area of the connected component A0032, which is 1845px, equivalent to 2.38mm. 2 The alarm threshold for medium-level size was triggered; the boundary chain code of A0087 was extracted and the Zernike moment was calculated using the above formula. Its magnitude variance reached 0.35, and the spectral complexity index based on the Zernike moment was output. The typical value of the smooth contour was 0.05, which was confirmed to be the contour fractal variation caused by the diffusion of oxide spots. The index fluctuated by <0.01 after the hub rotated 60°; the A0032 region in the original image was located, and the gray scale standard deviation was measured to be 42.3, the background area was 8.7, and the quantization contrast was 3.2 times that of the traditional method.
[0034] In this embodiment, the technical solution utilizes a local histogram slope constraint mechanism to suppress excessive background noise enhancement while achieving a doubling improvement in the visibility of low-contrast cloud spots. The measured contrast of cloud spots on the wheel hub surface increased from 5.3 to 11.7, laying the foundation for defect detectability. The improved Sauvola segmentation introduces a morphological constraint factor, achieving a 100% detection rate for 0.2mm-level pinhole defects and reducing the over-detection rate to 1.1%, breaking through the bottleneck of precise micro-defect segmentation. A two-pass connected component analysis combined with area pre-filtering effectively eliminates 99% of dust noise interference, outputting a topologically complete set of defect regions. Pixel-level area quantization achieves ±0.01mm. 2Measurement accuracy meets the ASTM E1551 standard requirements for defect size classification; the spectral complexity index based on Zernike moments possesses triple mathematical invariance in rotation, translation, and scale, with feature fluctuations less than 0.01 under random wheel hub poses, overcoming the challenge of feature drift caused by production line vibrations; the establishment of a strong correlation between local grayscale standard deviation contrast and visual saliency provides illumination-robust characteristics for classification decisions. Full-chain collaboration achieves a comprehensive accuracy rate of 99.3% for detecting oxide spots on aluminum alloy wheel hubs, increasing single-piece inspection efficiency by 12 times, forming a closed-loop quality inspection system from imaging optimization to quantitative decision-making.
[0035] In a preferred embodiment of the present invention, step S3, extracting the marked connected component boundaries and verifying the boundary closure topology, and dynamically generating curvature-driven adaptive sampling points through multi-scale B-spline curvature extremum detection, may include: Step S31: Based on the set of independent connected components, extract the complete boundary coordinate point set of each connected component to obtain the marked connected component boundary; The specific process includes: First, based on the independent connected component set data structure output in step S23, a boundary coordinate extraction operation is performed for each marked connected component: a chain code tracing algorithm is used to traverse clockwise along the outer contour of the connected component, recording the Cartesian coordinate position values of all boundary turning points. The traversal process ensures the integrity of the contour closure path through eight-neighbor connectivity determination. Then, a spatial index structure for the boundary point sequence is established. This structure stores the coordinates of each point in the contour direction and associates them with the unique identifier of the connected component to which they belong. Finally, a boundary point set database with topological association is generated, the key feature of which is that it retains the original pixel-level positional accuracy.
[0036] Step S32: Select any reference point from the set of marked connected domain boundary points and emit a four-way ray. Detect the odd number of intersections between the ray and the boundary edge, identify non-closed boundaries and remove the corresponding connected domains to obtain a set of verified closed boundaries. The specific process includes: Topological closure verification is performed on the boundary point set constructed in step S31: First, a reference point is selected from the boundary sequence as the origin of the ray emission. Four infinitely extending reference rays are generated along the horizontal and vertical directions, including 0° / 90° / 180° / 270°. Based on the line segment intersection detection principle of computational geometry, the number of spatial intersections between the rays and the boundary edges is calculated one by one. The closure property is determined according to the odd number of intersections. When the number of intersections of any ray is even, it is indicated that the connected domain has a boundary break or internal hole defect. Then, the connected domains with topological anomalies are removed from the processing queue, and only the set of closed boundaries that have passed the omnidirectional ray verification is retained. Finally, the strictly screened valid connected domain boundary data is output.
[0037] Step S33: Based on the closed boundary set, fit the smooth parameter curve using cubic B-spline basis functions, iteratively adjust the control point density in scale space, eliminate pixel-level jagged noise and retain the true geometric features, and obtain the multi-scale B-spline fitting curve. The specific process includes: Based on the validated set of closed boundary points, curve parameterization reconstruction is performed: least-squares fitting is applied to discrete boundary points using cubic B-spline basis functions to generate an initial smooth parametric curve; then, multi-round iterative optimization is performed within a scale-space framework: by introducing scale parameters to control curve smoothness, high-frequency pixel jagged noise is filtered out at the coarse scale, and the density of control points is finely adjusted at the fine scale to approximate the real geometric features; each iteration dynamically adds or removes control points based on the curvature change gradient to ensure abrupt contour changes and obtain higher fitting accuracy; finally, a multi-scale optimized B-spline parametric curve is output.
[0038] Step S34: Calculate the Gaussian curvature value at each point on the parameter fitting curve, locate the local extrema of curvature in the scale space, filter out invalid extrema points whose absolute curvature value is less than the threshold, and obtain the curvature distribution; The specific process includes: Perform differential geometric feature analysis on the parametric curve: First, sample and calculate the point set along the curve's parametric equation with a fixed step size. Then, perform vector operations on the first and second derivatives of the curve to solve for the Gaussian curvature value at each sampling point, including: For the multi-scale B-spline fitting curve generated in step S33, such as the 1024-point fitting curve of star pattern ID:A0087, perform equal arc length resampling: Divide the curve parameter domain into high-density discrete points with a step size of 0.1 pixels, and calculate the Cartesian coordinates and first / second derivatives of the parametric equations for each sampling point. Vector operations are performed based on the derivatives of parametric equations: the tangent vector is the normalized first-order derivative, which represents the direction of the tangent to the curve; the normal vector is the orthogonal vector obtained from the tangent vector and marks the direction of curvature. Synthesizing Gaussian curvature using differential geometric relations: First, the radius of curvature is calculated by using the proportional relationship between the second derivative modulus and the rate of change of the tangent vector to obtain the reciprocal of the radius of curvature; then, the curvature is calculated by using the sign assignment rule: when the normal vector points to the concave side of the curve, the curvature is positive, and when it points to the convex side, the curvature is negative. Perform curvature validity screening in scale space: scan the curvature sequence, mark the point where the curvature change sign reverses, locate the extreme points, and remove pseudo-extreme points whose absolute value is less than a preset threshold.
[0039] The Gaussian curvature value of each sampling point is solved by vector operation based on the first and second derivatives of the curve. This curvature quantifies the bending intensity of the local contour. Then, the curvature function is scanned in a multi-scale space, and the peak and valley points of curvature are located by a local extremum detection algorithm to form a set of candidate feature points. According to the preset curvature threshold, where the typical absolute value lower limit is 0.02, pseudo-extreme points generated by fitting residual noise or small fluctuations are filtered out. Finally, a curvature distribution map reflecting the essential geometric features of the contour is generated.
[0040] Step S35: Dynamically generate sampling points based on curvature distribution to obtain curvature-driven adaptive sampling points.
[0041] The specific process includes: Spatial adaptive sampling based on curvature distribution map: First, the curvature value range is divided into a high curvature feature region (|κ|>0.05) and a low curvature flat region (|κ|≤0.05). In the high curvature region, a nonlinear density allocation strategy is adopted: the sampling point spacing is inversely proportional to the absolute value of curvature, ensuring that key features such as contour turning points and corners are densely captured. In the low curvature region, uniform sampling with equal arc length is implemented to significantly reduce data redundancy. In particular, a minimum spacing protection mechanism is implemented for adjacent feature points to avoid excessive clustering of sampling points. Finally, a curvature-driven optimized sampling point set is generated, which reduces the total number of points by more than 60% compared to the full resolution boundary, while retaining 99.7% of the geometric feature information.
[0042] In a specific example of this invention, for the defects of a 1.5mm cloud-like spot (ID: A0032) and a star-shaped radial pattern on the wheel rim (ID: A0087), the boundary coordinates were extracted by eight-neighbor chain code tracing, successfully capturing 32 acute-angle turning points of the star-shaped pattern, with a contour point set positioning accuracy of ±0.5 pixels. Four-way rays were emitted from the reference point of the star-shaped pattern boundary, detecting an odd number of intersections in the 270° direction, which was determined to be a topologically anomalous connected domain, verified by metallography as an oxide spot diffusion channel. Cubic B-spline multi-scale fitting was performed on the cloud-like spot boundary. At the coarse scale, where σ=1.2, grinding texture noise was eliminated; at the fine scale, where σ=0.3, 0.2mm-level convexity was retained. The feature was identified, and the Hausdorff distance between the reconstructed contour and the real defect was only 0.3 pixels. When calculating the curvature distribution of the star-shaped pattern according to step S34, an extreme point with |κ|=0.15 was detected at the end of the radial branch, and |κ|=0.01 in the flat area. After threshold filtering, when |κ|>0.02, 7 effective feature points were confirmed, with a consistency of 98.7% with the electron microscopy scan results. Sampling was carried out based on the curvature map: the star-shaped pattern branches were densified to a point spacing of 2 pixels according to the inverse curvature ratio, and the sampling points in the flat area were equidistantly spaced at a point spacing of 12 pixels. The total number of sampling points was optimized from 1024 points to 386 points. While ensuring that all 7 feature points were captured, the subsequent convex hull calculation time was reduced from 35ms to 12ms.
[0043] In this embodiment, sub-pixel-level precision extraction of boundary point sets is achieved through eight-neighbor chain code tracing, fully capturing 32 acute-angle turning features of the star-shaped oxide texture on the wheel hub; a four-way ray odd-order intersection verification mechanism is adopted to successfully identify the boundaries of internal holes at the 0.1mm level, eliminating 92% of the risk of boundary misjudgment; in step S33, multi-scale B-spline fitting is used for coarse / fine-scale collaborative optimization, reducing the Hausdorff distance of contour reconstruction to 0.3 pixels; based on curvature threshold filtering of differential geometry, 7 essential feature points are accurately located with |κ|>0.02, eliminating 95% of noise interference; curvature-driven adaptive sampling is implemented, with a point spacing of 2px in the feature area and 12px in the flat area, reducing sampling points by 62% while retaining 100% of geometric features, accelerating subsequent convex hull calculation by 3 times. The whole-chain collaboration enables the geometric representation integrity of micro-defects to reach 99.3%.
[0044] In a preferred embodiment of the present invention, step S4, which involves constructing a minimum convex hull boundary based on the sampling point set, performing non-uniform quadtree partitioning on the convex hull boundary, and generating surface Bezier fragments for boundary constraints of the defect region, may include: Step S41: Based on the curvature-driven adaptive sampling point set, sort the point set by polar coordinates and establish a convex hull topology chain, filter out all internal concave points to eliminate local distortion, and generate the minimum convex polygon closed boundary that encloses the defect area. The specific process includes: First, the curvature-driven adaptive sampling point set data structure output from step S35 is received. This point set has been optimized through curvature intensity distribution, including a point spacing of 2 pixels in high curvature areas and 12 pixels in low curvature areas. The azimuth and radial distance values of each sampling point are calculated through the polar coordinate system transformation module, including: First, coordinate system translation and datum establishment are performed, including: center point calibration: using the geometric center of the defect area, calculated from the average coordinates of the sampling points, as the origin of the polar coordinate system; coordinate translation: converting the Cartesian coordinates of each sampling point... Converted to offset relative to the center point: , ,in, These are the coordinates of the center point. yes The offset of the axis. yes The offset of the axis; Based on the Cartesian coordinates of each sampling point Converted to an offset relative to the center point, using Euclidean distance. Calculate the straight-line distance from each sampling point to the origin. It is the straight-line distance from each sampling point to the origin. It is an index; Accurate azimuth calculation includes: basic angle calculation: obtaining the base angle value using the arctangent function. , It is the base value of the angle; angle normalization: ... Convert to Standard range: includes: In the first quadrant; In the second / third quadrant; In the fourth quadrant; The point set is fully sorted in ascending order of azimuth angle to establish a serialized spatial chain with monotonically increasing polar angle. Then, the Graham scan algorithm is used to traverse the sorted point chain, and the convexity of the points is dynamically determined by the sign of the vector cross product: when three consecutive points form a right rotation direction, the middle concave point is removed, and this process is iterated until a fully convex topological chain is formed. Finally, the smallest convex polygon closed boundary that encloses all sampling points is generated, and its vertex sequence is stored in strict polar angle order, and the Hausdorff distance between each boundary edge and the original contour of the defect is ≤0.5 pixels.
[0045] Step S42: Based on the closed boundary of the smallest convex polygon, perform a first-level subdivision with the convex hull as the initial bounding box, calculate the average curvature of the boundary of each sub-partition, and obtain a quadtree structure with non-uniform depth. The specific process includes: Using the aforementioned convex hull boundary as the baseline spatial domain, the bounding box of the outer rectangle is initialized as the root node of the first-level quadtree. A recursive spatial subdivision algorithm is executed: firstly, the curvature value is calculated by integral differentiation of the arc length of the parametric curve to determine the average curvature value of the current node's boundary line. When the absolute value of the average curvature exceeds the threshold of 0.04, the current node is divided into four equal sub-nodes and processed recursively. Geometric consistency constraints are implemented during the subdivision process: the maximum offset between the sub-node boundary line and the original convex hull boundary is limited to within 0.1 pixels. Subdivision terminates when the node curvature is ≤0.04 or the maximum recursion depth of level 4 is reached. Finally, a quadtree spatial index structure with non-uniform depth is generated, whose leaf nodes cover the entire defect domain. Key features include: in the equal curvature region at the edge of the spoke oxide spot, |κ|>0.12 achieves 16x subdivision and four-level subdivision, while the flat region at the center of the hub maintains the basic partition: first-level subdivision. The overall partitioning efficiency is 65% higher than that of a uniform mesh, and 100% of the original convex hull boundary geometric characteristics are preserved.
[0046] Step S43: Based on the non-uniform depth quadtree structure, extract the leaf node corner points as Bezier control points, use bicubic parametric surface fitting to fit the local geometry, force the convex hull boundary to be the common edge of adjacent fragments, and generate the surface Bezier fragments with boundary constraints of the defect region.
[0047] The specific process includes: A parametric surface model is constructed based on a quadtree leaf node topology network: the coordinates of the four corner points of each leaf element are extracted to form a control point array, the internal geometry of the element is fitted using the bicubic Bezier surface equation, and a continuous mapping from the parameter domain to the physical domain is achieved through Bernstein polynomial basis functions, including: Based on the coordinates of the four corner points of the quadruple leaf element: the corner points are used as initial control points and expanded into a 4×4 control point grid in the u / v direction of the parameter domain. 12 new internal points are generated by bilinear interpolation. For elements located on the convex hull boundary, the boundary control points are forced to share coordinate values with adjacent elements. Achieving continuous surface mapping through parameterized basis functions: Define the element parameter domain (u,v)∈[0,1]×[0,1], uniformly sample 16×16 grid points, calculate the Bernstein polynomial weighted value for each sampled point, perform a pre-stored 16th order polynomial lookup table, multiply and accumulate the coordinates of 4×4 control points with the corresponding basis function weighted values to generate physical space surface points; A special convex hull boundary constraint mechanism is applied: when the leaf element boundary coincides with the original edge of the convex hull, all control points on that edge are forced to be shared with adjacent elements and the displacement degrees of freedom are reduced to zero; for the inner element boundary, C1 continuity constraint is implemented to ensure smooth splicing of adjacent fragments; finally, a set of surface fragments with strong boundary constraints is output.
[0048] In a specific case of this invention, for the star-shaped radial pattern defect in the rim ID: A0087, with a feature size of 0.1-1.2mm, based on the 386-point sampling set output by S35, a spatial topological chain is constructed through polar angle sorting. Vector convexity discrimination is used to remove 12 concave points, such as branch notches P45 / P89, generating an 18-vertex minimum convex hull boundary, correcting the 42% boundary penetration caused by traditional methods. Quadtree partitioning is performed based on the convex hull: in the high curvature region at the tip of the radial pattern, |κ|=0.15, touching... The model undergoes four levels of subdivision; in the central intersection region, |κ|=0.02, maintaining a first-level partition. The subdivision process uses a geometric constraint module to control boundary offset ≤0.1 pixels, outputting a non-uniform quadtree with 72 leaf nodes, reducing partitions by 68% compared to a uniform mesh. Leaf unit corner points are extracted to construct bicubic Bezier fragments: a control point array is set at the radial branch to fit 0.1mm-level protrusions, and the boundary unit displacement degrees of freedom are forced to zero to eliminate penetration. C1 continuity constraints are applied to internal units to ensure a maximum gap of 0.15 pixels between fragments. The final generated surface model has a memory footprint of 4.3MB. Verification using a coordinate measuring machine shows a convex hull boundary overlap of 99.8%, a feature point position error of ±0.8μm, and supports S5 deformation analysis for real-time detection at 10fps.
[0049] In this embodiment, by using vector convexity discrimination and polar angle sorting mechanism, 92% of the boundary local distortion of the wheel hub star-shaped oxide pattern is eliminated, such as the notch distortion of ID:A0087, generating the minimum convex hull boundary with a Hausdorff distance ≤ 0.5 pixels, solving the 42% boundary penetration defect of traditional methods; based on curvature threshold-driven recursive subdivision, |κ|>0.04 triggers four-level subdivision, achieving a 16-fold resolution improvement at the 0.1mm level radial pattern tip, maintaining the basic partition in the flat area reduces invalid calculations by 65%, and controlling the boundary offset to ≤ 0.1 pixels through geometric constraints; using bicubic Bézier surface fitting, the convex hull boundary is forcibly constrained by reducing the displacement degrees of freedom to zero, combined with C1 continuity to eliminate fragment gaps to 0.15 pixels, reducing storage requirements by 70% while retaining 100% of geometric features. Three major breakthroughs were achieved through collaboration across the entire chain: the coordinate measuring machine verified the feature positioning accuracy of ±0.8μm, the convex hull boundary coincidence of 99.8%, and supported a real-time detection cycle of 10fps, establishing an industrial-grade precision geometric engine for the quantitative analysis of surface defects in aluminum alloys.
[0050] In a preferred embodiment of the present invention, step S5, which involves establishing a spatial topological index based on the curved Bezier fragments using Kirkpatrick trapezoidal decomposition, calculating the regularized area deformation rate of each element relative to the ideal oxide film region, and generating a dynamic morphological compensation factor based on the standard deviation of the deformation rate set, may include: Step S51: Organize the curved Bezier fragments into a tree-like index structure to establish a fast query mechanism for cell adjacency relationships, so as to construct a spatial topology index; The specific process includes: First, the boundary-constrained surface Bezier fragments generated in step S43 are used as the basic processing units, and the spatial topological relationships are organized using the Kirkpatrick ladder diagram hierarchical decomposition mechanism. Specifically: based on the spatial distribution of the surface fragments, adjacent fragments are aggregated into parent nodes to form a tree-like hierarchical structure, where the bottom-level leaf nodes correspond to the original Bezier fragments, and the upper-level nodes successively represent fragment sets with larger spatial ranges; then, a fast query mechanism for unit adjacency relationships is established: by pre-compiling and storing the boundary sharing relationship table between each fragment and its adjacent units, efficient index access of any unit and its topological neighboring units is achieved; finally, the completed multi-level tree-like spatial topological index structure provides a low-complexity spatial relationship query foundation for subsequent deformation analysis.
[0051] Step S52: Based on the constructed spatial topology index, obtain the actual pixel area of the current unit, calculate the theoretical area based on the ideal oxide film uniform thickness model, and generate a regularized deformation rate through the area ratio to obtain a set of regularized area deformation rates; The specific process includes: Based on the spatial topology index constructed in step S51, deformation transformation is performed cell by cell: First, the current processing cell is located by index, the actual pixel area covered by the Bezier fragment is extracted, and its pixel projection area is calculated as the measured physical area; at the same time, according to the characteristics of aluminum alloy anodizing process, a preset ideal oxide film uniform thickness model is called, wherein the model is established based on the theoretical growth morphology of oxide film under standard process parameters, and the theoretical reference area of the current cell under ideal state is calculated geometrically; then, the ratio of measured area to theoretical area is normalized to generate dimensionless regularized area deformation rate, which characterizes the degree of geometric distortion of the current cell relative to the ideal state; after traversing all cells, the set of regularized area deformation rates composed of the deformation rates of all cells is output.
[0052] Step S53: Based on the set of deformation rates, statistically analyze the discrete distribution of deformation rates of all grid elements, calculate the standard deviation of the set of deformation rates, and obtain the dynamic morphological compensation factor.
[0053] The specific process includes: Statistical feature extraction is performed on the regularized area deformation rate set output in step S52: First, the distribution of deformation rate values of all units in the set is analyzed, and the intensity of the fluctuation of deformation rate in the spatial dimension is quantified by the dispersion evaluation algorithm; in particular, the standard deviation statistic of the deformation rate set is calculated, which reflects the dispersion of the overall deformation of the defect area: the standard deviation approaching zero indicates that the oxide film deformation is uniform, and the increase of the standard deviation indicates that there is local deformation aggregation caused by the diffusion of oxide spots; finally, the standard deviation is linearly scaled and output as a dynamic morphological compensation factor, which is used to compensate for the deviation of oxide spot morphological characterization caused by the fluctuation of electrolyte concentration.
[0054] In a specific case of this invention, during the deformation and process compensation of the star-shaped oxide spot on the rim (ID: A0087), this invention achieves accurate defect determination through three-level precision analysis: First, based on the 72 boundary-constrained Bezier fragment models generated in step S43, spatial topology index construction is performed: 8 central intersection fragments are aggregated into parent node N1, and 64 radial terminal fragments are spatially clustered into 8 child nodes, from N2 to N9. The terminal unit #47 is precisely located through pre-calculated adjacency relationships, corresponding to the curvature extreme point |κ|=0.15 in step S34, which coincides with the boundary control points of adjacent units #46 and #48. An adjacency hash table <47: [46,48,52]>, the index construction took 8.2ms, achieving a 0.1ms-level neighborhood cell retrieval, which is 12 times faster than a uniform grid; then, step S52 is performed to calculate the regularized area deformation rate, and the actual area of cell #47 is measured to be 0.052mm² after parametric surface projection and scan line filling. 2Using an ideal oxide film model combined with a hub curvature radius of 120mm and a normal tilt angle of 22°, the theoretical area was calculated to be 0.028mm. 2 The generated deformation rate is 1.42. The global map shows that the deformation rate of 72 units is distributed in a gradient, with the central region at 0.91, the branch mean at 1.38, and the terminal peak at 1.42. Then, the dynamic compensation factor is generated: the standard deviation of the deformation rate set is calculated to be 0.36, which is multiplied by the process sensitivity coefficient of 2.5. The process sensitivity coefficient is calibrated with 100,000 samples, resulting in an original value of 0.90. After amplitude limiting, the final compensation factor of 0.90 is output.
[0055] In this embodiment, a three-level collaborative innovation mechanism is used to address the core deficiencies of lack of dynamic process response and insufficient deformation variability accuracy in aluminum alloy oxide spot detection: At the spatial management level, a tree-like topological index based on Kirkpatrick ladder diagrams improves the efficiency of non-uniform fragment adjacency queries by 12 times, breaking through the computational bottleneck of complex defect geometry; at the deformation characterization level, a regularized area deformation rate model combined with ideal oxide film reference parameters and projection geometry correction eliminates 12.7% projection distortion error of curved workpieces; at the process compensation level, a dynamic compensation factor is generated using the standard deviation of deformation rate set, which, in conjunction with real-time electrolyte concentration-driven decision rules, improves the star-shaped oxide spot judgment from the traditional three-level correction to the four-level correction, with a metallographic verification consistency of 99.1%, successfully blocking the risk of a 60% decrease in wheel hub fatigue strength. Ultimately, it achieves industrial effectiveness with ±12% adaptive coverage of process fluctuations, a 30-fold increase in deformation detection sensitivity, and a single-piece detection time of 9.3 seconds, saving 4.8 million yuan in production line costs annually.
[0056] In a preferred embodiment of the present invention, step S6, which involves fusing and correcting the generated compensation factor and the three basic indices through a nonlinear mapping of the feature space of the radial basis function kernel to obtain an optimized defect feature tensor, may include: Step S61: The heterogeneous features of the generated compensation factor and the three basic indicators are subjected to dimensional unification processing, including linearly scaling the area feature to the [0,1] interval, compressing the dynamic range of the contour complexity through logarithmic transformation, standardizing the grayscale contrast with Z-score, and retaining the original physical value of the compensation factor. The specific process includes: First, the dynamic morphological compensation factor generated in step S53 is received, such as 0.90 in case ID:A0087, and the three basic indicators extracted in steps S24-S26. Then, a standardization transformation is performed based on the dimensional heterogeneity of the four types of features: for pixel-level geometric area features, such as the defect region 0.052mm... 2 Linear scaling is implemented, with a preset area threshold lower limit of 0.01mm. 2 Mapping to 0, upper limit 5.0mm 2Mapping to 1 transforms the physical area into a dimensionless relative value. For the contour spectral complexity based on Zernike moments, such as 0.35 for star-shaped patterns, a logarithmic transformation is applied, compressing the original dynamic range through a base-10 logarithmic operation to eliminate the interference of extreme values on the feature space. For the local grayscale standard deviation contrast, such as 42.3, Z-score standardization is performed, i.e., subtracting the mean contrast of all connected components and dividing by the standard deviation, transforming it into a statistic conforming to a zero-mean unit variance distribution. The dynamic morphological compensation factor retains its original physical value, such as 0.90, as it represents a process-sensitive scalar. The final output is a dimensionlessly uniform four-dimensional feature vector.
[0057] Step S62: Based on the compensation factor and three basic indicators after the unified processing, and using the compensation factor as the kernel function scale parameter, calculate the nonlinear similarity relationship between the basic indicators, and map the original three-dimensional features to a higher-dimensional latent space to achieve radial basis function kernel space mapping; The specific process includes: Based on the unified dimension feature vector output in step S61, the aforementioned dynamic morphological compensation factor, such as 0.90, is used as the scale parameter of the radial basis kernel function. This parameter is directly related to the electrolyte concentration fluctuation sensitivity. Then, the nonlinear similarity relationship between the three basic indicators is calculated: by measuring the weighted distance between any two points in the feature space under the control of the kernel function, and then converting it into a similarity score through an exponential function, this process explicitly captures the process coupling effect between area mutation and contour distortion. Finally, the original three-dimensional feature vector is mapped to a high-dimensional latent space of tens of dimensions.
[0058] Step S63: Based on the radial basis function kernel space mapping, generate feature tensors through tensor structure recombination to obtain the optimized defect feature tensor.
[0059] The specific process includes: Tensor encapsulation is performed on the high-dimensional latent space features generated in step S62: Feature vectors are filled into a 3D tensor template according to grid coordinates based on the spatial topological index, such as a 4×4×64 template. The first two dimensions correspond to the grid positions on the defect plane, and the third dimension stores the feature components. For empty cells generated in irregular regions, a neighboring cell feature weighted interpolation algorithm is used to complete the data. Then, maximum value normalization is performed on each channel of the tensor to eliminate numerical scale differences and generate an optimized defect feature tensor. This tensor possesses both spatial topological properties and process-sensitive features. For example, the 4×4×64 tensor output in case ID:A0087 can be directly input into the classifier in step S7 to drive accurate decision-making. Metallographic verification shows that it improves the accuracy of star-shaped oxide spot identification by 32 percentage points.
[0060] In a specific example of this invention, during the feature fusion process of the star-shaped oxide spot on the wheel rim ID: A0087, this invention achieves efficient coupling of process and morphological features through three-stage finishing: First, step S61 is performed for dimensional unification processing, with the dynamic compensation factor of 0.90, derived from the deformation rate standard deviation of 0.36 × process coefficient of 2.5 in S53, and three basic indicators: the measured area of unit #47 is 0.052 mm. 2 The contour complexity is 0.35, derived from the Zernike moment analysis in S25; the local grayscale contrast is 42.3, calculated in S26; these are respectively converted to: area linearly scaled to the [0,1] interval to obtain 0.38, and a threshold lower limit of 0.01mm. 2 Up to 0, upper limit 5.0mm 2 Up to step 1, the contour complexity is compressed to -0.46 by a logarithmic transformation to base 10, the grayscale contrast is normalized to 1.02 by Z-score, the compensation factor retains the original value of 0.90, and a four-dimensional vector [0.38, -0.46, 1.02, 0.90] is generated; then step S62 kernel space mapping is implemented, using the compensation factor of 0.90 as the radial basis kernel scale parameter, capturing the strong coupling effect between area expansion (value 0.38) and contour blur (value 0.38-0.46), with a similarity of 0.92 and a value of 0.38, to map the three-dimensional features to a 64-dimensional latent space to make the concentration-dependent characteristics of oxide spot diffusion explicit; then step S63 tensor reconstruction is performed, filling the latent features in a 4×4 grid according to the tree topological index of S51, and using neighborhood inverse distance weighted interpolation to complete the empty cells at the edge of the curved surface, and outputting a 4×4×64 optimized feature tensor after normalization of the maximum channel value.
[0061] In this embodiment, a three-level feature fusion mechanism achieves significant beneficial effects: First, at the feature comparability level, the dimensional unification process eliminates differences of hundreds of times: area features are linearly scaled to the [0,1] interval, the dynamic range of contour complexity is compressed by logarithmic transformation, grayscale contrast is standardized by Z-score, and the compensation factor retains its original value, thus solving the problem of imbalanced weights of heterogeneous features; then, at the process correlation mining level, the dynamic compensation factor is used as the kernel scale parameter, and the implicit coupling relationship between area expansion and contour blurring is captured through radial basis kernel mapping, thus upgrading the three-dimensional features to a 64-dimensional latent space, breaking through the limitations of linear models. The limitations of expressing complex process-morphological relationships are addressed. Ultimately, at the spatial topology preservation level, latent features are reorganized into a 4×4×64 three-dimensional tensor based on a tree-like index. The radial distribution characteristics of star-shaped patterns are preserved through grid coordinate mapping, allowing spatial attributes to be fully transmitted to the classifier. In the ID:A0087 case, this technology chain drove the defect level from level three to level four, achieving a classification accuracy of 99.1%, which is 32 percentage points higher than traditional methods. The entire process takes 46ms, supporting a 10fps inspection cycle on the production line, saving 4.8 million yuan in costs annually, and completely solving the adaptability defects of static feature libraries to ±12% process fluctuations.
[0062] In a preferred embodiment of the present invention, step S7, which involves inputting the defect characterization vector into a CART decision tree classifier, embedding dynamic compensation coefficients of the electrolyte concentration process parameters, and obtaining the type code and standard defect level of the oxide spot defect, may include: Step S71: Real-time acquisition of the process parameters of electrolyte molar concentration in the anodizing tank, generation of dynamic compensation function based on concentration offset, and adjustment of node splitting threshold of CART decision tree classifier accordingly to obtain process-compensated decision tree classifier; The specific process includes: First, the electrolyte molar concentration process parameter is collected in real time by an ion concentration sensor installed in the anodizing tank. The continuously acquired concentration data is filtered by a sliding window mean and then compared with a preset process baseline value, which is calibrated to 25 g / L based on the historical best production batch, to calculate the instantaneous offset. For example, if the concentration measured at a certain moment is 28 g / L, the offset is (28-25) / 25 = 12%. A dynamic compensation function is then generated based on this offset. Specifically, a piecewise linear interpolation mechanism is used: within the concentration offset range of 0-10%, the compensation coefficient linearly increases from 1.0 to 1.2; within the range of 10-20%, the coefficient linearly increases from 1.2 to 1.5; when the offset exceeds 20%, the coefficient saturates to 1.5. For the current offset of 12%, the compensation coefficient is calculated to be 1.32 through interpolation. Subsequently, a pre-trained CART decision tree base model is loaded. This model is trained and optimized based on tens of thousands of defect samples under standard process conditions. It traverses all its splitting nodes and implements dynamic threshold adjustment: the splitting threshold of each node is multiplied by a compensation coefficient of 1.32. For example, the original first-layer area splitting threshold is 0.05mm. 2 Adjusted to 0.066mm 2 The original two-layer contour complexity threshold of -0.5 was adjusted to -0.66. The final output is a decision tree classifier with real-time process compensation. Its core innovation lies in automatically adjusting the classification rules according to the fluctuation of electrolyte concentration, covering a process offset range of ±20%.
[0063] Step S72: Input the defect feature tensor into the process-compensated decision tree classifier, perform multi-level feature splitting, and obtain the type code and standard defect level of oxide spot defects. The multi-level feature splitting includes the first-level splitting node performing threshold segmentation based on pixel-level geometric area features; the second-level splitting node separating cloud-like and pinhole-like defects based on Zernike moment contour spectral complexity; and the leaf node decision rule embedding a joint discriminant function of local gray-level standard deviation contrast and dynamic morphological compensation factor.
[0064] The specific process includes: Input the optimized feature tensor generated in step S63 (such as the 4×4×64 specification tensor of the star-shaped spot with ID:A0087) into the process compensation decision tree and perform a three-level structured feature decision: The first-level splitting, specifically area threshold segmentation, involves extracting pixel-level geometric area components at all spatial locations in the feature tensor; binary decision-making is then performed at dynamically adjusted split nodes, with the split node being 0.066mm. 2 If the unit area is ≥0.066mm² 2 If the defect is identified as a macroscopic defect such as a cloud-like or star-shaped spot, it flows towards the left child node; if <0.066mm 2These are classified as pinhole-like micro-defects and flow towards the right-side child nodes; for example, element #47 has an area of 0.052 mm². 2 The scaling value is 0.38, which is less than 0.066mm. 2 They were classified into the pinhole-like defect branch; The second-level splitting specifically involves contour complexity separation: Based on the first-level splitting, the Zernike moment contour spectral complexity component is extracted. This component is calculated using S25 and logarithmically transformed using S61. A dynamically adjusted threshold of -0.66 is used for secondary judgment: if the complexity > -0.66, it is classified as a cloud-like oxide spot with blurred boundaries; if it ≤ -0.66, it is classified as a pinhole-like or star-shaped defect with sharp boundaries. For example, if the contour complexity of unit #47 is -0.46, then it > -0.66, triggering a cloud-like defect path. This is because the first-level splitting result needs to be corrected: since the first level has already classified it as a pinhole branch, the actual path conflict arbitration mechanism prioritizes the first-level judgment result. Leaf node decision-making, specifically process-morphology joint discrimination: Local grayscale standard deviation contrast is embedded in the final decision layer. This local grayscale standard deviation contrast comes from a joint discrimination function of the S26 standardized value and a dynamic compensation factor, and precise grading is performed through logical rule combinations. Rule 1: If grayscale contrast ≥ 0.8 AND compensation factor ≥ 0.85, then the defect is classified as Level 4, indicating severe diffusion. Rule 2: If grayscale contrast ≥ 0.8 AND compensation factor < 0.85, then classify as a level 3 defect. Rule 3: If grayscale contrast < 0.8, then the defect is classified as level two or below. For example, for ID:A0087 unit #47, with an input grayscale contrast of 1.02 (1.02 > 0.8) and a compensation factor of 0.90 (0.90 > 0.85), rule 1 is triggered to output a level 4 star-shaped oxide spot determination, ultimately generating a defect type code, such as the star-shaped spot code ST-4 in the ASTM E1551 standard and the defect level after process compensation. Metallographic dissection verification shows a diffusion depth of 148μm, with a level 4 threshold of 140μm, and a consistency of 99.1%.
[0065] In a specific example of this invention, in the adaptive grading decision-making process for the star-shaped oxide spot on wheel hub ID: A0087, this invention achieves accurate determination through dynamic compensation and a three-level decision mechanism: First, in step S71, the electrolyte concentration of the anodizing tank is obtained in real time as 28 g / L, which is +12% off from the benchmark of 25 g / L. A compensation coefficient of 1.32 is generated through piecewise linear interpolation, where 1.0-1.2 corresponds to the 0-10% range and 1.2-1.5 corresponds to the 10-20% range. Based on this, the threshold values of the pre-trained CART decision tree nodes are adjusted: the first-layer area splitting threshold is adjusted from 0.05 mm. 2 Increased to 0.066mm 2 The second-layer contour complexity threshold was relaxed from -0.5 to -0.66; the subsequent output 4×4×64 feature tensor, including the area scaling value of unit #47 (0.38), contour complexity (-0.46), grayscale contrast (1.02), and compensation factor (0.90), is input into the compensated decision tree: the first layer is based on an area of 0.38, corresponding to 0.052mm. 2 <0.066mm 2 Initially, pinhole branches are identified. The second-layer extraction contour complexity (-0.46) exceeds the dynamic threshold (-0.66), triggering a cloud-like path. A conflict arbitration mechanism prioritizes retaining the first-layer pinhole judgment. Finally, a joint rule with grayscale contrast of 1.02 (≥0.8) and compensation factor of 0.90 (≥0.85) is embedded at the leaf node, triggering a "Level 4 Defect" judgment output, ASTM code ST-4. Metallographic analysis verifies a diffusion depth of 148μm, a Level 4 threshold of 140μm, and a 99.1% agreement rate. The entire process takes 46ms, supporting a 10fps production line cycle, saving 4.8 million yuan annually. This breakthrough overcomes the technical bottleneck of traditional static models where accuracy drops to 75% when concentration shift >10%.
[0066] In this embodiment, significant beneficial effects are achieved through process adaptive decision-making and a three-level decision mechanism: Firstly, at the dynamic process response level, the electrolyte concentration is collected in real time, such as the 28g / L offset of +12% in case ID:A0087. After piecewise linear interpolation, a compensation coefficient of 1.32 is generated, and the threshold of the CART decision tree nodes is dynamically adjusted, with the first-layer area threshold at 0.05mm. 2 up to 0.066mm 2 The second-layer contour complexity threshold ranges from -0.5 to -0.66, enabling the classifier to adapt to concentration fluctuations of ±20% in real time. This overcomes the industry challenge of static models experiencing accuracy degradation to 75% when process offsets exceed 10%. Furthermore, at the defect classification level, accurate judgment is achieved through a three-level decision chain of area-contour-process—the first layer is based on a dynamic area threshold of 0.066mm. 2 Separate macroscopic / microscopic defects, such as element #47 with an area of 0.052 mm. 2The threshold is assigned to the pinhole branch. The second layer distinguishes between cloud / sharp edge defects based on the adjusted contour threshold. The complexity of -0.46> threshold triggers the cloud path. The first layer's judgment result is retained through a conflict arbitration mechanism. Finally, a joint rule of grayscale contrast and compensation factor is embedded in the leaf node to drive the star spot level from the traditional level three to level four. The technology chain has been verified by metallographic dissection to have a diffusion depth of 148μm and a consistency of 99.1%. The entire process takes 46ms, supporting a production line cycle of 10fps, saving 4.8 million yuan in costs per year. It provides the first set of robust and fully automated quality inspection solutions for aluminum alloy wheel manufacturing.
[0067] like Figure 2 As shown, embodiments of the present invention also provide a machine vision-based device for identifying oxide spot defects on aluminum alloy surfaces, comprising: The acquisition module 21 is used to acquire a color image of the aluminum alloy surface, preprocess the image, and perform YUV color space conversion on the preprocessed image to extract the brightness component image. Extraction module 22 is used to perform CLAHE contrast-limited adaptive histogram equalization on the luminance component image, and generate a defect binary mask by combining Sauvola local dynamic thresholding; and to label the mask with 8-connected components, calculate the pixel-level geometric area features of each connected component, the contour spectral complexity based on Zernike moments, and the local gray-level standard deviation contrast as three basic indicators; extract the boundaries of the labeled connected components, verify the closed topological structure of the boundaries, and dynamically generate curvature-driven adaptive sampling points through multi-scale B-spline curvature extremum detection; Calculation module 23 is used to construct the minimum convex hull boundary based on the sampling point set, perform power-weighted Voronoi diagram spatial subdivision on the convex hull boundary, and generate constrained Delaunay triangular mesh elements for the defect region; based on the triangular mesh elements, a spatial topological index is established by hierarchical decomposition using Kirkpatrick trapezoidal diagram, the regularized area deformation rate of each element relative to the ideal oxide film region is calculated, and a dynamic morphological compensation factor is generated based on the standard deviation of the deformation rate set. The processing module 24 is used to fuse and correct the generated compensation factor and three basic indicators through the nonlinear mapping of the feature space of the radial basis function kernel to obtain the optimized defect feature tensor; input the defect characterization vector into the CART decision tree classifier, embed the dynamic compensation coefficient of the electrolyte concentration process parameter, and obtain the type code and standard defect level of the oxide spot defect.
[0068] It should be noted that this device is a device corresponding to the above method. All implementation methods in the above method embodiments are applicable to this embodiment and can achieve the same technical effect.
[0069] Embodiments of the present invention also provide a computing device, including: a processor and a memory storing a computer program, wherein the computer program, when executed by the processor, performs the method described above. All implementations in the above method embodiments are applicable to this embodiment and can achieve the same technical effects.
[0070] Embodiments of the present invention also provide a computer-readable storage medium storing instructions that, when executed on a computer, cause the computer to perform the method described above. All implementations in the above method embodiments are applicable to this embodiment and can achieve the same technical effects.
[0071] The above description represents the preferred embodiments of the present invention. It should be noted that those skilled in the art can make various improvements and modifications without departing from the principles of the present invention, and these improvements and modifications should also be considered within the scope of protection of the present invention.
Claims
1. A method for identifying oxide spot defects on aluminum alloy surfaces based on machine vision, characterized in that, The method includes: Step S1: Acquire a color image of the aluminum alloy surface and preprocess the image to extract the brightness component image; Step S2: Perform adaptive threshold segmentation for local contrast enhancement on the brightness component image, generate a binary mask for the defect region, extract morphological connected components based on the mask, and calculate three basic feature indicators: area pixel value, contour Fourier descriptor complexity, and regional grayscale standard deviation contrast of each connected component. Step S3: Extract the labeled connected domain boundaries, verify the boundary closure topology, and dynamically generate curvature-driven adaptive sampling points through multi-scale B-spline curvature extremum detection; Step S4: Based on the sampling point set, construct the minimum convex hull boundary, perform non-uniform quadtree partitioning on the convex hull boundary, and generate the surface Bezier fragments of the boundary constraints of the defect region. Step S5: Based on the curved Bezier fragments, a spatial topological index is established by hierarchical decomposition using Kirkpatrick trapezoidal diagrams. The regularized area deformation rate of each element relative to the ideal oxide film region is calculated, and a dynamic morphological compensation factor is generated based on the standard deviation of the deformation rate set. Step S6: The generated compensation factor and the three basic indicators are fused and corrected through the nonlinear mapping of the feature space of the radial basis function kernel to obtain the optimized defect feature tensor; Step S7: Input the defect characterization vector into the CART decision tree classifier, embed the dynamic compensation coefficient of the electrolyte concentration process parameter, and obtain the type code and standard defect level of the oxide spot defect.
2. The method for identifying oxide spot defects on aluminum alloy surfaces based on machine vision according to claim 1, characterized in that, Step S2 involves performing adaptive threshold segmentation for local contrast enhancement on the luminance component image to generate a binary mask of the defect region. Morphological connected components are then extracted from the mask, and three basic feature indicators are calculated for each connected component: area pixel value, contour Fourier descriptor complexity, and region gray-level standard deviation contrast. Step S21: Divide the brightness component image into local sub-regions and limit the slope of the histogram distribution to enhance the low-contrast cloud-like oxide spots, so as to obtain an image with contrast enhancement. Step S22: Perform improved Sauvola local thresholding on the enhanced image, obtain the mean and standard deviation of gray levels within the local window, and dynamically calculate the pixel-level threshold function based on the mean and standard deviation to generate a high-precision defect binary mask. Step S23: By scanning the mask pixels, establish connected region labels, filter out noise and pseudo-defects with an area of less than 5px, and obtain a set of independent connected regions; Step S24: Based on the set of independent connected components, count the total number of valid pixels within the connected components and calculate the pixel-level geometric area features; Step S25: Extract the boundary point sequence based on the set of independent connected components, calculate the 7th order Zernike orthogonal moments, quantify the contour irregularity through the variance of the moment modulus, and obtain the contour spectral complexity based on Zernike moments; Step S26: Calculate the standard deviation of pixel grayscale within the connected region based on the connected region, and use the standard deviation value to characterize the contrast difference between the defect and the background to obtain the local grayscale standard deviation contrast.
3. The method for identifying oxide spot defects on aluminum alloy surfaces based on machine vision according to claim 2, characterized in that, Step S3 involves extracting the labeled connected component boundaries, verifying the boundary closure topology, and dynamically generating curvature-driven adaptive sampling points through multi-scale B-spline curvature extremum detection, including: Step S31: Based on the set of independent connected components, extract the complete boundary coordinate point set of each connected component to obtain the marked connected component boundary; Step S32: Select any reference point from the set of marked connected domain boundary points and emit a four-way ray. Detect the odd number of intersections between the ray and the boundary edge, identify non-closed boundaries and remove the corresponding connected domains to obtain a set of verified closed boundaries. Step S33: Based on the closed boundary set, fit the smooth parameter curve using cubic B-spline basis functions, iteratively adjust the control point density in scale space, eliminate pixel-level jagged noise and retain the true geometric features, and obtain the multi-scale B-spline fitting curve. Step S34: Calculate the Gaussian curvature value at each point on the parameter fitting curve, locate the local extrema of curvature in the scale space, filter out invalid extrema points whose absolute curvature value is less than the threshold, and obtain the curvature distribution; Step S35: Dynamically generate sampling points based on curvature distribution to obtain curvature-driven adaptive sampling points.
4. The method for identifying oxide spot defects on aluminum alloy surfaces based on machine vision according to claim 3, characterized in that, Step S4: Based on the sampling point set, construct the minimum convex hull boundary, perform non-uniform quadtree partitioning on the convex hull boundary, and generate surface Bezier fragments for the boundary constraints of the defect region, including: Step S41: Based on the curvature-driven adaptive sampling point set, sort the point set by polar coordinates and establish a convex hull topology chain, filter out all internal concave points to eliminate local distortion, and generate the minimum convex polygon closed boundary that encloses the defect area. Step S42: Based on the closed boundary of the smallest convex polygon, perform a first-level subdivision with the convex hull as the initial bounding box, calculate the average curvature of the boundary of each sub-partition, and obtain a quadtree structure with non-uniform depth. Step S43: Based on the non-uniform depth quadtree structure, extract the leaf node corner points as Bezier control points, use bicubic parametric surface fitting to fit the local geometry, force the convex hull boundary to be the common edge of adjacent fragments, and generate the surface Bezier fragments with boundary constraints of the defect region.
5. The method for identifying oxide spot defects on aluminum alloy surfaces based on machine vision according to claim 4, characterized in that, Step S5: Based on the curved Bezier fragments, a spatial topological index is established using Kirkpatrick trapezoidal decomposition. The regularized area deformation rate of each element relative to the ideal oxide film region is calculated. A dynamic morphological compensation factor is generated based on the standard deviation of the deformation rate set, including: Step S51: Organize the curved Bezier fragments into a tree-like index structure to establish a fast query mechanism for cell adjacency relationships, so as to construct a spatial topology index; Step S52: Based on the constructed spatial topology index, obtain the actual pixel area of the current unit, calculate the theoretical area based on the ideal oxide film uniform thickness model, and generate a regularized deformation rate through the area ratio to obtain a set of regularized area deformation rates; Step S53: Based on the set of deformation rates, statistically analyze the discrete distribution of deformation rates of all grid elements, calculate the standard deviation of the set of deformation rates, and obtain the dynamic morphological compensation factor.
6. The method for identifying oxide spot defects on aluminum alloy surfaces based on machine vision according to claim 5, characterized in that, Step S6 involves fusing and correcting the generated compensation factor and the three basic indices through a nonlinear mapping of the feature space of the radial basis function kernel, resulting in the optimized defect feature tensor, including: Step S61: The heterogeneous features of the generated compensation factor and the three basic indicators are subjected to dimensional unification processing, including linearly scaling the area feature to the [0,1] interval, compressing the dynamic range of the contour complexity through logarithmic transformation, standardizing the grayscale contrast with Z-score, and retaining the original physical value of the compensation factor. Step S62: Based on the compensation factor and three basic indicators after the unified processing, and using the compensation factor as the kernel function scale parameter, calculate the nonlinear similarity relationship between the basic indicators, and map the original three-dimensional features to a higher-dimensional latent space to achieve radial basis function kernel space mapping; Step S63: Based on the radial basis function kernel space mapping, generate feature tensors through tensor structure recombination to obtain the optimized defect feature tensor.
7. The method for identifying oxide spot defects on aluminum alloy surfaces based on machine vision according to claim 6, characterized in that, Step S7: Input the defect characterization vector into the CART decision tree classifier, embed the dynamic compensation coefficient of the electrolyte concentration process parameter, and obtain the type code and standard defect level of the oxide spot defect, including: Step S71: Real-time acquisition of the process parameters of electrolyte molar concentration in the anodizing tank, generation of dynamic compensation function based on concentration offset, and adjustment of node splitting threshold of CART decision tree classifier accordingly to obtain process-compensated decision tree classifier; Step S72: Input the defect feature tensor into the process-compensated decision tree classifier, perform multi-level feature splitting, and obtain the type code and standard defect level of oxide spot defects. The multi-level feature splitting includes the first-level splitting node performing threshold segmentation based on pixel-level geometric area features; the second-level splitting node separating cloud-like and pinhole-like defects based on Zernike moment contour spectral complexity; and the leaf node decision rule embedding a joint discriminant function of local gray-level standard deviation contrast and dynamic morphological compensation factor.
8. A machine vision-based device for identifying oxide spot defects on aluminum alloy surfaces, the device implementing the method as described in any one of claims 1 to 7, comprising: The acquisition module is used to acquire color images of aluminum alloy surfaces, preprocess the images, and perform YUV color space conversion on the preprocessed images to extract the luminance component images. The extraction module performs CLAHE contrast-limited adaptive histogram equalization on the luminance component image, and generates a defect binary mask by combining it with Sauvola local dynamic thresholding. The mask is then labeled with 8-connected components, and three basic indicators are calculated: pixel-level geometric area features of each connected component, contour spectral complexity based on Zernike moments, and local gray-level standard deviation contrast. The boundaries of the labeled connected components are extracted and the boundary closure topology is verified. Curvature-driven adaptive sampling points are dynamically generated through multi-scale B-spline curvature extremum detection. The calculation module is used to construct the minimum convex hull boundary based on the sampling point set, perform power-weighted Voronoi diagram spatial partitioning on the convex hull boundary, and generate constrained Delaunay triangular mesh elements for the defect region. Based on the triangular mesh elements, a spatial topological index is established by hierarchical decomposition using Kirkpatrick trapezoidal diagram, and the regularized area deformation rate of each element relative to the ideal oxide film region is calculated. A dynamic morphological compensation factor is generated based on the standard deviation of the deformation rate set. The processing module is used to fuse and correct the generated compensation factor and the three basic indicators through the feature space nonlinear mapping of the radial basis function kernel to obtain the optimized defect feature tensor. The defect characterization vector is input into the CART decision tree classifier, and the dynamic compensation coefficient of the electrolyte concentration process parameter is embedded to obtain the type code and standard defect level of the oxide spot defect.
9. A computing device, characterized in that, include: One or more processors; A storage device for storing one or more programs, which, when executed by one or more processors, cause the one or more processors to implement the method as described in any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a program that, when executed by a processor, implements the method as described in any one of claims 1 to 7.
Citation Information
Patent Citations
Defect detection method of metal code disc without coating
CN119197323A
Three-dimensional setting printing correction method and device, equipment and storage medium
CN120689566A
Precise metal part surface defect imaging method and system in complex light field interference environment
CN120707450A
Aluminum alloy wire
CN220709981U
Method for three-dimensional reconstruction of the thread of the holes for the studs of the main connector of the reactor pressure vessel and automatic identification of defects
RU2791416C1
Cited By
Automobile part production mold surface smoothness detection system based on image enhancement
CN121304674A
Industrial intelligent visual inspection and diagnosis system for vertical shaft guide
CN121540635A
Blueberry tree disease and insect pest detection method based on machine vision
CN121544602A
Blueberry tree disease and pest detection method based on machine vision
CN121544602B
Watch processing laser engraving machine marking quality detection method and system
CN121582172A
