A method and device for identifying aluminum alloy surface oxidation spot defects based on machine vision

Through collaborative innovation of optics, algorithms, and processes based on machine vision, the problems of high missed detection of oxide spot defects on aluminum alloy surfaces and poor adaptability to curved surfaces have been solved, achieving high-precision and rapid defect detection and saving 4.8 million yuan in costs annually.

CN120894358BActive Publication Date: 2025-12-26SHAANXI LIANGDINGRUI METAL NEW MATERIAL CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202511403471.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-09-29
Publication Date
2025-12-26
Estimated Expiration
2045-09-29

AI Technical Summary

Technical Problem

Existing technologies suffer from high false negative rates, low efficiency, and poor adaptability to curved surfaces when detecting oxide spot defects on aluminum alloy surfaces. In particular, they are difficult to accurately identify pinholes smaller than 0.3 mm and low-contrast cloud spots, and the static feature library is difficult to adapt to the dynamic morphological changes of oxide spots.

Method used

Employing a machine vision-based approach, dynamic process compensation is achieved through collaborative innovation across three levels: optics, algorithm, and process. This includes a ring-shaped diffuse light source array, Retinex multi-scale illumination correction, CLAHE histogram slope constraint and improved Sauvola local threshold segmentation, multi-scale B-spline curvature extremum detection, surface Bezier fragment modeling, and Kirkpatrick trapezoidal graph hierarchical decomposition, combined with a CART decision tree classifier.

Benefits of technology

It significantly reduced the false alarm rate of curved surface reflection, improved the pinhole detection rate and boundary accuracy, reduced the inspection time of a single piece, improved the inspection accuracy and process adaptability, and saved 4.8 million yuan in costs annually.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120894358B_ABST
    Figure CN120894358B_ABST
Patent Text Reader

Abstract

The application provides a kind of aluminum alloy surface oxidation spot defect identification method and device based on machine vision, it is related to intelligent manufacturing and industrial automation field, the method comprises: obtaining aluminum alloy surface color image, pre-processing image to extract luminance component image;Local contrast enhancement is carried out to luminance component image, and adaptive threshold segmentation is generated, and the area binary mask of defect region is extracted, and the area binary mask is extracted according to mask morphological connected domain, and the area pixel value of each connected domain, the complexity of profile fourier descriptor and the contrast of area gray standard deviation three basic feature indexes are calculated;Extract the boundary of marked connected domain, verify the closed topological structure of boundary, and dynamically generate curvature driven adaptive sampling point by multi-scale B spline curvature extreme detection.The application realizes the breakthrough of detection such as the decrease of curved surface reflection false alarm rate, the increase of pinhole detection rate and the boundary accuracy of ±0.2 pixels through optical-algorithm-technology three-level collaborative innovation.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of intelligent manufacturing and industrial automation, in particular to an aluminum alloy surface oxidation spot defect recognition method and device based on machine vision. BACKGROUND

[0002] In a high-end automobile hub manufacturing plant, 6061 aluminum alloy is used to produce lightweight hubs. In the anodic oxidation process, due to fluctuations in the electrolyte concentration, the surface of the hub is prone to hidden oxidation spot defects, which are manifested as 0.5-3mm cloud-shaped patches with fuzzy boundaries and 0.1-0.8mm diameter, 50μm depth micro pinhole-shaped pits. Such defects not only damage the appearance of the product, but also cause stress concentration, leading to a decrease in the fatigue strength of the component by more than 60%, seriously threatening the safety of the equipment; the current detection technology faces three limitations: manual visual inspection has a high miss rate, with 18-25% miss rate for <0.3mm pinholes, low efficiency, with >2 minutes for single piece detection of curved workpieces, and strong subjectivity, with 30% difference rate in cloud spot determination.

[0003] Traditional machine vision methods have poor adaptability to curved surfaces, resulting in 12.7% feature drift and 15% spoke area false positives due to fixed grid segmentation, and micro-defect capture failure, which is manifested as the inability of global thresholding to identify low-contrast cloud spots with gray scale difference <8, and the elimination of <3 pixel real pinholes by morphological processing. Meanwhile, the lack of dynamic process response makes it difficult for the static feature library to adapt to the shape change of the oxidation spot. Ultimately, the existing algorithms have three disconnections in spatial dimension, specifically the mismatch between rigid grid and curved surface geometry, scale dimension, specifically the difficulty of fixed operators to balance macro / micro defects, and process dimension, specifically the lack of quantitative mechanism for dynamic growth of oxidation spots. SUMMARY

[0004] The technical problem to be solved by the present application is to provide an aluminum alloy surface oxidation spot defect recognition method and device based on machine vision, which can realize the breakthrough of reducing the false positive rate of curved surface reflection, increasing the pinhole detection rate, and achieving a boundary accuracy of ±0.2 pixels through optical-algorithm-process three-level collaborative innovation. Combined with dynamic process compensation covering 10-30g / L concentration fluctuations, the single piece detection time is 9.3 seconds, and the annual cost savings are 4.8 million, which solves the industry-wide pain points.

[0005] To solve the above technical problems, the technical solution of the present application is as follows:

[0006] In a first aspect, an aluminum alloy surface oxidation spot defect recognition method based on machine vision is provided, the method comprising:

[0007] Step S1: Obtain a color image of the aluminum alloy surface, and pre-process the image to extract a brightness component image;

[0008] Step S2: adaptive threshold segmentation of local contrast enhancement on the luminance component image to generate a defect region binary mask, and extract morphological connected domains according to the mask, and calculate three basic feature indexes of area pixel value, contour Fourier descriptor complexity and region gray standard deviation contrast of each connected domain;

[0009] Step S3: extract the boundary of the labeled connected domain, verify the closed topological structure of the boundary, and dynamically generate curvature-driven adaptive sampling points through multi-scale B-spline curvature extreme value detection;

[0010] Step S4: according to the sampling point set, construct the minimum convex hull boundary, perform non-uniform quadtree subdivision on the convex hull boundary, and generate a boundary-constrained surface Bezier patch of the defect region;

[0011] Step S5: according to the surface Bezier patch, establish a spatial topology index by using Kirkpatrick trapezoidal graph hierarchical decomposition, calculate the regularization area deformation rate of each unit relative to the ideal oxide film region, and generate a dynamic morphological compensation factor based on the standard deviation of the deformation rate set;

[0012] Step S6: fuse and correct the generated compensation factor and the three basic indexes through nonlinear mapping in the feature space of the radial basis function kernel to obtain an optimized defect feature tensor;

[0013] 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 grade of the oxidation spot defect.

[0014] Further, in step S2, adaptive threshold segmentation of local contrast enhancement is performed on the luminance component image to generate a defect region binary mask, and morphological connected domains are extracted according to the mask, and three basic feature indexes of area pixel value, contour Fourier descriptor complexity and region gray standard deviation contrast of each connected domain are calculated, including:

[0015] Step S21: divide the luminance component image into local sub-regions, and limit the histogram distribution slope to enhance the low-contrast cloud-shaped oxidation spots to obtain a contrast-enhanced processed image;

[0016] Step S22: perform improved Sauvola local threshold segmentation on the enhanced image to obtain the gray mean and standard deviation in the local window, and dynamically calculate the pixel-level threshold function according to the mean and standard deviation to generate a high-precision defect binary mask;

[0017] Step S23: establish a connected region label by scanning the mask pixels, filter out noise pseudo-defects with an area less than 5px, and obtain an independent connected domain set;

[0018] Step S24: According to the independent connected domain set, the total number of effective pixels in the connected domain is counted, and the pixel-level geometric area feature is calculated;

[0019] Step S25: According to the independent connected domain set, the boundary point sequence is extracted, the 7th order Zernike orthogonal moment is calculated, the profile irregularity is quantified by the moment modulus value variance, and the profile spectral complexity based on Zernike moment is obtained;

[0020] Step S26: According to the connected domain region, the standard deviation of the pixel gray scale in the region is calculated, the standard deviation value is used to represent the contrast difference between the defect and the background, and the local gray scale standard deviation contrast is obtained.

[0021] Further, step S3, the boundary of the marked connected domain is extracted, and the closed topological structure of the boundary is verified, and the curvature-driven adaptive sampling points are dynamically generated by multi-scale B-spline curvature extreme value detection, including:

[0022] Step S31: According to the independent connected domain set, the complete boundary coordinate point set of each connected domain is extracted, and the boundary of the marked connected domain is obtained;

[0023] Step S32: Four-way rays are emitted from the optional reference point of the marked connected domain boundary point set, the odd intersection characteristics of the rays and the boundary edges are detected, the non-closed boundary is identified and the corresponding connected domain is removed, and the closed boundary set that passes the verification is obtained;

[0024] Step S33: According to the closed boundary set, a smooth parameter curve is fitted by a cubic B-spline basis function, the control point density is iteratively adjusted in the scale space, the pixel-level sawtooth noise is eliminated and the true geometric feature is retained, and a multi-scale B-spline fitting curve is obtained;

[0025] Step S34: The Gaussian curvature value of each point on the parameter fitting curve is calculated, the local extreme point of the curvature is located in the scale space, the invalid extreme point with an absolute value of the curvature less than a threshold value is filtered, and the curvature distribution is obtained.

[0026] Step S35: According to the curvature distribution, the sampling points are dynamically generated, and the curvature-driven adaptive sampling points are obtained.

[0027] Further, step S4, according to the sampling point set, a minimum convex hull boundary is constructed, the convex hull boundary is subjected to non-uniform quadtree subdivision, and a boundary-constrained surface Bezier patch of the defect region is generated, including:

[0028] Step S41: According to the curvature-driven adaptive sampling point set, the point set is sorted according to the polar coordinates and the convex hull topological chain is established, all internal concave points are filtered to eliminate local distortion, and a minimum convex polygon closed boundary wrapping the defect region is generated;

[0029] Step S42: According to the minimum convex polygon closed boundary, the first-order subdivision is carried out with the convex hull as the initial bounding box, the average curvature of the boundary of each sub-partition is calculated, and a depth non-uniform quadtree structure is obtained;

[0030] Step S43: According to the depth non-uniform quadtree structure, the corner points of the leaf nodes are extracted as Bezier control points, the local geometric morphology is fitted by using a bicubic parametric surface, the convex hull boundary is forced to be a common edge of adjacent patches, and a boundary-constrained curved surface Bezier patch of the defect region is generated.

[0031] Further, step S5, according to the curved surface Bezier patch, a spatial topology index is established by using Kirkpatrick trapezoidal diagram hierarchical decomposition, the regularization area deformation rate of each unit 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, including:

[0032] Step S51: The curved surface Bezier patch is hierarchically organized into a tree index structure, a fast query mechanism of unit adjacency relationship is established, and a spatial topology index is constructed;

[0033] Step S52: According to the constructed spatial topology index, the actual pixel area of the current unit is obtained, the theoretical area is calculated based on the ideal oxide film uniform thickness model, and the regularization deformation rate is generated through the area ratio, and a regularization area deformation rate set is obtained;

[0034] Step S53: According to the deformation rate set, the discrete distribution of the deformation rate of all grid units is counted, the standard deviation of the deformation rate set is calculated, and a dynamic morphological compensation factor is obtained.

[0035] Further, step S6, the generated compensation factor and three basic indicators are fused and corrected through nonlinear mapping of the characteristic space of the radial basis function kernel, and an optimized defect feature tensor is obtained, including:

[0036] Step S61: The heterogeneous features of the generated compensation factor and the three basic indicators are subjected to dimensionless processing, including linear scaling of the area feature to the [0, 1] interval, compression of the dynamic range of the contour complexity through logarithmic transformation, Z-score standardization of the gray scale contrast, and retention of the original physical value of the compensation factor;

[0037] Step S62: According to the unified compensation factor and the three basic indicators, the nonlinear similarity relationship between the basic indicators is calculated with the compensation factor as the kernel function scale parameter, the original three-dimensional features are mapped to a higher-dimensional hidden space, and the radial basis function kernel space mapping is realized;

[0038] Step S63: According to the radial basis function kernel space mapping, a feature tensor is generated by tensor structuring and reorganization, and an optimized defect feature tensor is obtained.

[0039] Further, step S7, input the defect feature vector into the CART decision tree classifier, embed the dynamic compensation coefficient of electrolyte concentration process parameter, obtain the type code and standard defect level of oxidation spot defect, including:

[0040] Step S71: Real-time acquire the molar concentration process parameter of anodic oxidation tank electrolyte, generate a dynamic compensation function according to the concentration offset, and adjust the node splitting threshold of the CART decision tree classifier accordingly to obtain the process-compensated decision tree classifier;

[0041] Step S72: Input the defect feature tensor into the process-compensated decision tree classifier to perform multi-level feature splitting to obtain the type code and standard defect level of the oxidation spot defect, wherein the multi-level feature splitting includes threshold segmentation of the first layer splitting node based on pixel-level geometric area features; the second layer splitting node separates cloud-shaped and pinhole-shaped defects according to Zernike moment profile spectrum complexity; and the leaf node decision rule embeds a joint discriminant function of local gray standard deviation contrast and dynamic morphological compensation factor.

[0042] The second aspect is an aluminum alloy surface oxidation spot defect recognition device based on machine vision, comprising:

[0043] The acquisition module is configured to acquire a color image of the aluminum alloy surface, pre-process the image, and perform YUV color space conversion on the pre-processed image to extract a luminance component image;

[0044] The extraction module is configured to perform CLAHE contrast limited adaptive histogram equalization on the luminance component image, generate a defect binary mask by combining Sauvola local dynamic threshold segmentation; and perform 8-connected domain labeling on the mask, calculate three basic indexes of pixel-level geometric area features, Zernike moment-based profile spectrum complexity, and local gray standard deviation contrast; extract the boundary of the labeled connected domain, verify the closed topological structure of the boundary, and dynamically generate curvature-driven adaptive sampling points through multi-scale B-spline curvature extreme value detection;

[0045] The calculation module is configured to construct a minimum convex hull boundary according to the sampling point set, perform power-weighted Voronoi diagram spatial subdivision on the convex hull boundary to generate a constrained Delaunay triangular mesh element of the defect area; establish a spatial topological index by adopting Kirkpatrick trapezoidal diagram hierarchical decomposition based on the triangular mesh element, calculate the regularization area deformation rate of each element relative to the ideal oxidation film area, and generate a dynamic morphological compensation factor based on the standard deviation of the deformation rate set;

[0046] The processing module is used for fusing and correcting the generated compensation factor and three basic indexes through nonlinear mapping of a characteristic space of a radial basis function kernel to obtain an optimized defect feature tensor; and inputting the defect feature vector into a CART decision tree classifier, embedding a dynamic compensation coefficient of an electrolyte concentration process parameter, and obtaining a type code and a standard defect grade of the oxidation spot defect.

[0047] In a third aspect, a computing device includes:

[0048] one or more processors;

[0049] a memory storage for storing one or more programs, when the one or more programs are executed by the one or more processors, so that the one or more processors implement the method.

[0050] In a fourth aspect, a computer readable storage medium has stored therein a program, which, when executed by a processor, implements the method.

[0051] The above scheme of the present application at least has the following beneficial effects:

[0052] Firstly, in the aspect of detection accuracy, the annular diffuse light source array is combined with Retinex multi-scale light correction to eliminate the interference of curved surface reflection, so that the false alarm rate of strong reflection area is reduced from 18% to 1.8%; the cascade processing of CLAHE histogram slope constraint and improved Sauvola dynamic threshold segmentation improves the detection rate of low-contrast cloud and mist spots to 98% and accurately retains the pinhole defects of greater than or equal to 3px, and the curvature-driven adaptive sampling realizes the capture of star-shaped lines of 0.05mm level, and the boundary approximation accuracy is ±0.2 pixels;

[0053] Further, in the aspect of process adaptability, the regularized area deformation rate is used to compensate the projection distortion of the curved surface, and the standard deviation of the deformation rate is used to quantify the diffusion degree, so that the detection rate of serious cloud and mist spots reaches 99.1%, and the dynamic compensation factor is used to drive the threshold adjustment of the decision tree in cooperation with the real-time electrolyte concentration, covering the process fluctuation range of 10-30g / L; finally, in the aspect of industrial effectiveness, the single-piece detection time is compressed to 9.3 seconds, the defect classification accuracy is 99.1%, the annual cost is saved by 4.8 million yuan, and the three industry problems of 12.7% feature drift, 25% pinhole missed detection and static feature library process response failure caused by poor adaptability of the background technology are completely solved. BRIEF DESCRIPTION OF DRAWINGS

[0054] Figure 1 is a flowchart of an aluminum alloy surface oxidation spot defect recognition method based on machine vision provided by an embodiment of the present application.

[0055] Figure 2A schematic diagram of an aluminum alloy surface oxidation spot defect recognition device based on machine vision provided by an embodiment of the present application. DETAILED DESCRIPTION

[0056] Exemplary embodiments of the present disclosure will be described in greater detail below with reference to the accompanying drawings. Although exemplary embodiments of the present disclosure are shown in the drawings, it is understood that the present disclosure can be implemented in various forms and should not be limited by the embodiments set forth herein. Rather, these embodiments are provided so that the present disclosure can be more thoroughly understood and the scope of the present disclosure can be accurately conveyed to those skilled in the art.

[0057] As Figure 1 shown, an embodiment of the present application proposes a method for recognizing aluminum alloy surface oxidation spot defects based on machine vision, the method comprising the following steps:

[0058] Step S1: Obtain a color image of the aluminum alloy surface, and pre-process the image to extract a luminance component image;

[0059] Step S2: Perform adaptive threshold segmentation of the local contrast enhancement on the luminance component image to generate a defect region binary mask, extract a morphological connected domain according to the mask, and calculate three basic feature indexes of area pixel value, contour Fourier descriptor complexity, and region gray standard deviation contrast of each connected domain;

[0060] Step S3: Extract the boundary of the marked connected domain, verify the closed topological structure of the boundary, and dynamically generate curvature-driven adaptive sampling points through multi-scale B-spline curvature extremum detection;

[0061] Step S4: According to the set of sampling points, construct a minimum convex hull boundary, perform non-uniform quadtree subdivision on the convex hull boundary, and generate a boundary-constrained surface Bezier patch of the defect region;

[0062] Step S5: According to the surface Bezier patch, establish a spatial topology index by using Kirkpatrick trapezoidal graph hierarchical decomposition, calculate the regularization area deformation rate of each unit relative to the ideal oxidation film region, generate a dynamic morphological compensation factor based on the standard deviation of the deformation rate set;

[0063] Step S6: Fuse and correct the generated compensation factor and the three basic indexes through nonlinear mapping of the feature space of the radial basis function kernel to obtain an optimized defect feature tensor;

[0064] Step S7: Input the defect characterization vector into a CART decision tree classifier, embed a dynamic compensation coefficient of electrolyte concentration process parameters, and obtain the type code and standard defect grade of the oxidation spot defect.

[0065] In the embodiment of the application, through a seven-stage collaborative innovation mechanism, the core pain points of aluminum alloy surface oxidation spot detection are solved by device: in the optical pretreatment stage, the ring-shaped light source diffuse reflection compensation combined with Retinex theory correction eliminates the interference of hub curved mirror surface reflection, reduces the false alarm rate of strong reflection area from 18% to 1.8%; in the defect segmentation link, the cascade processing of CLAHE enhancement and Sauvola dynamic threshold segmentation makes the detection rate of low-contrast cloud spots increase to 98% and retains ≥3px pinhole defects, and the compression rate is reduced to 1.2%; in the geometric modeling layer, the curvature-driven sampling point density optimization combined with the boundary constraint of Bezier patch parameterized modeling reduces the memory occupation of traditional grid by 66% and the boundary approximation accuracy reaches ±0.2 pixels, realizing the accurate capture of 0.05mm level star-shaped radial pattern; in the process quantization stage, the regularized area deformation rate eliminates the distortion of curved surface projection, and the deformation rate standard deviation quantifies the oxidation spot diffusion degree, so that the detection rate of serious cloud spots reaches 99.1%; in the multi-source fusion layer, the radial basis kernel mapping captures the process-morphology nonlinear correlation, and the feature tensor drives the cloud spot classification accuracy to increase by 37 percentage points; in the decision output end, the electrolyte concentration compensation mechanism covers the process fluctuation range of 10-30g / L, combined with the ASTM standard grading output, the single piece detection time is compressed to 9.3 seconds, providing the first set of full-automatic quality inspection solution for new energy vehicle hub manufacturing.

[0066] In a preferred embodiment of the application, step S1, obtaining an aluminum alloy surface color image, pre-processing the image to extract a luminance component image, can include:

[0067] Obtaining an aluminum alloy surface color image, using a ring-shaped diffuse light source array for illumination compensation, performing illumination correction preprocessing based on Retinex theory, and performing YUV color space conversion on the corrected image to extract the luminance component.

[0068] The specific process includes:

[0069] First, the annular diffuse light source array is arranged around the measured aluminum alloy surface, and the light source incidence angle is distributed in the 15°-75° interval through precise optical design, so as to form a uniform irradiation field in the hub curved surface area; a high-resolution industrial line array camera is used to collect original color images along the axial motion trail of the workpiece, and the diffuse reflection characteristics of the light source array suppress the mirror highlight interference in the process. Further, the collected images are input into the image processing module based on the Retinex theory, and the image illumination component and the reflection component are decomposed through a multi-scale Gaussian convolution kernel, wherein the illumination component represents the environmental light distribution, and the reflection component represents the intrinsic characteristics of the object, and the local overexposed area is eliminated and the dark details are enhanced through component reweighting fusion. Subsequently, the color space conversion operation is performed, the RGB pixel value of the corrected image is input into the conversion matrix defined by the CIE 1931 standard, the YUV three-channel components are calculated through linear transformation, and finally the Y channel brightness component is extracted as the key input data for defect recognition.

[0070] In a specific case of the application, in the new energy automobile aluminum alloy hub surface oxidation spot detection device, first, the annular diffuse light source array is arranged coaxially around the hub workpiece, wherein the spoke area adopts 45°±5° incidence angle compensation curved reflection, and the rim groove area adopts 75°±5° large-angle incidence to improve the dark part illumination; the high-resolution line array camera is driven to move uniformly along the hub rotation axis, and the original RGB image is collected under the coordinated irradiation of the light source array, and the overexposed area caused by the mirror reflection of the spoke curved surface is successfully suppressed. Further, the collected images are input into the preprocessing module based on the Retinex theory, and the intrinsic reflection characteristics of the oxidation film on the hub surface are separated through a multi-scale decomposition algorithm, and the influence of uneven environmental light is eliminated, so that the gray variance of the rim groove bottom area is reduced from the original value 128 to 32. Subsequently, the conversion matrix defined by the CIE 1931 standard is used to convert the corrected image from the RGB space to the YUV space, and the extracted Y channel brightness component clearly presents the 0.1mm level oxidation spot texture on the spoke surface, and the gray contrast is ≥8.

[0071] 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.

[0072] 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.

[0073] 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.

[0074] The specific process includes:

[0075] 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.

[0076] Step S22: Improved Sauvola local threshold segmentation is performed on the enhanced image to obtain the mean and standard deviation of the gray scale in the local window, and a pixel-level threshold function is dynamically calculated according to the mean and standard deviation to generate a high-precision defect binary mask;

[0077] The specific process includes:

[0078] Based on the foregoing enhanced image data stream, an improved Sauvola dynamic threshold segmentation device is deployed: a sliding calculation window with a configurable size is established on the image plane, and the window is adaptively adjusted in coverage according to the defect size characteristics; the statistical distribution characteristics of the pixel gray scale values in the window are captured in real time, including the arithmetic mean representing the light and dark tone 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: a rectangular sliding window with an adaptive size is established centered on a pixel, and the arithmetic mean and standard deviation of the gray scale values of all pixels in the window are calculated in real time, for example, in the hub and rim groove area, the window is automatically expanded to 25x25 pixels to cover the low-illumination feature; an initial threshold reference is generated from the linear combination of the mean and standard deviation, and a morphological opening operation is introduced to predict the result as a correction term, wherein the correction amount is dynamically generated based on the preview result: if the center of the current window is located in the preview defect area, the correction amount = +k x standard deviation, and k is a gain coefficient, and a typical value is 0.2; if it is located in the background area, the correction amount = -k x standard deviation; the weight coefficient of the standard deviation term is automatically adjusted according to the gray scale variance value in the window: the local contrast contribution is strengthened in the high-variance area, and the noise interference is weakened in the low-variance area; a threshold surface dynamically evolving with the spatial position is finally generated, and its function form can be expressed as: dynamic threshold = mean x [1 + weight coefficient x (standard deviation / maximum standard deviation)] + correction amount, which introduces a morphological topological constraint factor to distinguish between real micro-defects and imaging noise; the original gray scale image is converted into a binary mask through a pixel-by-pixel threshold judgment operation, wherein the defect area is marked with the highest bit width value, and the background area is processed to zero, and the gray scale value of each pixel in the enhanced image is compared with the dynamic threshold value at the corresponding position in real time: if the pixel value is lower than the threshold value: it is marked as a defect and assigned a value of 1; if the pixel value is higher than the threshold value: it is marked as background and assigned a value of 0, and finally a defect segmentation mask with sub-pixel boundary precision is output.

[0079] Step S23: By scanning the mask pixels, a connected region label is established, noise pseudo-defects with an area less than 5px are filtered out, and an independent connected domain set is obtained;

[0080] The specific process includes:

[0081] Performing full-pixel field connectivity analysis on binary mask: First, traverse the mask matrix by two-pass scanning strategy, the first pass scans to implement temporary label assignment and equivalence relation record, the second pass scans to parse the equivalence table to complete the label unification mapping; based on the preset morphological area threshold, filter out the pseudo-defect area generated by dust adhesion or imaging noise, while recording the boundary chain code and topological adjacency relationship of the effective connected domain; finally output the connected domain set with spatial independence and topological integrity, which contains the basic descriptors such as the geometric centroid and the circumscribed rectangle of each connected domain.

[0082] Step S24: According to the independent connected domain set, the total number of effective pixels in the connected domain is counted, and the pixel-level geometric area feature is calculated;

[0083] The specific process includes:

[0084] Based on the spatial topological information of the connected domain set, the total number of pixels marked as defect state inside each independent connected domain is counted, which directly maps the physical coverage area of the defect; through the pixel size calibration coefficient, the pixel number is converted into the actual geometric area value, establishing the primary quantitative index of defect size; this area feature value is used as the basic parameter for defect severity grading, and its numerical distribution range covers the full-scale defect representation requirements from micron-level pinholes to millimeter-level patches.

[0085] Step S25: According to the independent connected domain set, the boundary point sequence is extracted, the 7th order Zernike orthogonal moment is calculated, and the profile irregularity is quantified by the moment modulus variance, obtaining the profile spectral complexity based on Zernike moment;

[0086] The specific process includes:

[0087] First, analyze the connected domain boundary chain code sequence and convert it to a closed profile point set in the Cartesian coordinate system; calculate the modulus value set of the 7th order Zernike orthogonal moment for this point set, which has rotation invariance and noise robustness; then calculate the statistical variance value of the modulus value set, and quantify the geometric irregularity of the profile boundary by the variance value: high variance represents sharp turns or fractal features in the profile, and low variance indicates a smooth boundary; specifically including:

[0088] First, extract the closed boundary point sequence 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 value of all boundary point coordinates as the new origin, and translate all points to the center coordinate system; polar radius normalization: take the farthest boundary point distance as the reference unit, and scale all point radial coordinates to the unit circle;

[0089] The 7th order Zernike orthogonal polynomial basis function is defined in the unit circle domain, and 36 orthogonal bases are generated according to the order-repetition combination, the order n=7, and the repetition m is an even number in [-7, 7], including: the radial component: the n-order orthogonal function of the radius r is constructed by using the Jacobi polynomial; the angular component: the m-order periodicity of the angle θ is expressed in the form of a trigonometric function;

[0090] Discrete integral operation is performed on the normalized boundary point sequence: each boundary point is traversed, the product of the boundary point and the 36 Zernike basis functions is calculated and accumulated. The complex form moment value is generated: =real part+j*imaginary part, is the moment value; the modulus of each moment value is calculated: ;

[0091] The profile spectral complexity is calculated based on the statistical distribution of the 36 modulus values: variance calculation: the statistical variance of the modulus value set is calculated: wherein μ is the mean value of the modulus value, is the variance, is the total number of modulus values; the complexity is mapped: the larger the variance value, the higher the profile irregularity, wherein the star-shaped line variance is 0.35>the smooth profile is 0.05.

[0092] The final output is the spectral complexity index based on the Zernike moment, which maintains mathematical invariance for workpiece rotation, translation and scale change, and overcomes the feature drift defect of the traditional profile factor under random pose in the production line.

[0093] Step S26: According to the connected domain region, the standard deviation of the pixel gray scale in the region is calculated, the contrast difference between the defect and the background is represented by the standard deviation value, and the local gray scale standard deviation contrast is obtained.

[0094] The specific process includes:

[0095] The pixel region corresponding to the connected domain is accurately positioned on the original brightness image, and the gray scale value sample set of all pixels in the region is extracted; the standard deviation statistic of the sample set is calculated by the standard deviation formula, which represents the gray scale fluctuation intensity inside the defect region: high standard deviation indicates that the defect has a significant edge gradient or internal texture variation, and low standard deviation reflects the homogenization of the gray scale distribution; the standard deviation value is used as a proxy variable for the visual contrast between the defect and the background, and a positive correlation model with the visual saliency of the oxidation spot is established; finally, the local gray scale standard deviation contrast index is generated, which has strong tolerance to changes in lighting conditions and ensures feature stability.

[0096] 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.

[0097] 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. 2The measurement accuracy meets the requirements of ASTM E1551 standard for defect size classification; the spectral complexity index based on Zernike matrix has three mathematical invariances of rotation, translation and scale, and the feature fluctuation is less than 0.01 under random pose of the hub, which solves the problem of feature drift caused by production line vibration; the local gray standard deviation contrast establishes a strong correlation with visual saliency, providing illumination-robust features for classification decision. The whole chain cooperation makes the comprehensive accuracy of aluminum alloy hub oxidation spot detection reach 99.3%, and the single piece detection efficiency is improved by 12 times, forming a quality inspection closed loop from imaging optimization to quantitative decision.

[0098] In a preferred embodiment of the present application, step S3, extracting the label connected domain boundary and verifying the boundary closed topological structure, and dynamically generating curvature-driven adaptive sampling points through multi-scale B-spline curvature extremum detection, can include:

[0099] Step S31: According to the independent connected domain set, extract the complete boundary coordinate point set of each connected domain to obtain the label connected domain boundary;

[0100] The specific process includes:

[0101] Firstly, based on the independent connected domain set data structure output in step S23, the boundary coordinate extraction operation is performed for each label connected domain: the chain code tracking algorithm is used to traverse the connected domain periphery contour in a clockwise direction, and the Cartesian coordinate system position values of all boundary turning points are recorded, wherein the traversal process ensures the integrity of the closed path contour through eight-neighbor connectivity judgment; then a spatial index structure of the boundary point sequence is established, which stores the coordinates of each point in the contour direction order and is associated with the unique identifier of the connected domain; finally, a boundary point set database with topological correlation is generated, which has the key characteristic of preserving the original pixel-level position accuracy.

[0102] Step S32: From the optional reference point of the label connected domain boundary point set, four-way rays are emitted, the odd intersection characteristics of the rays and the boundary edges are detected, the non-closed boundary is identified and the corresponding connected domain is removed, and a closed boundary set that passes the verification is obtained;

[0103] The specific process includes:

[0104] 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, and four infinite reference rays are generated in the horizontal and vertical directions, including 0° / 90° / 180° / 270°; based on the principle of line segment intersection detection in computational geometry, the number of spatial intersections of the rays with the boundary edges is calculated one by one, and the closure characteristic is determined according to the odd intersection principle; when the number of intersections of any ray is even, it is identified that the connected domain has a boundary fracture or an internal hole defect; further, the topologically abnormal connected domain is removed from the processing queue, and only the closed boundary set verified by the omnidirectional ray is retained; finally, the effective connected domain boundary data strictly screened is output.

[0105] Step S33: According to the closed boundary set, a smooth parameter curve is fitted by a cubic B-spline basis function, the control point density is iteratively adjusted in the scale space, the pixel-level sawtooth noise is eliminated and the real geometric features are retained, and a multi-scale B-spline fitting curve is obtained.

[0106] The specific process includes:

[0107] Based on the verified closed boundary point set, the curve parameterization reconstruction is performed: a cubic B-spline basis function is used to perform least squares fitting on the discrete boundary points to generate an initial smooth parameter curve; further, multi-round iterative optimization is performed in the scale space framework: by introducing a scale parameter to control the smoothness of the curve, high-frequency pixel sawtooth noise is filtered out at a coarse scale, and the control point density is finely adjusted to approximate the real geometric features at a fine scale; in each iteration, control points are dynamically added or deleted according to the curvature change gradient, ensuring that the contour mutation region has higher fitting accuracy; finally, a multi-scale optimized B-spline parameter curve is output.

[0108] Step S34: The Gaussian curvature values of each point on the parameter fitting curve are calculated, and the local extreme points of curvature are located in the scale space; invalid extreme points with absolute curvature values less than a threshold value are filtered out, and the curvature distribution is obtained.

[0109] The specific process includes:

[0110] Differential geometric feature analysis is performed on the parameterized curve: first, the curve parameter equation is sampled at a fixed step to calculate the point set, and the vector operation of the first-order derivative vector and the second-order derivative vector of the curve is performed to solve the Gaussian curvature value of each sampling point, including:

[0111] The multi-scale B-spline fitting curve generated in step S33, such as the 1024-point fitting curve of the star-shaped pattern ID:A0087, is resampled at equal arc length: the curve parameter domain is equally divided into high-density discrete points with a step of 0.1 pixels, and the Cartesian coordinates and the first-order / second-order derivative vectors of the parameter equation of each sampling point are calculated.

[0112] Vector operation based on parameter equation derivative: the tangent vector is the normalized first derivative, representing the tangent direction of the curve; the normal vector is the orthogonal vector of the tangent vector, representing the curvature direction;

[0113] Gaussian curvature synthesis through differential geometry: first, calculate the curvature radius, and then calculate the reciprocal of the curvature radius by using the proportional relationship between the second derivative modulus and the change rate of the tangent vector; then, assign the sign according to the rule: when the normal vector points to the concave side of the curve, the curvature is positive, and when the normal vector points to the convex side of the curve, the curvature is negative; finally, calculate the curvature synthesis;

[0114] Curvature effectiveness screening in scale space: scan the curvature sequence, mark the sign inversion points of the curvature change, locate the extreme value points, and remove the pseudo extreme value points with an absolute value less than a preset threshold.

[0115] Based on the vector operation of the first derivative and the second derivative of the curve, the Gaussian curvature value of each sampling point is calculated, which quantifies the local contour bending strength; then, the curvature function is scanned in the multi-scale space, and the curvature peak points and valley points are located through the local extreme value detection algorithm to form a candidate feature point set; according to the preset curvature threshold, the typical absolute value lower limit is 0.02, and the pseudo extreme value points generated by fitting residual noise or slight fluctuations are filtered; finally, the curvature distribution map reflecting the essential geometric features of the contour is generated.

[0116] Step S35: dynamically generate sampling points according to the curvature distribution to obtain curvature-driven adaptive sampling points.

[0117] The specific process includes:

[0118] Based on the curvature distribution map, implement spatial adaptive sampling: first, divide the curvature value range into a high curvature feature area, specifically |κ|>0.05, and a low curvature gentle area, specifically |κ|≤0.05; in the high curvature area, use a nonlinear density distribution strategy: the sampling point spacing is inversely proportional to the absolute value of the curvature, ensuring that key features such as contour turning points and corner points are densely captured; in the low curvature area, implement equal arc length uniform sampling, which significantly reduces data redundancy; especially for adjacent feature points, implement a minimum spacing protection mechanism to avoid excessive aggregation of sampling points; finally, generate a curvature-driven optimized sampling point set, 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.

[0119] In a specific case of the present application, for the defects of spoke area 1.5mm cloud spot, ID: A0032 and spoke star-shaped radial streak, ID: A0087, the boundary coordinates are extracted by eight-neighborhood chain code tracking, 32 acute corner turning points of the star-shaped streak are successfully captured, and the contour point set positioning accuracy is ±0.5 pixels; four-way rays are emitted from the star-shaped streak boundary reference point, and it is detected that there is an odd number of intersections in the 270° direction, which is determined as a topological abnormal connected domain, which is verified by metallography as an oxidation spot diffusion channel; the cloud spot boundary is subjected to three times of B-spline multi-scale fitting, in the coarse scale, wherein, σ=1.2, the grinding texture noise is eliminated, and in the fine scale, wherein, σ=0.3, the 0.2mm level protrusion characteristics are retained, and the Hausdorff distance between the reconstructed contour and the true defect is only 0.3 pixels; when calculating the curvature distribution of the star-shaped streak according to step S34, the extreme point of |κ|=0.15 is detected at the end of the radial branch, and the flat area |κ|=0.01, after threshold filtering, when |κ|>0.02, 7 effective feature points are confirmed, which is consistent with the scanning result of the electron microscope with a degree of 98.7%; based on the curvature atlas, sampling is implemented: at the branch of the star-shaped streak, the sampling point distance is encrypted to 2 pixels in inverse proportion to the curvature, and in the flat area, the sampling point distance is 12 pixels, and the total sampling points are optimized from 1024 points to 386 points, which ensures the full capture of 7 feature points, and at the same time, reduces the time-consuming of subsequent convex hull calculation from 35ms to 12ms.

[0120] In this embodiment, the boundary point set sub-pixel level accuracy extraction is realized by eight-neighborhood chain code tracking, and 32 acute corner turning features of the hub star-shaped oxidation streak are completely captured; the four-way ray odd number of intersection verification mechanism is adopted, and the 0.1mm level internal hole boundary is successfully identified, and 92% of the boundary misjudgment risk is eliminated; step S33 cooperatively optimizes in coarse / fine scale through multi-scale B-spline fitting, so that the Hausdorff distance of the contour reconstruction is reduced to 0.3 pixels; based on the curvature threshold filtering of differential geometry, |κ|>0.02 accurately locates 7 essential feature points, and eliminates 95% of noise interference; curvature-driven adaptive sampling is implemented, and the feature area point distance is 2px / flat area 12px, which reduces 62% of the sampling points under the premise of retaining 100% of the geometric features, and accelerates the subsequent convex hull calculation by 3 times. The whole chain cooperation makes the geometric representation integrity of the micro-defects reach 99.3%.

[0121] In a preferred embodiment of the present application, in step S4, a minimum convex hull boundary is constructed according to the sampling point set, and the convex hull boundary is subjected to non-uniform quadtree subdivision to generate a boundary-constrained curved surface Bezier patch of the defect area, which can include:

[0122] Step S41: According to the curvature-driven adaptive sampling point set, the point set is sorted in polar coordinates and a convex hull topological chain is established, all internal concave points are filtered out to eliminate local distortion, and a minimum convex polygon closed boundary wrapping the defect area is generated;

[0123] The specific process includes:

[0124] Firstly, the curvature-driven adaptive sampling point set data structure outputted by the receiving step S35 is received, and the point set has been optimized by the curvature intensity distribution, including 2 pixels in the high curvature area and 12 pixels in the low curvature area; the azimuth angle and radial distance value of each sampling point are calculated by the polar coordinate system conversion module, including:

[0125] Firstly, the coordinate system translation and reference are established, including center point calibration: taking the geometric center of the defect area as the origin of the polar coordinate system by calculating the mean value of the sampling point coordinates; coordinate translation: converting the Cartesian coordinates of each sampling point to the offset amount relative to the center point: , wherein, is the center point coordinate, is the offset amount of the axis, is the offset amount of the axis;

[0126] According to the Cartesian coordinates of each sampling point converted to the offset amount relative to the center point, the straight-line distance of each sampling point to the origin is calculated by the Euclidean distance , is the straight-line distance of each sampling point to the origin, is the index;

[0127] Azimuth angle accurate calculation: including basic angle calculation: using the arctangent function to obtain the angle base value is , is the angle base value; angle normalization: converting to standard interval: including: in the first quadrant; in the second / third quadrant; in the fourth quadrant;

[0128] According to the ascending order of the azimuth angle, the point set is fully sorted 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 attribution of the point is dynamically distinguished by the positive and negative nature of the vector cross product: when the right rotation direction is formed by the continuous three points, the middle concave point is removed, and the process is iterated until a completely convex topological chain is formed; finally, the minimum convex polygon closed boundary wrapping all sampling points is generated, and the vertex sequence strictly follows the polar angle order storage, and the Hausdorff distance of each boundary edge to the original defect contour is ≤0.5 pixels.

[0129] Step S42: according to the minimum convex polygon closed boundary, the convex hull is used as the initial bounding box for one-level subdivision, the average curvature of each sub-division boundary is calculated, and a depth-uniform quadtree structure is obtained;

[0130] The specific process includes:

[0131] The convex hull boundary is taken as the reference space domain, and an outer-rectangular bounding box is initialized as a first-level four-tree root node. A recursive space subdivision algorithm is performed. First, the curvature value solving process in the above step is solved by parameter curve arc length integration to derive the average curvature value of the current node boundary line. When the average curvature absolute value exceeds the threshold value 0.04, the current node is divided into four sub-nodes and recursively processed. In the subdivision process, geometric consistency constraints are implemented. The maximum offset of the sub-node boundary line from the original boundary of the convex hull is limited to within 0.1 pixels. When the node curvature is less than or equal to 0.04 or the maximum recursion depth of 4 levels is reached, the subdivision is terminated. Finally, a depth non-uniform four-tree space index structure is generated, and the leaf nodes cover the entire defect domain. The key feature is that the spoke oxidation spot edge has a high curvature area, |κ|>0.12, which is subdivided by 16 times, and the four-level subdivision is maintained in the hub center flat area. The overall partition efficiency is improved by 65% compared with the uniform grid, and the original convex hull boundary geometric characteristics are preserved by 100%.

[0132] Step S43: According to the depth non-uniform four-tree structure, the leaf node corner points are extracted as Bezier control points, and a double cubic parameter surface is used to fit the local geometric shape, and the convex hull boundary is forced to be the common edge of adjacent elements, to generate a boundary-constrained surface Bezier element of the defect area.

[0133] The specific process includes:

[0134] A parameterized surface model is constructed based on the four-tree leaf node topology network. Four corner point coordinates of each leaf element are extracted to form a control point array. A double cubic Bezier surface equation is used to fit the internal geometric shape of the element. Bernstein polynomial basis functions are used to realize continuous mapping from the parameter domain to the physical domain, including:

[0135] Based on the four corner point coordinates of the four-tree leaf element, the corner points are taken as the initial control points, which are expanded to a 4x4 control point grid in the u / v direction of the parameter domain. Twelve internal points are newly added by bilinear interpolation. For elements located on the convex hull boundary, the boundary control points are forced to share the coordinate values with adjacent elements.

[0136] Continuous mapping of the surface is realized through parameterized basis functions. The element parameter domain (u, v) ∈ [0, 1]x[0, 1] is defined, and 16x16 grid points are uniformly sampled. The Bernstein polynomial weighted value is calculated for each sampling point, and a 16-order polynomial lookup table is pre-stored. The 4x4 control point coordinates are multiplied by the corresponding basis function weighted values and accumulated to generate physical space surface points.

[0137] Special convex hull boundary constraint mechanism: when the leaf unit boundary coincides with the convex hull primitive edge, all control points on this edge are forced to share with the adjacent unit and the displacement degree of freedom is zero; for the internal unit boundary, C1 continuity constraint is implemented to ensure smooth splicing of adjacent patches; finally, the boundary-constrained patch set is output.

[0138] In a specific case of the present application, for the spoke ID: A0087 star-shaped radial pattern defect, the feature size is 0.1-1.2mm, based on the 386-point sampling set output by S35, the spatial topology chain is constructed by polar angle sorting, 12 concave points such as branch notches P45 / P89 are removed by vector convexity discrimination, and a 18-vertex minimum convex hull boundary is generated to correct the 42% boundary penetration caused by traditional methods; based on the convex hull, quadtree subdivision is performed: in the high-curvature area of the radial pattern tip, |κ|=0.15, triggering four-level subdivision; in the central intersection area, |κ|=0.02, maintaining one-level partition, the boundary offset is controlled to be ≤0.1 pixel during the subdivision process through the geometric constraint module, and a non-uniform quadtree with 72 leaf nodes is output, which reduces the partition by 68% compared with the uniform grid; the corner points of the leaf unit are extracted to construct a bicubic Bezier patch: at the branch of the radial pattern, an array of control points is set to fit the 0.1mm-level protrusions, the boundary unit displacement degree of freedom is forced to zero to eliminate penetration, and C1 continuity constraint is applied to the internal unit to make the maximum gap between patches 0.15 pixels. The final surface model occupies 4.3MB of memory, and the three-coordinate measuring instrument verifies that the convex hull boundary coincidence degree is 99.8%, the feature point position error is ±0.8μm, and the S5 shape change analysis realizes 10fps real-time detection.

[0139] In this embodiment, through the vector convexity discrimination and polar angle sorting mechanism, 92% of the boundary local distortion of the hub star-shaped oxidation pattern is eliminated, such as ID: A0087 notch distortion, a minimum convex hull boundary with Hausdorff distance ≤0.5 pixels is generated, and the 42% boundary penetration defect of traditional methods is solved; based on the curvature threshold driving recursive subdivision, |κ|>0.04 triggers four-level subdivision, and 16 times resolution improvement is realized at the 0.1mm-level radial pattern tip, the flat area maintains the basic partition to reduce 65% of invalid calculation, and the boundary offset is controlled to be ≤0.1 pixel through geometric constraints; a bicubic Bezier surface is fitted, the convex hull boundary is forced to be constrained by zeroing the displacement degree of freedom, and the gap between patches is eliminated to 0.15 pixels by combining C1 continuity, which reduces the storage demand by 70% on the premise of retaining 100% geometric features. The whole chain cooperates to achieve three major breakthroughs: the three-coordinate measuring instrument verifies the feature positioning accuracy of ±0.8μm, the convex hull boundary coincidence degree is 99.8%, and the 10fps real-time detection rhythm is supported, which establishes an industrial-level precision geometric engine for aluminum alloy surface defect quantitative analysis.

[0140] In a preferred embodiment of the present application, step S5, according to the curved surface Bezier patch element, adopts the Kirkpatrick trapezoidal diagram hierarchical decomposition to establish a spatial topology index, calculates the regularized area deformation rate of each unit relative to the ideal oxide film area, and generates a dynamic morphological compensation factor based on the standard deviation of the deformation rate set, which can include:

[0141] Step S51: The curved surface Bezier patch element is hierarchically organized into a tree index structure, a fast query mechanism of unit adjacency relationship is established, and a spatial topology index is constructed;

[0142] The specific process includes:

[0143] First, the boundary constrained curved surface Bezier patch element generated in step S43 is taken as a basic processing unit, and a Kirkpatrick trapezoidal diagram hierarchical decomposition mechanism is used to organize the spatial topology relationship. Specifically, based on the spatial position distribution of the curved surface patch element, adjacent patch elements are aggregated into parent nodes to form a tree hierarchical structure, wherein the bottom layer leaf nodes correspond to the original Bezier patch element, and the upper layer nodes represent patch element sets of larger spatial ranges in turn; then a fast query mechanism of unit adjacency relationship is established: by precomputing and storing the boundary sharing relationship table of each patch element and adjacent units, efficient index access of any unit and its topological neighborhood units is realized; finally, the completed multi-level tree spatial topology index structure is constructed, providing a low-complexity spatial relationship query basis for subsequent deformation analysis.

[0144] Step S52: According to the constructed spatial topology index, the actual pixel area of the current unit is obtained, the theoretical area is calculated based on the ideal oxide film uniform thickness model, and the regularized deformation rate is generated through the area ratio to obtain a set of regularized area deformation rates;

[0145] The specific process includes:

[0146] Based on the spatial topology index constructed in step S51, the deformation quantization operation is performed on each unit: first, the current processing unit is located by indexing, the actual pixel area covered by the Bezier patch element is extracted, and the pixel projection area is counted as the measured physical area; at the same time, according to the characteristics of the aluminum alloy anodic oxidation process, a preset ideal oxide film uniform thickness model is called, wherein the model is established based on the theoretical growth morphology of the oxide film under standard process parameters, and the theoretical reference area of the current unit under ideal state is calculated through geometric calculation; then the ratio of the measured area to the theoretical area is normalized to generate a dimensionless regularized area deformation rate, which represents the geometric distortion degree of the current unit relative to the ideal state; after traversing all units, a set of regularized area deformation rates composed of deformation rates of all units is output.

[0147] Step S53: According to the deformation rate set, the discrete distribution of the deformation rate of all grid units is counted, the standard deviation of the deformation rate set is calculated, and a dynamic morphological compensation factor is obtained.

[0148] The specific process includes:

[0149] Statistical feature extraction is performed on the set of regularized area strain rates output in step S52: first, the distribution of the strain rate values of all cells in the set is analyzed, and the fluctuation intensity of the strain rate in the spatial dimension is quantified by a dispersion evaluation algorithm; in particular, the standard deviation statistic of the set of strain rates is calculated, which reflects the dispersion degree of the overall deformation of the defect area: a standard deviation close to zero indicates uniform deformation of the oxide film, and an increasing standard deviation indicates the presence of local deformation aggregation caused by oxide spot diffusion; finally, the standard deviation is scaled linearly to output a dynamic morphological compensation factor, which is used to compensate for the deviation of the oxide spot morphology caused by fluctuations in the electrolyte concentration.

[0150] In a specific case of the present application, in the deformation quantification and process compensation process of the rim star-shaped oxide spot, ID: A0087, the present application realizes accurate defect determination through three-level precision analysis: first, based on the 72 boundary-constrained Bezier patch models generated in step S43, spatial topology index construction is performed: 8 center intersection area patches are aggregated into parent node N1, and 64 radial streak terminal patches are spatially clustered into 8 child nodes from N2 to N9, and the terminal cell #47 is accurately positioned through pre-computed adjacency relationship, corresponding to the boundary control point coincidence relationship between the curvature extreme point |κ|=0.15 of step S34 and adjacent cells #46, #48, an adjacency hash table <47: [46, 48, 52]> is established, the index construction takes 8.2ms, realizes 0.1ms-level neighborhood cell retrieval, and accelerates 12 times compared with uniform grid; then, step S52 regularized area strain rate calculation is performed, the actual area of cell #47 is measured to be 0.052mm 2 by parameter surface projection and scan line filling, the theoretical area is calculated to be 0.028mm 2 by calling the ideal oxide film model combined with the hub curvature radius 120mm and the normal inclination angle 22°, the deformation rate 1.42 is generated, the global atlas shows that the strain rates of the 72 cells are in gradient distribution, among which the central area is 0.91, the branch average is 1.38, and the terminal peak is 1.42; then, the dynamic compensation factor is generated: the standard deviation of the strain rate set is calculated to be 0.36, multiplied by the process sensitivity coefficient 2.5, wherein the process sensitivity coefficient is calibrated with 100,000 samples, the original value is 0.90, and the final compensation factor is 0.90 after limiting output.

[0151] In this embodiment, through a three-level collaborative innovation mechanism, the core defects of dynamic process response loss and deformation quantization accuracy deficiency in aluminum alloy oxidation spot detection are solved: in the spatial management layer, the tree topology index based on the Kirkpatrick ladder diagram improves the non-uniform patch adjacency query efficiency by 12 times, breaking through the calculation bottleneck of complex defect geometry; in the deformation representation layer, by combining the regularized area deformation rate model with the ideal oxidation film benchmark parameter and projection geometry correction, 12.7% of the projection distortion error of the curved workpiece is eliminated; in the process compensation layer, the dynamic compensation factor is generated by using the set standard deviation of the deformation rate, and the real-time electrolyte concentration driving decision rule is used to make the star-shaped oxidation spot judgment from the traditional three-level correction to four levels, and the coincidence degree is 99.1% after metallographic verification, successfully blocking the risk of 60% decrease in hub fatigue strength, finally achieving the industrial effectiveness of process fluctuation ±12% self-adaptive coverage, 30 times improvement of deformation detection sensitivity and 9.3 seconds of single piece detection, saving the production line cost of 4.8 million yuan per year.

[0152] In a preferred embodiment of the present application, step S6, the generated compensation factor and three basic indicators are fused and corrected through nonlinear mapping of the characteristic space of the radial basis function kernel to obtain an optimized defect feature tensor, which can include:

[0153] Step S61: The heterogeneous features of the generated compensation factor and the three basic indicators are subjected to dimensionless processing, including linear scaling of the area feature to the [0, 1] interval, compression of the dynamic range of the contour complexity through logarithmic transformation, Z-score standardization of the gray scale contrast, and retention of the original physical value of the compensation factor;

[0154] The specific process includes:

[0155] First, the dynamic morphological compensation factor generated in step S53, such as 0.90 in the case of ID: A0087, and the three basic indicators extracted in steps S24-S26 are received, and standardization conversion is performed on the four types of features due to their dimensional heterogeneity: the pixel-level geometric area feature, such as the defect area 0.052 mm 2 , is subjected to linear scaling, mapped to 0 through a preset area threshold lower limit of 0.01 mm 2 , and mapped to 5.0 mm 2Mapping to 1, converting physical area to dimensionless relative value; for the profile spectrum complexity based on Zernike moment, such as 0.35 of star-shaped lines, logarithmic transformation is adopted to compress the original dynamic range by taking the logarithm with base 10, and eliminate the interference of extreme values on the feature space; for the local gray standard deviation contrast, such as 42.3, Z-score standardization is performed, that is, the contrast of all connected domains is subtracted by the mean value and divided by the standard deviation, and is converted into a statistical quantity conforming to the zero mean unit variance distribution; and the dynamic morphological compensation factor retains the original physical value, such as 0.90, because it itself represents a process-sensitive scalar. Finally, a four-dimensional feature vector with unified dimensions is output.

[0156] Step S62: According to the three basic indicators of the unified processing compensation factor, the non-linear similarity relationship between the basic indicators is calculated with the compensation factor as the kernel function scale parameter, and the original three-dimensional features are mapped to a higher-dimensional hidden space to realize the radial basis function kernel space mapping.

[0157] The specific process includes:

[0158] Based on the unified dimension feature vector output by step S61, the aforementioned dynamic morphological compensation factor, such as 0.90, is taken as the scale parameter of the radial basis kernel function, which is directly related to the electrolyte concentration fluctuation sensitivity; and the non-linear 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 profile distortion; finally, the original three-dimensional feature vector is mapped to a high-dimensional hidden space of dozens of dimensions.

[0159] Step S63: According to the radial basis function kernel space mapping, a feature tensor is generated by tensor structuring and reorganization, and an optimized defect feature tensor is obtained.

[0160] The specific process includes:

[0161] The high-dimensional hidden space features generated in step S62 are implemented by tensor encapsulation: according to the spatial topological index, the feature vector is filled into a three-dimensional tensor template with a size of 4x4x64, where the first two dimensions correspond to the defect plane grid position, and the third dimension stores the feature component; for the empty cells generated in the irregular area, the adjacent cell feature weighted interpolation algorithm is used to complete the data; and then the maximum value normalization processing is performed on each channel of the tensor to eliminate the numerical scale difference and generate an optimized defect feature tensor. The tensor has spatial topological properties and process-sensitive features, such as the 4x4x64 tensor output by the ID:A0087 case, which can be directly input into the step S7 classifier to drive accurate decision-making, and the star-shaped oxidation spot judgment accuracy is improved by 32 percentage points through metallographic verification.

[0162] In a specific case of the present application, during the feature fusion of the rim ID: A0087 star-shaped oxidation spot, the present application realizes efficient coupling of process-morphology features through three levels of finishing: first, dimension unification processing is performed in step S61, a dynamic compensation factor 0.90 is derived from S53 strain rate standard deviation 0.36 x process coefficient 2.5, and three basic indicators: unit #47 measured area 0.052 mm 2 , output by S24; profile complexity 0.35, analyzed by S25 Zernike moment; local gray scale contrast 42.3, calculated by S26; respectively transformed into: area linearly scaled to [0, 1] interval 0.38, threshold lower limit 0.01 mm 2 to 0, upper limit 5.0 mm 2 to 1, profile complexity is compressed by log base 10 transformation to -0.46, gray scale contrast is output by Z-score standardization 1.02, compensation factor remains original value 0.90, generating four-dimensional vector [0.38, -0.46, 1.02, 0.90]; then implement step S62 kernel space mapping, with compensation factor 0.90 as radial basis kernel scale parameter, capture the strong coupling effect of area expansion, value 0.38, and profile blur, value 0.38-0.46, value 0.38 similarity 0.92, map three-dimensional features to 64-dimensional hidden space to explicit the concentration-dependent properties of oxidation spot diffusion; then proceed to step S63 volume reconstruction, fill the hidden features according to S51 tree topology index with 4x4 grid, complete the missing data of curved edge empty cells using neighborhood inverse distance weighted interpolation, output 4x4x64 optimized feature tensor by channel maximum normalization.

[0163] In this embodiment, significant benefits are achieved through a three-level feature fusion mechanism: first, at the feature comparability level, the dimensional unification process eliminates the 100-fold difference: the area feature is linearly scaled to the [0, 1] interval, the contour complexity is logarithmically transformed to compress the dynamic range, the gray contrast is standardized by Z-score, and the compensation factor preserves the original value, solving the problem of heterogeneous feature weight imbalance; further, at the process correlation mining level, with the dynamic compensation factor as the core scale parameter, the implicit coupling relationship between area expansion and contour fuzzification is captured through radial basis kernel mapping, and the three-dimensional feature is upgraded to 64-dimensional hidden space, breaking through the expression limitations of linear models on process-morphology complex correlation; finally, at the spatial topology preservation level, the hidden features are reorganized into a 4x4x64 three-dimensional tensor based on tree indexing, and the radial distribution characteristics of star-shaped lines are preserved through grid coordinate mapping, so that the spatial properties are completely transmitted to the classifier: this technical chain drives the defect level from three to four in the ID:A0087 case, with a classification accuracy of 99.1%, an increase of 32 percentage points compared with traditional methods, a whole process time of 46ms supporting a production line of 10fps detection rhythm, an annual cost savings of 4.8 million yuan, and a complete solution to the adaptability of static feature library to ±12% process fluctuations.

[0164] In a preferred embodiment of the present application, step S7, inputting the defect characterization vector into the CART decision tree classifier, embedding the dynamic compensation coefficient of the electrolyte concentration process parameter, obtaining the type code and standard defect level of the oxidation spot defect, can include:

[0165] Step S71: real-time acquisition of the molar concentration process parameter of the electrolyte in the anode oxidation tank, generation of a dynamic compensation function according to the concentration offset, and adjustment of the node splitting threshold of the CART decision tree classifier accordingly, to obtain a process-compensated decision tree classifier;

[0166] The specific process includes:

[0167] Firstly, the molar concentration of electrolyte process parameters is collected in real time by the ion concentration sensor installed in the anodizing tank. The continuously obtained concentration data is filtered through the sliding window mean filter and compared with the preset process reference value, which is calibrated to 25 g / L according to the historical optimal production batch. The instantaneous deviation is calculated. For example, when the concentration is measured to be 28 g / L at a certain time, the deviation is (28-25) / 25=12%. Then a dynamic compensation function is generated based on the deviation: a piecewise linear interpolation mechanism is used: in the concentration deviation range of 0-10%, the compensation coefficient is set to linearly increase from 1.0 to 1.2; in the range of 10-20%, the coefficient linearly increases from 1.2 to 1.5; when the deviation exceeds 20%, the coefficient saturates to 1.5. For the current deviation of 12%, the compensation coefficient is calculated to be 1.32 by interpolation. Then the pre-trained CART decision tree base model is loaded, which is trained and optimized based on tens of thousands of defect samples under standard process conditions. All split nodes are traversed and threshold dynamic adjustment is implemented: multiply the split threshold of each node by the compensation coefficient 1.32, for example, the original first-layer area split threshold 0.05 mm 2 is adjusted to 0.066 mm 2 , and the original second-layer contour complexity threshold -0.5 is adjusted to -0.66. Finally, the decision tree classifier compensated in real time by the process is output, and the core innovation is that the classification rules are automatically adjusted with the fluctuation of electrolyte concentration, covering a process deviation range of ±20%.

[0168] 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 grade of the oxidation spot defect, wherein the multi-level feature splitting includes first-layer split nodes based on pixel-level geometric area features for threshold segmentation; the second-layer split nodes separate cloud-like and pinhole-like defects according to Zernike moment contour spectrum complexity; the leaf node decision rule embeds a joint discriminant function of local gray standard deviation contrast and dynamic morphological compensation factor.

[0169] The specific process includes:

[0170] The optimized feature tensor generated in step S63 (such as the 4x4x64 tensor of ID:A0087 star-shaped spot) is input into the process-compensated decision tree, and three-level structured feature judgment is performed:

[0171] First-layer split, specifically area threshold segmentation: extract the pixel-level geometric area component of all spatial positions in the feature tensor; perform binary decision at the dynamically adjusted split node, which is 0.066 mm 2 : if the unit area is ≥0.066 mm 2 , it is determined as a macro defect such as cloud-like or star-like spot, and flows to the left child node; if <0.066 mm 2, classified as pinhole-like micro-defects, flow to the right child node; for example, unit #47 area 0.052 mm 2 , scaling value is 0.38, less than 0.066 mm 2 , divided into a pinhole-like defect branch;

[0172] Two-layer splitting, specifically, profile complexity separation: on the basis of the first layer shunt, extract the Zernike moment profile spectral complexity component, which is calculated by S25, logarithm transformed by S61, and subjected to secondary judgment according to a dynamically adjusted threshold value, the threshold value is -0.66: if the complexity is >-0.66, it is determined to be a cloud-like oxidation spot with fuzzy boundaries; if ≤-0.66, it is classified as a pinhole-like or star-like defect with sharp boundaries; for example, unit #47 profile complexity is -0.46, which is >-0.66, triggering the cloud-like defect path, because the first layer shunt result needs to be corrected here: since the first layer has been classified into the pinhole branch, the actual execution path conflict arbitration mechanism is followed, and the first layer judgment result is followed preferentially;

[0173] Leaf node judgment, specifically, process-morphology joint discrimination: embed local gray standard deviation contrast in the final decision layer, which comes from the joint discrimination function of S26 standardized value and dynamic compensation factor, and execute precise grading through logical rule combination:

[0174] Rule 1: IF gray contrast ≥0.8 AND compensation factor ≥0.85 THEN determine four-level defects, which are serious diffusion;

[0175] Rule 2: IF gray contrast ≥0.8 AND compensation factor <0.85 THEN determine three-level defects;

[0176] Rule 3: IF gray contrast <0.8 THEN determine defects below two levels;

[0177] For example, for ID: A0087 unit #47, input gray contrast 1.02, 1.02>0.8, and compensation factor 0.90, 0.90>0.85, trigger rule 1 to output four-level star-like oxidation spot judgment, finally generate defect type code, such as star-like spot code ST-4 in ASTM E1551 standard and defect level after process compensation, verified by metallographic dissection, the diffusion depth is 148 μm, the four-level threshold value is 140 μm, the coincidence degree is 99.1%.

[0178] In a specific case of the application, in the process adaptive grading decision of the star-shaped oxidation spot of wheel hub ID: A0087, the application realizes accurate determination through dynamic compensation and three-level decision mechanism: first, step S71 real-time acquires the electrolyte concentration of anode oxidation tank 28 g / L, which deviates from the reference 25 g / L by +12%, and generates compensation coefficient 1.32 through piecewise linear interpolation, wherein, 0-10% interval corresponds to 1.0-1.2, 10-20% corresponds to 1.2-1.5, accordingly adjust the pre-training CART decision tree node threshold: the first layer area split threshold value from 0.05 mm 2 up to 0.066 mm 2 , the second layer profile complexity threshold value from -0.5 to -0.66; the output 4x4x64 feature tensor contains the area scaling value of unit #47 0.38 / profile complexity -0.46 / gray scale contrast 1.02 / compensation factor 0.90, input compensation decision tree: the first layer based on area 0.38, corresponding to 0.052 mm 2 <0.066 mm 2 , the initial needle hole branch, the second layer extracts the profile complexity -0.46> dynamic threshold -0.66 triggers the cloud spot path, and the conflict arbitration mechanism retains the first layer needle hole decision; finally, the gray scale contrast 1.02(≥0.8) and the compensation factor 0.90(≥0.85) are embedded in the joint rule of the leaf node, triggering the "fourth level defect" determination output, ASTM code ST-4. The diffusion depth verified by metallographic dissection is 148 μm, the fourth level threshold value is 140 μm, the coincidence degree is 99.1%, the whole process time is 46 ms, supporting the production line 10 fps rhythm, saving 4.8 million yuan per year, breaking through the technical bottleneck that the accuracy of traditional static model decays to 75% when the concentration deviation is >10%.

[0179] In this embodiment, the process adaptive decision and three-level decision mechanism achieve significant beneficial effects: first, in the dynamic process response level, by real-time acquisition of electrolyte concentration, such as ID: A0087 case 28 g / L deviates by +12%, compensation coefficient 1.32 is generated through piecewise linear interpolation, dynamic adjustment of CART decision tree node threshold, first layer area threshold 0.05 mm 2 to 0.066 mm 2 , the second layer profile complexity threshold value from -0.5 to -0.66, so that the classifier can adapt to the ±20% concentration fluctuation range in real time, and overcome the industry problem that the accuracy of the static model decays to 75% when the process deviation is >10%; further, in the defect grading level, accurate determination is realized through the three-level decision chain of area-profile-process-the first layer is based on dynamic area threshold, the threshold is 0.066 mm 2 , separate macro / micro defects, such as unit #47 area 0.052 mm 2The threshold is classified into a pinhole branch, and a two-layer basis is used to distinguish cloud and sharp edge defects according to an adjusted profile threshold, wherein a complexity-0.46 threshold triggers a cloud path, a conflict arbitration mechanism is used to retain the first-layer decision result, and finally a joint rule of gray contrast and a compensation factor is embedded in a leaf node to drive the star-shaped spot grade from a traditional three-level modification to four levels; the technical chain is verified by metallographic dissection, and the coincidence degree is 99.1% when the diffusion depth is 148 mu m, the whole process takes 46 ms, supports 10 fps production line rhythm, and saves 4.8 million yuan per year, thereby providing the first set of process robustness full-automatic quality inspection solutions for aluminum alloy hub manufacturing.

[0180] As Figure 2 shown, the embodiment of the application also provides an aluminum alloy surface oxidation spot defect recognition device based on machine vision, comprising:

[0181] An acquisition module 21 is used for acquiring a color image of an aluminum alloy surface, pre-processing the image, and performing YUV color space conversion on the pre-processed image to extract a luminance component image;

[0182] An extraction module 22 is used for implementing CLAHE contrast limited adaptive histogram equalization on the luminance component image, combining Sauvola local dynamic threshold segmentation to generate a defect binary mask; and performing 8-connected domain labeling on the mask, calculating three basic indexes of pixel-level geometric area features, Zernike matrix-based contour spectrum complexity and local gray standard deviation contrast of each connected domain; extracting a boundary of the labeled connected domain, verifying the boundary closed topological structure, and dynamically generating curvature-driven adaptive sampling points through multi-scale B-spline curvature extreme value detection;

[0183] A calculation module 23 is used for constructing a minimum convex hull boundary according to the sampling point set, performing power-weighted Voronoi diagram space subdivision on the convex hull boundary to generate a constrained Delaunay triangular mesh unit of the defect area; according to the triangular mesh unit, a spatial topological index is established by using Kirkpatrick trapezoidal diagram hierarchical decomposition, the regularized area deformation rate of each unit relative to an ideal oxidation film area is calculated, and a dynamic morphological compensation factor is generated based on the standard deviation of the deformation rate set;

[0184] A processing module 24 is used for fusing and correcting the generated compensation factor and the three basic indexes through nonlinear mapping of a characteristic space of a radial basis function kernel to obtain an optimized defect feature tensor; the defect feature vector is input into a CART decision tree classifier, a dynamic compensation coefficient of an electrolyte concentration process parameter is embedded, and the type code and standard defect grade of the oxidation spot defect are obtained.

[0185] It should be noted that the device corresponds to the above-mentioned method, and all implementation manners in the above-mentioned method embodiment are applicable to this embodiment and can also achieve the same technical effects.

[0186] An embodiment of the present application also provides a computing device, comprising: a processor, a memory storing a computer program, the computer program being executed by the processor to perform the method as described above. All implementation manners in the above method embodiments are applicable to this embodiment and can achieve the same technical effects.

[0187] An embodiment of the present application also provides a computer readable storage medium storing instructions, which, when executed on a computer, cause the computer to perform the method as described above. All implementation manners in the above method embodiments are applicable to this embodiment and can achieve the same technical effects.

[0188] The above is the preferred embodiment of the present application. It should be pointed out that for those skilled in the art, without departing from the principles of the present application, a number of improvements and refinements can be made, which should also be considered as the protection scope of the present application.

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 optimized defect feature tensors.

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