Aluminum alloy die casting defect detection method and system based on machine vision
By employing optical crosstalk decoupling and adaptive threshold correction, the problems of optical response coupling and mechanical delay in the inspection of aluminum alloy die castings were solved, enabling accurate defect classification and closed-loop control.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- ZHEJIANG XINYIJIA METAL PROD CO LTD
- Filing Date
- 2026-05-15
- Publication Date
- 2026-06-30
AI Technical Summary
In the production of aluminum alloy die castings, existing detection methods are difficult to effectively decouple the optical response of surface micro-morphology and deep defects, leading to missed detections and false alarms. Furthermore, they do not consider optical substrate drift and mechanical transmission delay, which affects the effectiveness of closed-loop control.
Optical crosstalk decoupling is achieved by using light sources of different wavelengths and matching narrowband filters. Adaptive threshold correction is performed by combining grayscale noise variance and normalized potential coefficient. Defect level is calculated through multi-view image set and a transmission timing compensation mechanism is introduced.
It improves the ability to capture subtle anomalies at the edges of adjacent defect areas, enables accurate classification of porosity groups and cold shut cracks, and solves the feedback misalignment problem caused by mechanical delay, thus realizing closed-loop control of the die-casting production line.
Smart Images

Figure CN122306838A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of data processing technology, and specifically to a method and system for detecting defects in aluminum alloy die castings based on machine vision. Background Technology
[0002] In the production and visual quality inspection of aluminum alloy die castings, due to the uneven volatilization of release agent, localized oxide patches, and the reflective properties of the metal matrix on the casting surface, imaging systems using single-band light sources or multi-angle mixed illumination will generate cross-spectral diffuse reflection crosstalk during synchronous acquisition. This causes shallow texture noise characterizing the surface micromorphology to couple with deep cold shut fracture characteristics reflecting structural strength, making it difficult to obtain independent feature parameters.
[0003] Meanwhile, existing defect extraction algorithms are mostly limited by fixed static grayscale thresholds or global scaling, failing to fully consider the spatial topological continuous attenuation law of optical substrate drift caused by local mold temperature imbalances or mold release agent accumulation. This threshold mechanism leads to decreased sensitivity of the detection system in weak anomaly areas near the defect core, resulting in missed detections, and false alarms in normal local reflective fluctuation areas. Furthermore, existing evaluation methods rely on the statistical analysis of the geometric area of two-dimensional connected domains, lacking a mechanism to distinguish defect morphology from the perspective of spatial light scattering anisotropy. This makes it difficult to accurately distinguish between equiaxed pore groups and directional deep-valley-shaped cold-sealed cracks, easily leading to deviations in subsequent process correction schemes. Finally, some closed-loop feedback links do not include the mechanical transmission delay between die casting mold exit and the inspection station in the calculation, lacking a timing phase compensation mechanism for production line cycle time. This means that the generated compensation command may be applied to a mold that has already completed the injection action. This timing mismatch affects the effectiveness of closed-loop control and causes fluctuations in process parameters. Summary of the Invention
[0004] To address the technical problems existing in the background art described above, the present invention provides a method and system for defect detection of aluminum alloy die castings based on machine vision.
[0005] A machine vision-based defect detection method for aluminum alloy die castings includes: acquiring a first time-series image set of the target area of the die casting at a first wavelength, and a multi-view image set at a second wavelength within the same acquisition period; calculating a stability parameter based on the mean gray-level fluctuation of the first time-series image set and the gray-level noise variance of pixels in the non-test area, and calculating a contrast parameter based on the gray-level extreme value difference of the multi-view image set; comparing the stability parameter and the contrast parameter with corresponding static thresholds to screen first suspicious pixels; and selecting first suspicious pixels from those not exceeding the threshold. A topological potential field is constructed by evaluating the inverse square ratio of the spatial distance of the evaluation pixels, and the normalized potential energy coefficient of the pixel to be evaluated is calculated. The static threshold is adaptively corrected using the normalized potential energy coefficient, and the pixel to be evaluated is screened again using the corrected threshold to obtain the second suspicious pixel. Connectivity analysis is performed on the first and second suspicious pixels to calculate the geometric area ratio of the target connected region, and the anisotropic variance of the target connected region under the multi-view image set is calculated. The defect level is determined by combining the geometric area ratio and the anisotropic variance, and a control command with transmission timing compensation is output.
[0006] Optionally, acquiring a first time-series image set of the target area of the die-casting part at a first wavelength and a multi-view image set at a second wavelength within the same acquisition period includes: acquiring the optical response of the first wavelength through a first detection channel to form a first time-series image set, and acquiring the optical response of the second wavelength through multiple tilted second detection channels to form a multi-view image set; the receiving front end of the first detection channel and the second detection channel are respectively provided with a filter component matched with the corresponding acquisition wavelength to block cross-band reflected optical crosstalk.
[0007] Optionally, calculating the stability parameter includes: extracting the square of the gray-level difference between adjacent image frames in the first time-series image set; extracting the gray-level variance of edge pixels in the non-test area within the first time-series image set as the gray-level noise variance; and performing logarithmic calculation on the sum of the arithmetic mean of the squares of the gray-level differences and the gray-level noise variance to generate the stability parameter.
[0008] Optionally, calculating the normalized potential energy coefficient of the pixel to be evaluated includes: calculating the square of the spatial distance from the pixel to be evaluated to each first suspicious pixel, taking the reciprocal and summing them to generate the single-point potential energy value of the pixel to be evaluated; obtaining the maximum value of the single-point potential energy value of each pixel in the global non-suspicious region, and using the ratio of the single-point potential energy value of the pixel to be evaluated to the maximum value as the normalized potential energy coefficient.
[0009] Optionally, adaptively correcting the static threshold using the normalized potential energy coefficient includes: multiplying the static upper limit threshold used to evaluate the stability parameter by a first coefficient to obtain the corrected upper limit threshold, where the first coefficient is the difference between the value one and the normalized potential energy coefficient; and multiplying the static lower limit threshold used to evaluate the contrast parameter by a second coefficient to obtain the corrected lower limit threshold, where the second coefficient is the sum of the value one and the normalized potential energy coefficient.
[0010] Optionally, calculating the anisotropic variance of the target connected component in a multi-view image set includes: obtaining the single-channel average gray level of the target connected component in different view subsets of the multi-view image set; calculating the discrete mean square error of each single-channel average gray level relative to the overall arithmetic mean gray level, and generating anisotropic variance to characterize the symmetry of the target's three-dimensional morphology.
[0011] Optionally, determining the defect level by combining the geometric area ratio and anisotropy variance includes: when the anisotropy variance is not greater than a preset dispersion threshold, the target defect is determined to be an equiaxed pore type, and the aggregation level is classified according to the geometric area ratio; when the anisotropy variance is greater than a preset dispersion threshold, the target defect is determined to be a crack type with a directional deep valley structure.
[0012] Optionally, the output control command with transmission timing compensation includes: calculating the production mold deviation based on the physical transmission time between the die casting mold exit station and the image acquisition station, and using the production mold deviation as a timing compensation parameter; and sending the process adjustment command generated for the defect level with the timing compensation parameter to the control terminal to act on the corresponding subsequent target mold.
[0013] A machine vision-based defect detection system for aluminum alloy die castings is also provided, comprising: an image acquisition module for acquiring a first time-series image set of the target area of the die casting at a first wavelength, and a multi-view image set at a second wavelength within the same acquisition period; a feature calculation module for calculating stability parameters based on the mean gray-level fluctuation of the first time-series image set and the gray-level noise variance of pixels in the non-test area, and calculating contrast parameters based on the gray-level extreme value difference of the multi-view image set; an initial screening module for comparing the stability parameters and contrast parameters with corresponding static thresholds to screen first suspicious pixels; a boundary evolution module for constructing a topological potential field based on the inverse square ratio of the spatial distance from each first suspicious pixel to the unbounded pixels to be evaluated, calculating the normalized potential energy coefficient of the pixels to be evaluated, and using the normalized potential energy coefficient to adaptively correct the static threshold to obtain second suspicious pixels; and a closed-loop control module for determining the defect level by jointly using the geometric area ratio of the connected domains and the anisotropic variance, and outputting control commands with transmission timing compensation.
[0014] Optionally, the image acquisition module is further configured to: acquire the optical response of a first wavelength through a first detection channel to form a first time-series image set, and acquire the optical response of a second wavelength through multiple tilted second detection channels to form a multi-view image set; the receiving front ends of the first detection channel and the second detection channel are respectively provided with filter components that match the corresponding acquisition wavelength to block cross-band reflected optical crosstalk.
[0015] The beneficial effects of this invention are reflected in:
[0016] In the entire machine vision-based defect detection method for aluminum alloy die castings, firstly, by utilizing the physical isolation configuration of different wavelengths and matching narrowband filters, cross-band diffuse reflection crosstalk caused by metal reflection is blocked, decoupling the optical responses of shallow textures and deep defects, and providing a data source for subsequent feature calculations. Furthermore, the gray-level noise variance of the non-test area is introduced for dynamic compensation calculation, reducing the environmental adaptability impact of the fixed bias constant and quantifying the temporal stability and spatial contrast parameters of pixels. Finally, the initially screened anomalous pixels are used as radiation sources to establish a spatial topological potential field, which is then analyzed using an inverse square law. The normalized potential energy coefficient is calculated using a local dynamic correction of the static threshold. This logic adapts to the spatial distribution of optical substrate drift, suppressing background false alarms while improving the ability to capture weak anomalies at the edges of adjacent defect regions. Furthermore, by combining the area ratio of connected regions with the optical anisotropy variance characterizing spatial symmetry, the classification of porosity groups and cold shut cracks is achieved. Based on this, a physical transmission timing conversion mechanism is introduced, enabling the generated process adjustment commands to be applied to the subsequent target modules of the die-casting machine. This solves the feedback misalignment problem caused by not considering mechanical delay and realizes closed-loop control of the die-casting production line. Attached Figure Description
[0017] To more clearly illustrate the specific embodiments of the present invention or the technical solutions in the prior art, the accompanying drawings used in the description of the specific embodiments or the prior art will be briefly introduced below. In all the drawings, similar elements or parts are generally identified by similar reference numerals. In the drawings, the elements or parts are not necessarily drawn to scale.
[0018] Figure 1 This is a schematic diagram illustrating the steps of the machine vision-based defect detection method for aluminum alloy die castings according to the present invention.
[0019] Figure 2 This is a schematic diagram of a portion of step S1 in the machine vision-based defect detection method for aluminum alloy die castings of the present invention.
[0020] Figure 3 This is a schematic diagram of a portion of step S2 in the machine vision-based defect detection method for aluminum alloy die castings of the present invention.
[0021] Figure 4 This is a schematic diagram of a portion of step S4 in the machine vision-based defect detection method for aluminum alloy die castings of the present invention.
[0022] Figure 5 This is a schematic diagram of part S5 in the machine vision-based defect detection method for aluminum alloy die castings of the present invention. Detailed Implementation
[0023] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. The components of the embodiments of the present invention described and shown in the accompanying drawings can generally be arranged and designed in various different configurations.
[0024] Therefore, the following detailed description of the embodiments of the invention provided in the accompanying drawings is not intended to limit the scope of the claimed invention, but merely to illustrate selected embodiments of the invention. All other embodiments obtained by those skilled in the art based on the embodiments of the invention without inventive effort are within the scope of protection of the invention.
[0025] It should be noted that similar reference numerals and letters in the following figures indicate similar items; therefore, once an item is defined in one figure, it does not need to be further defined and explained in subsequent figures. Furthermore, the terms first, second, etc., are used only to distinguish descriptions and should not be construed as indicating or implying relative importance.
[0026] This invention provides a machine vision-based method for defect detection in aluminum alloy die-castings, such as... Figure 1 As shown, in one embodiment, the method includes:
[0027] S1. Acquire the first time-series image set of the target area of the die casting at the first wavelength, and the multi-view image set at the second wavelength within the same acquisition period;
[0028] S2. Calculate the stability parameters based on the mean gray level fluctuation of the first time-series image set and the gray level noise variance of the non-test area pixels, and calculate the contrast parameters based on the gray level extreme value difference of the multi-view image set.
[0029] S3. Compare the stability parameter and contrast parameter with the corresponding static thresholds respectively to screen the first suspicious pixel;
[0030] S4. Construct a topological potential field based on the inverse square ratio of the spatial distance from each first suspicious pixel to the unexceeded pixel to be evaluated, calculate the normalized potential energy coefficient of the pixel to be evaluated, and use the normalized potential energy coefficient to adaptively correct the static threshold. Use the corrected threshold to screen the pixels to be evaluated again to obtain the second suspicious pixel.
[0031] S5. Perform connected component analysis on the first and second suspicious pixels to calculate the geometric area ratio of the target connected component, and calculate the anisotropic variance of the target connected component under the multi-view image set; determine the defect level by combining the geometric area ratio and the anisotropic variance, and output control commands with transmission timing compensation.
[0032] In this embodiment, it should be noted that in S1, to address the cross-spectral diffuse reflection crosstalk problem caused by the high reflectivity of the die-cast parts, a multi-spectral cross-modal decoupling architecture was constructed at the physical acquisition end. Specifically, the detection channel vertically deployed above the inspection station is equipped with a 460nm blue light source, while the three inclined detection channels arranged at a 45-degree angle around it are uniformly equipped with an 850nm near-infrared light source. Furthermore, narrowband filters strictly matching the wavelength of the corresponding light source are installed at the receiving front end of each channel's camera. When the aluminum alloy casing enters the field of view, all channels are synchronously triggered to perform stroboscopic exposure at a fixed acquisition cycle of 120 milliseconds, continuously accumulating image data for 20 cycles. The total number of fixed acquisition cycles and continuous accumulation cycles is determined by combining the production line transmission speed and camera shutter characteristics. By statistically analyzing the radius of the circle of confusion and the grayscale signal-to-noise ratio of the image edges under different frequency intervals, the optimal sampling interval that balances temporal characteristic stability and real-time detection is selected. For example, in a die-casting production line with a transmission speed of 0.5 m / s, tests showed that when the acquisition cycle was set to 120 ms, the dynamic displacement of the pixel during the exposure process was less than 0.5 pixel spacing, which could effectively eliminate motion blur. At the same time, by comparing the mean convergence curves of 5 to 50 cycles, it was found that when the cumulative cycle reached 20 times, the standard deviation of the background grayscale fluctuation tended to stabilize (the rate of change was less than 1%), thus minimizing the delay of a single judgment while ensuring detection accuracy.
[0033] Furthermore, the design logic of this architecture lies in using physical isolation to cut off the disordered reflection of light of different wavelengths on the metal surface. This allows short-wavelength blue light to focus on detecting the shallow micro-textures on the die-cast surface caused by residual mold release agent, while long-wavelength near-infrared light is responsible for penetrating the thin oxide layer on the surface to obtain optical refraction feedback of the deep structure. Through this hardware-level technique, multi-view feature maps that do not interfere with each other are acquired simultaneously, decoupling the optical response of shallow noise and deep defects. This provides a high signal-to-noise ratio original frame sequence to support the subsequent extraction of pure numerical parameters in the temporal and spatial domains, avoiding the interference of defect features being masked by highlights under existing mixed light sources.
[0034] In S2, the temporal and multi-view feature parameters of each pixel are calculated using the previously acquired clean frame sequence. Taking a pixel suspected to be a pore on the shell surface as an example, the gray value of this pixel fluctuates frequently between 145 and 160 due to the dynamic scattering of blue light by the micro-morphology of the metal surface during 20 consecutive acquisition cycles. To objectively quantify this fluctuation, the existing practice of setting a fixed bias constant was changed. Instead, the gray value variance was extracted in real time from the dark non-test area at the edge of the image set as the physical noise floor, and the measured noise floor variance was 0.16. Subsequently, the square of the gray value difference between adjacent frames of this pixel was calculated and the arithmetic mean was obtained, resulting in a value of 4.5 reflecting the fluctuation energy. This value was added to the noise floor variance and then logarithmically smoothed, finally calculating the stability parameter of this pixel as 1.539. Meanwhile, to extract contrast parameters reflecting spatial structural features, the grayscale extremes of the vertical channel and three tilted channels within the same period were scanned. The maximum grayscale range under multiple views was measured to be between 30 and 35. After averaging over multiple periods, the contrast parameter of this pixel was found to be 32. This technique, combining real-time noise floor with spatiotemporal multidimensional data, can quantify minute fluctuations and directional scattering characteristics at the pixel level, enhancing the algorithm's adaptability to ambient light drift and hardware electronic noise.
[0035] In S3, the obtained feature parameters are used to perform an initial static boundary assessment, aiming to quickly screen out defect core areas with high confidence from massive image point clouds. During the initialization phase, a stability static upper limit threshold for measuring temporal fluctuations is configured, set to 1.5, and a contrast static lower limit threshold for measuring spatial scattering contrast is configured, set to 25. The stability static upper limit threshold and the contrast static lower limit threshold are determined through probability distribution analysis of a preset sample set. Specifically, feature data from 100 qualified products and 50 typical defective products are collected, and the normal distribution intervals of the two types of samples in the stability and contrast feature spaces are calculated. The overlap point where the false alarm rate and the false negative rate are balanced is selected as the judgment boundary. Taking stability parameters as an example, the average grayscale fluctuation of qualified samples was 0.9 and the standard deviation was 0.15. Based on the 3-sigma principle, the boundary was initially defined and then fine-tuned in combination with the ambient light drift margin in the production site. Finally, the upper limit threshold was determined to be 1.5. The contrast threshold was taken as the lower quartile of the defective parts distribution and a 15% noise redundancy was reserved. Finally, it was set to 25.
[0036] For the specific pixel extracted above, since its calculated stability parameter of 1.539 exceeds the upper limit threshold of 1.5, it meets the condition for exceeding the limit and is directly marked as the first suspicious pixel according to logic, serving as a reference point for subsequent spatial topology calculations. At this time, there is another pixel to be evaluated at the coordinates (105, 100) near this abnormal pixel, with an extracted stability parameter of 1.3 and a contrast parameter of 28. Under the one-dimensional judgment logic that relies solely on static thresholds, since all indicators of this pixel are within the range, it will be classified by the algorithm as normal background texture. By setting a fixed judgment standard, this technique can isolate the real defect center with prominent features with low computational overhead. This establishes the physical origin of the defect occurrence and provides a reliable reference benchmark for subsequent edge anomaly judgment, preventing processing delays caused by complex global calculations.
[0037] In S4, adaptive boundary evolution based on topological potential field is performed on pixels that are not intercepted by the static threshold but are physically close to the defect core. All first suspicious pixels are regarded as energy radiation sources, and an influence field is constructed according to the inverse square law of spatial distance. Taking the aforementioned pixel to be evaluated with coordinates (105, 100) as an example, its spatial distance from the core anomalous pixel is 5 pixels, and the single-point potential energy value obtained by the inverse square relationship is 0.0385. By comparing it with the maximum potential energy extreme value of 0.1 in the global non-suspicious region, the normalized potential energy coefficient of the pixel to be evaluated is calculated to be 0.385. This coefficient represents the probability that the pixel is affected by local mold temperature imbalance or mold release agent accumulation. Subsequently, the static threshold is dynamically corrected using this coefficient. The corrected upper threshold shrinks to 0.9225, and the lower threshold expands to 34.625. After this local boundary adjustment, the pixel's stability parameter 1.3 and contrast parameter 28, which were originally within the acceptable limits, both exceeded the limits, thus being captured and marked as the second suspicious pixel. This technique follows the spatial continuous attenuation law of optical substrate drift on the die-cast surface, improving the sensitivity of identifying weak anomaly areas at the edges of real defects, while maintaining noise resistance away from the defect area.
[0038] In S5, a two-dimensional defect classification and closed-loop control command is issued for the connected domain formed by the first and second suspicious pixels. First, the geometric area ratio of this connected domain is measured to be 0.12. Then, its infrared response under three tilted detection channels is extracted, and the average gray values in the three directions are measured to be 120, 145, and 105, respectively. By calculating the dispersion of these three gray responses relative to their mean of 123.33, the anisotropy variance characterizing spatial symmetry is obtained as 272.2. Since this variance is higher than the preset equiaxed porosity dispersion judgment benchmark of 50, combined with the area ratio, the defect is determined to be a cold-sealed crack with directional deep valley characteristics, rather than ordinary porosity. After determining the defect type, for the currently detected 1200th production die casting, the 20-second physical transmission time required from die ejection from the die-casting machine to arrival at the inspection station is calculated. Based on a production line cycle of 2 seconds, a process delay coefficient of 10 is calculated. Finally, the process adjustment command to increase the mold temperature by 30 degrees Celsius and the injection pressure by 5 MPa was sent to the control terminal and applied to the 1211th and subsequent target molds. This technique, which combines three-dimensional optical morphology classification with physical timing calculation, ensures accurate identification of the physical characteristics of defects and avoids adjustment misalignment caused by applying control commands to incorrect molds.
[0039] In summary, the entire machine vision-based defect detection method for aluminum alloy die-casting parts firstly utilizes the physical isolation configuration of different wavelengths and matching narrowband filters to block cross-band diffuse reflection crosstalk caused by metal reflection, decoupling the optical responses of shallow textures and deep defects, and providing a data source for subsequent feature calculation. Furthermore, dynamic compensation calculation is performed by introducing the gray-level noise variance of the non-test area, reducing the environmental adaptability impact of the fixed bias constant and quantifying the temporal stability and spatial contrast parameters of the pixels. Finally, the initially screened anomalous pixels are used as radiation sources to establish a spatial topological potential field, which is then calculated using inverse square ratios. The normalized potential coefficient is calculated using regularity to dynamically correct the static threshold locally. This logic adapts to the spatial distribution of optical substrate drift, suppressing background false alarms while improving the ability to capture weak anomalies at the edges of adjacent defect areas. Furthermore, by combining the area ratio of connected regions with the optical anisotropy variance characterizing spatial symmetry, the classification of porosity groups and cold shut cracks is achieved. Based on this, a physical transmission timing conversion mechanism is introduced, enabling the generated process adjustment commands to be applied to subsequent target modules of the die-casting machine. This solves the feedback misalignment problem caused by not considering mechanical delay and realizes closed-loop control of the die-casting production line.
[0040] like Figure 2 As shown, in one specific embodiment, S1 includes: S11, acquiring the optical response of a first wavelength through a first detection channel to form a first time-series image set, and acquiring the optical response of a second wavelength through multiple tilted second detection channels to form a multi-view image set.
[0041] S12. Filter components matching the corresponding acquisition wavelengths are respectively set at the receiving front end of the first detection channel and the second detection channel. Utilizing this physical isolation structure, the first detection channel uses a first wavelength to detect shallow texture features on the surface of the die-cast part, and the second detection channel uses a second wavelength to penetrate the surface oxide layer to detect deep defect features, thereby blocking cross-band reflection optical crosstalk.
[0042] In this embodiment, it should be noted that in S11, to address the complex geometric structure of the aluminum alloy die-casting surface and the inability of a single viewpoint to fully cover defect features, a multi-dimensional acquisition node was constructed at the physical space level of the inspection station. Specifically, a vertical inspection channel was deployed directly above the station, and three inclined inspection channels were arranged at 45-degree angles around it, with photoelectric acquisition components installed at the end of each channel. The 45-degree angle was determined as the optimal observation tilt angle based on photometric stereoscopic simulation of the defect's three-dimensional morphology and on-site imaging tests. By establishing a microscopic geometric model of the cold-seal crack in optical simulation software, the intensity of shadows and reflections at the bottom of the valley was analyzed by simulating changes in the camera's receiving angle. The results showed that setting the angle to 45 degrees not only created a strong directional contrast but also considered depth of field and avoided sidewall obstruction, resulting in the highest sensitivity for extracting anisotropic variance.
[0043] In automotive transmission housing production lines, this spatial topology array, combining vertical and multi-directional tilting, enables simultaneous detection coverage of the housing's top plane, as well as sidewalls and deep cavity areas prone to obstruction. Deploying this physical architecture overcomes the limitations of blind spots inherent in single-point observation, providing three-dimensional hardware support for acquiring omnidirectional optical response and extracting multi-view feature contrast, and enabling simultaneous multi-channel data acquisition.
[0044] In S12, to address the cross-band diffuse reflection crosstalk issue generated on the reflective surface of the aluminum alloy during synchronous strobeing of multiple light sources from different angles, the optical bands of each detection channel were decoupled. Specifically, the light source for the vertical detection channel was configured with 460 nm short-wavelength blue light to detect shallow residual textures of the release agent on the surface; the light sources for the three tilted detection channels were configured with 850 nm near-infrared light to penetrate the thin oxide layer and detect deep cold-sealed cracks. The 460 nm blue light wavelength and the 850 nm near-infrared wavelength were experimentally determined based on the spectral reflectance characteristics of the aluminum alloy surface. Spectrophotometric scanning of the die-cast sample across the full spectrum from 300 nm to 1000 nm revealed that the release agent residue area exhibited the strongest light absorption contrast in the 450–470 nm frequency band, while the oxide layer substrate had the highest refractive index and was least affected by optical scattering interference from shallow surface textures in the 840–860 nm frequency band. Therefore, the system selects 460 nm and 850 nm as the center frequency points for dual-wavelength detection, maximizing the signal-to-noise ratio of feature decoupling from the physical level.
[0045] Each channel's receiving front end is equipped with a filter component matched to the corresponding acquisition wavelength. This physical isolation ensures that the vertical camera receives only blue light reflection, and the tilting camera receives only near-infrared reflection, fundamentally blocking imaging interference caused by the mixing of different wavelengths. This configuration decouples the optical response of shallow noise from deep defects, improving the signal-to-noise ratio of the output image and providing reliable raw images for extracting temporal and spatial feature parameters.
[0046] In one specific implementation, in S2, the gray-scale noise floor variance of the non-test area pixels refers to the random noise energy distribution of the image sensor in areas without effective signal input, used to compensate for numerical interference caused by hardware electronic drift.
[0047] like Figure 3 As shown, S2 includes: S21, acquiring the grayscale sequence of the target pixel in a continuous acquisition cycle, and calculating the square of the difference in grayscale values between adjacent acquisition cycles.
[0048] S22. Extract the gray-level variance of the edge pixels in the non-test region within the first time-series image set as the gray-level noise variance of the non-test region pixels.
[0049] S23. The arithmetic mean of the squared differences in grayscale values between adjacent acquisition cycles is logarithmically calculated using the sum of the grayscale noise variance of pixels in the non-test area to generate a stability parameter. This stability parameter quantitatively describes the degree of energy jump in pixel grayscale values along the time domain axis, used to perceive the microscopic undulations of the material surface. Its calculation logic is as follows:
[0050]
[0051] in, This represents the stability parameter of the j-th pixel; N represents the total number of consecutive acquisition periods; and k represents the time series index of the acquisition period. This represents the gray value of the j-th pixel in the k-th acquisition period; This represents the gray value of the j-th pixel in the (k+1)-th acquisition period; This represents the variance of grayscale noise floor for pixels outside the test area.
[0052] The contrast parameter is calculated by scanning the grayscale response of each channel pixel within the same period, extracting the difference between the maximum and minimum grayscale values, and then averaging it over multiple periods. This contrast parameter reflects the brightness range of a pixel under multi-directional illumination, and is used to distinguish physical characteristics that exhibit directional selectivity to light.
[0053] In this embodiment, it should be noted that in S21, temporal data serialization processing is performed on the acquired multi-band images to capture the grayscale variation characteristics of pixels on the time axis. Following a fixed acquisition cycle of 120 milliseconds, each channel is synchronously triggered for stroboscopic exposure, continuously accumulating image data for 20 cycles. For a pixel suspected of having a defect, its grayscale sequence exhibits high-frequency variations within the continuous acquisition cycle, with grayscale values fluctuating between 145 and 160. The square of the difference in grayscale values between adjacent acquisition cycles is calculated to quantify the change in reflected light intensity caused by the perturbation of the metal micro-surface normal vector. By extracting this squared difference sequence, the original discrete grayscale fluctuations are converted into non-negative values characterizing the jump energy, solving the technical problem that a single frame of static image cannot reflect the micro-roughness of the material, and providing a fundamental data source for evaluating the optical stability of pixels over time.
[0054] In S22, a dynamic background compensation mechanism is introduced to prevent interference from stray light drift or camera thermal noise on feature extraction. Instead of manually presetting static bias constants, the gray-level variance of edge pixels in the non-test area within the first time-series image set is extracted as the gray-level noise floor variance of the non-test area pixels. In a production line test scenario, the gray-level noise floor variance of the non-test area pixels was calculated to be 0.16 from a dark-field reference area without workpiece reflection. Using measured physical quantities as the calculation basis objectively reflects the true noise level of the current sensor and the on-site optical environment. This technique of replacing static parameters with dynamic noise floor enhances the algorithm's adaptability to light source attenuation or environmental temperature changes, avoiding logarithmic operation crashes or feature quantization distortion caused by parameter mismatch.
[0055] In S23, a calculation expression is used. The stability parameters of the pixels are calculated using this expression. The design logic of this expression aims to transform discrete temporal grayscale fluctuations into numerical indicators that can objectively reflect the micro-texture state of the die-cast surface.
[0056] Furthermore, in this specific calculation process, instead of directly calculating the grayscale variance over the entire period, the square of the difference between grayscale values during adjacent acquisition periods is introduced for calculation. This differential square operation mechanism can effectively filter out low-frequency interference caused by the slow drift of ambient light in the production line or the normal temperature drift of the light source, and retain only the random high-frequency optical scattering jump energy generated by the metal microstructure under multiple exposures.
[0057] Furthermore, to avoid the subsequent logarithmic operations becoming meaningless or causing low-level overflow errors when processing smooth, non-defective areas with constant reflectivity due to the completely zero grayscale difference, the expression superimposes the grayscale noise variance of the non-test area pixels at the end of the mean calculation. By using real-time extracted dark-field physical noise instead of a fixed empirical bias constant preset by humans, this compensation term can adapt to the current hardware's CMOS electronic thermal noise level and the ambient temperature environment.
[0058] Based on specific production line data in the application scenario, for a particular pixel, within an observation time window of 20 acquisition cycles, data fluctuating between gray levels 145 and 160 were extracted. First, the squared differences of adjacent sequence values were summed, resulting in a cumulative sum of 85.5 gray level squares. After an arithmetic mean calculation using N-1 (19), the mean gray level jump for this pixel was found to be 4.5 gray level squares. Subsequently, the gray level noise variance of non-test area pixels (previously measured at 0.16 gray level squares) was added to this, resulting in 4.66 gray level squares. Finally, a natural logarithmic mapping operation was performed. The logarithmic operation, through nonlinear compression, reduced the interference of extreme highlight jump values on the overall feature quantization, thus outputting a dimensionless stability parameter of 1.539.
[0059] This computational process, which combines differential and adaptive noise compensation with logarithmic compression, solves the technical problem that existing visual inspection is susceptible to global illumination attenuation, ensuring that the acquired temporal feature parameters are only sensitive to the actual surface roughness of the casting.
[0060] In one specific implementation, in S3, the static threshold includes a static upper limit threshold for evaluating stability parameters and a static lower limit threshold for evaluating contrast parameters; when a pixel's index exceeds the static upper limit threshold or falls below the static lower limit threshold, it is marked as a first suspicious pixel. In S4, the topological potential field is a field model that treats known defect points as energy radiation centers and calculates the surrounding affected intensity based on spatial distance laws.
[0061] like Figure 4As shown, the calculation of the normalized potential energy coefficient of the pixel to be evaluated in S4 includes: S41, calculating the square of the spatial distance from the pixel to be evaluated to each first suspicious pixel, taking the reciprocal and summing them to generate the single-point potential energy value of the pixel to be evaluated.
[0062] S42. Obtain the maximum single-point potential energy value of each pixel in the global non-suspicious region, and use the ratio of the single-point potential energy value of the pixel to be evaluated to this maximum value as the normalized potential energy coefficient. This normalized potential energy coefficient describes the relative energy level of the pixel in the potential field, and its value is between 0 and 1. Its calculation logic is as follows:
[0063]
[0064] in, This represents the normalized potential coefficient of the j-th pixel to be evaluated; The set of first suspicious pixels; p represents the index of the first suspicious pixel in the set; Indicates the spatial coordinates of the pixel to be evaluated; Represents the spatial coordinates of the p-th first suspicious cell; I represents the set of global non-suspicious area cells; i represents the cell index in the set of global non-suspicious area cells; the value 1 is the cell area offset.
[0065] The value 1, used as a pixel area bias, is determined based on the smallest physical resolution unit of the image spatial coordinate system. It serves as a regularization term to prevent numerical overflow when calculating potential energy due to the overlap between the evaluation point and the core point (where the distance is zero). By introducing a constant equivalent to the unit pixel area into the topological potential field model, the continuity and robustness of potential energy calculation across the entire image are ensured. For example, comparing multiple bias values ranging from 0.1 to 2.0 reveals that when the value is 1, the attenuation slope of the potential energy gradient in the near-field region of the defect best conforms to the physical diffusion law, and minimizes the truncation error of 32-bit floating-point operations, thus guaranteeing the numerical stability of the adaptive correction logic.
[0066] S43. Adaptively correct the static threshold based on the normalized potential energy coefficient. The corrected threshold serves as the benchmark for secondary judgment. Specifically, the corrected upper threshold is obtained by multiplying the static upper threshold by a first coefficient, which is the difference between the first value and the normalized potential energy coefficient; the corrected lower threshold is obtained by multiplying the static lower threshold by a second coefficient, which is the sum of the first value and the normalized potential energy coefficient. This process causes the judgment boundary to shrink due to the influence of adjacent defects, thereby obtaining the second suspicious pixel.
[0067] In this embodiment, it should be noted that in S41, for the first suspicious pixel that has passed the static threshold screening, its spatial topological influence field on the surrounding area is constructed. For the pixel to be evaluated with coordinates (105, 100), the square of its spatial distance to each first suspicious pixel is calculated, the reciprocal is taken, and then summed to generate the single-point potential energy value of the pixel to be evaluated. In the actual calculation, the spatial distance from the pixel to be evaluated to a certain core abnormal pixel is 5 pixel units. According to the inverse square law of distance combined with the bias of 1, the generated single-point potential energy value is 0.0385. This calculation logic regards the defect point as an energy source with radiation effect, follows the defect propagation caused by local temperature imbalance on the surface of the die casting, and quantifies the probability of the non-limited pixel being affected by the nearby defect through spatial distance attenuation mapping.
[0068] In S42, to transform isolated defect pixel points into a topological evaluation field with physical space radiation effects, the computational expression is executed. The normalized potential energy coefficient of the pixel to be evaluated is calculated. This calculation process is based on the inverse square law of spatial distance attenuation. Its technical starting point is to simulate the defect propagation characteristics caused by local temperature imbalance or excessive accumulation of release agent in die castings. That is, in the two-dimensional pixel coordinate system, the physical probability of latent small abnormal features increases exponentially closer to the core of the diagnosed defect.
[0069] Furthermore, in the numerator of the expression, all the first suspicious pixels in the set are traversed, and the spatial span between the target and each radiation source is obtained by calculating the square of the Euclidean distance. A pixel area offset of 1 square pixel is added to the denominator. This solves the problem of division by zero overflow caused when the point to be evaluated is extremely close to or even coincides with the anomaly point, and ensures the continuity and robustness of the topology calculation of the whole map.
[0070] Taking a pixel with coordinates (105, 100) as an example, assume there is a core first suspicious pixel nearby, with a spatial distance of 5 pixels. First, the square of the distance is calculated as 25 square pixels. After adding the offset, it becomes 26 square pixels. Taking the reciprocal, the single-point potential energy value received by this point is the reciprocal of 0.0385 square pixels. If multiple anomalies exist locally, a chain summation operation is performed to aggregate the multi-source influence. To eliminate the scale difference caused by the absolute value of potential energy being affected by image resolution and defect density, the maximum value of the single-point potential energy is searched and extracted by traversing the global non-suspicious area. Assuming the maximum value extracted in the current image is the reciprocal of 0.1 square pixels, a ratio operation is performed, dividing the reciprocal of 0.0385 square pixels by the reciprocal of 0.1 square pixels to cancel out the unit dimension, thus calculating the normalized potential energy coefficient of the pixel to be evaluated as 0.385.
[0071] By establishing a mapping relationship between global extrema and local potential energy, the spatial distribution is transformed into standardized weights between 0 and 1, solving the problem that a fixed decision window cannot perceive the spread trend of edge defects, and providing solid algebraic support for the adaptive dynamic evolution of threshold boundaries.
[0072] In S43, the normalized potential energy coefficient is used to perform adaptive evolution correction on the judgment threshold. For the pixel to be evaluated with a normalized potential energy coefficient of 0.385, the static upper limit threshold of 1.5 is multiplied by the difference between the numerical value and the normalized potential energy coefficient, resulting in a corrected upper limit threshold of 0.9225; the static lower limit threshold of 25 is multiplied by the sum of the numerical value and the normalized potential energy coefficient, resulting in a corrected lower limit threshold of 34.625. The pixel's originally within-limit stability parameter 1.3 and contrast parameter 28 exceed the limit under the corrected boundary, thus being captured as a second suspicious pixel. Based on the technique of tightening the judgment boundary in the local potential field, the sensitivity to capturing hidden anomalies at the edge in the vicinity of the defect core region is improved, while maintaining anti-interference capability in the normal region and reducing the false negative rate caused by the fixed threshold.
[0073] like Figure 5 As shown, in one specific implementation, in S5, the anisotropic variance measures the consistency of the gray-scale response of the connected domain under multiple spatial perspectives, and is used to characterize the directionality of the physical surface. Calculating the anisotropic variance of the target connected domain in S5 includes: S51, obtaining the single-channel average gray-scale of the target connected domain under different perspective subsets of the multi-view image set.
[0074] S52. Calculate the discrete root mean square error of the average gray level of each single channel relative to the overall arithmetic mean gray level, and generate the anisotropic variance. The calculation logic is as follows:
[0075]
[0076] in, The anisotropic variance of the target connected component is represented by M; the total number of tilt detection channels is represented by m; and the detection channel index is represented by m. This represents the average gray value of the target connected component in the m-th channel; This represents the overall arithmetic mean gray value of the target connected component across all slanted channels.
[0077] S53. The defect level is determined by the geometric area ratio of the connected domains of the joint target and the anisotropic variance. When the anisotropic variance is not greater than the preset dispersion threshold, the defect is determined to be of the equiaxed porosity type; when the anisotropic variance is greater than the dispersion threshold, the defect is determined to be of the crack type with a directional deep valley structure.
[0078] S54. Based on the physical transmission time between the die-casting mold exit station and the image acquisition station, the production mold deviation is calculated and used as a timing compensation parameter. The control command is sent to the control terminal with this parameter attached, so that it can be applied to the corresponding subsequent target mold, achieving phase matching between the detection results and the process execution.
[0079] In this embodiment, it should be noted that in S51, the first and second suspected pixels are fused, and connected component analysis is performed to conduct a two-dimensional geometric macroscopic assessment. A connected component labeling algorithm is used to combine spatially adjacent suspected pixels into a complete defect topology patch, and the geometric area ratio of the total number of pixels contained in the target connected component to the total number of effective pixels in the image is calculated. In the gearbox housing inspection, the geometric area ratio of the local defect connected component was measured to be 0.12, meaning it occupies 12% of the effective area of the observation field. This quantification process objectively reflects the diffusion scale of the defect region on a macroscopic planar scale, solving the problem that relying on the number of discrete pixels cannot intuitively reflect the degree of defect. It provides a basic two-dimensional benchmark parameter for subsequent defect level determination and helps to assess the impact of the defect on the overall structure.
[0080] In S52, in order to qualitatively distinguish the previously extracted defect areas from the perspective of three-dimensional physical morphology, a calculation expression is used. This method extracts the anisotropic variance of the target connected domain. The design of this computational mechanism is based on photometric stereochemistry principles, aiming to utilize the differences in near-infrared light scattering by a metallic structure at different incident angles to infer the three-dimensional microscopic geometric orientation of defects.
[0081] The expression first extracts the overall arithmetic mean gray value of the target connected region across all tilted channels. This mean represents the overall basic reflectivity of the defect region to the infrared band. Then, the difference between the average gray value of each independent tilted channel and the overall mean is calculated and squared. Finally, the average of all squared deviations is obtained to acquire the variance data characterizing the directional dispersion width. If the target is an equiaxed group of pores, its hemispherical microcavities will exhibit approximately isotropic diffuse reflection of tilted incident light from all directions, causing the gray values of each channel to converge, resulting in a lower variance. Conversely, if it is a cold shut or crack type, its deep valley structure with a specific orientation will cause light parallel to the grooves to be absorbed and light perpendicular to the grooves to be strongly reflected, resulting in a large gray value difference in cameras from different viewing angles.
[0082] Using measured data from the application scenario, an image set with a total of 3 tilt detection channels was retrieved. For the labeled target connected component, its average grayscale values in the three viewing directions were measured to be 120 grayscale levels, 145 grayscale levels, and 105 grayscale levels, respectively. After summing and dividing by 3, the overall arithmetic mean grayscale value was calculated to be 123.33 grayscale levels. Next, the squared bias of the first channel was calculated to be 11.08 grayscale levels squared, the squared bias of the second channel was 469.58 grayscale levels squared, and the squared bias of the third channel was 335.98 grayscale levels squared. After summing these three and dividing by 3, the output anisotropic variance data was 272.2 grayscale levels squared.
[0083] This algebraic process of aggregating multi-view grayscale data into discrete variance gives it the ability to perceive three-dimensional depth topology from the changes in light and shadow on a two-dimensional plane. It solves the technical problem that existing vision solutions cannot distinguish between pores and cracks by simply relying on area statistics, and provides qualitative parameter basis for the implementation of targeted process compensation instructions in the backend.
[0084] In S53, the jointly acquired geometric area ratio and anisotropic variance are used to perform a two-dimensional defect classification of the current target connected domain. A discrete threshold for distinguishing three-dimensional morphological symmetry is preset, with a value set to 50. The discrete threshold is determined based on the statistical characteristics of anisotropic reflection of defects of different physical forms under multiple spatial perspectives. By performing multi-angle grayscale sampling on samples labeled as equiaxed pores and directional cracks, the cluster centers of their anisotropic variances are calculated to establish a classification benchmark. For example, in the experiment on 30 groups of pore samples, it was found that their variances due to isotropic scattering were distributed between 12 and 38, while the variances of 20 groups of crack samples were generally higher than 110 due to the directional reflection of the deep valley structure. By calculating the extreme median points of the two types of sample clusters on the variance axis and introducing 25% fluctuation redundancy caused by field vibration interference, the discrete threshold for distinguishing defect types is finally set to 50.
[0085] For connected regions with an anisotropic variance as high as 272.2, since the value exceeds the set dispersion threshold, it indicates that the defect region exhibits directional scattering differences for incident light at different angles. Based on the judgment logic, it is excluded from the classification as diffuse equiaxed pores and identified as a cold-seal crack type with a directional deep valley structure. The severity is confirmed by combining the area ratio of 0.12. This classification method, which combines two-dimensional macroscopic diffusion area with three-dimensional microscopic scattering characteristics, avoids misjudgment of defect types caused by a single area evaluation and provides a qualitative basis for adjusting the production process strategy.
[0086] In S54, the detection results are converted into closed-loop control instructions for the die-casting process, and physical timing compensation is performed. After a cold shut crack is found in the casting of the 1200th production batch, the physical transmission time between the die-casting mold exit station and the image acquisition station is calculated to be 20 seconds. Based on the inherent cycle time of 2 seconds per production line cycle, the production batch deviation is calculated as a timing compensation parameter with a value of 10. Subsequently, an adjustment instruction for the cold shut crack is generated, namely, increasing the mold temperature by 30 degrees Celsius and increasing the injection pressure by 5 MPa. This instruction is then sent to the control terminal with the timing compensation parameter of 10 attached. The specific correction values for increasing the mold temperature by 30 degrees Celsius and increasing the injection pressure by 5 MPa in the process adjustment instruction are generated based on the historical defect database and expert experience rule base of the die-casting production line. The system internally pre-constructs a lookup table matrix of defect level and process parameter correction amount. This matrix is obtained by collecting molding parameters of different degrees of cold shut cracks in the past year, as well as the effective compensation action data of subsequent successful debugging to eliminate the defect, and using a multiple regression algorithm for fitting. When a deep valley-shaped crack is detected due to localized rapid cooling or poor molten metal flow, the system automatically matches the empirical matrix and extracts the aforementioned benchmark correction amount to improve the filling density of the molten aluminum.
[0087] Furthermore, this allows the adjustment action to be applied to the 1211th and subsequent target modules. This compensation mechanism solves the problem of process adjustment misalignment caused by closed-loop control ignoring mechanical delays, prevents parameter corrections from being applied to irrelevant modules, and achieves alignment of production line feedback.
[0088] A machine vision-based defect detection system for aluminum alloy die castings is also provided, the system comprising:
[0089] The image acquisition module is used to acquire a first time-series image set of the target area of the die casting at a first wavelength, and a multi-view image set at a second wavelength within the same acquisition period;
[0090] The feature calculation module is used to calculate stability parameters based on the mean gray level fluctuation of the first time-series image set and the gray level noise variance of non-test area pixels, and to calculate contrast parameters based on the gray level extreme value difference of the multi-view image set.
[0091] The initial screening module is used to compare the stability parameter and contrast parameter with the corresponding static thresholds to screen the first suspicious pixels;
[0092] The boundary evolution module is used to construct a topological potential field based on the inverse square ratio of the spatial distance from each first suspicious pixel to the non-boundary pixel to be evaluated, calculate the normalized potential coefficient of the pixel to be evaluated, and use the normalized potential coefficient to adaptively correct the static threshold to obtain the second suspicious pixel.
[0093] The closed-loop control module is used to determine the defect level by combining the geometric area ratio of the connected domains with the anisotropic variance, and outputs control commands with transmission timing compensation.
[0094] In one specific embodiment, the image acquisition module is further configured to: acquire the optical response of a first wavelength through a first detection channel to form a first time-series image set, and acquire the optical response of a second wavelength through multiple tilted second detection channels to form a multi-view image set; the receiving front end of the first detection channel and the second detection channel are respectively provided with a filter component matching the corresponding acquisition wavelength to block cross-band reflected optical crosstalk.
[0095] To enable those skilled in the art to fully understand and implement the technical solutions described in this specification, the following section, using a control scenario containing specific data, provides a detailed deduction and data analysis of the entire implementation principle of a machine vision-based aluminum alloy die-casting defect detection method and system.
[0096] On a fully automated die-casting production line for automotive aluminum alloy gearbox housings, the inspection station is positioned above the conveyor belt between the die-casting machine's robotic arm and the downstream deburring workstation. To address the complex geometry of the housing surface, a multispectral, cross-modal decoupled acquisition architecture is constructed in S1. The vertical inspection channel is equipped with a 460nm blue multispectral light source, while three tilted inspection channels arranged at 45-degree angles are uniformly equipped with an 850nm near-infrared multispectral light source. When a newly ejected housing enters the inspection area, each channel's camera, in conjunction with narrowband filters, simultaneously captures 20 frames of image data within a 120ms acquisition cycle. This design utilizes short-wavelength blue light to detect shallow residual mold release agent textures on the surface, while simultaneously using long-wavelength near-infrared light to penetrate trace amounts of oxide scale and detect subsurface cold-dip cracks. This physically blocks diffuse optical crosstalk between different wavelengths, providing a high signal-to-noise ratio raw frame sequence for subsequent accurate calculation of stability and contrast parameters.
[0097] Upon entering S2, the system performs feature calculation on pixel j, which is suspected to have a porosity defect on the shell. The grayscale value sequence G of this pixel is calculated over 20 consecutive acquisition cycles. j The scattering of blue light by the microstructure of the metal surface varies abruptly, fluctuating between 145 and 160 gray levels. First, the system extracts the gray-level variance from the dark, non-test areas at the edges of the image set as the physical noise floor variance, and measures its value. The value is 0.16. The stability parameter calculation logic is based on the specifications described in the manual. If the sum of the squares of the grayscale differences between adjacent frames is 85.5, then the arithmetic mean is 4.5. The final calculated reflection stability variable... for Meanwhile, by scanning the grayscale extreme values of the vertical and tilted channels within the same period, the grayscale range under multiple views was measured to be between 30 and 35 grayscale levels. After arithmetic averaging, the feature contrast value of the pixel was obtained as 32.
[0098] In the initial boundary assessment of S3, the system presets a static upper limit threshold of stability of 1.5 and a static lower limit threshold of contrast of 25. For the aforementioned pixel j, its stability parameter of 1.539 exceeds 1.5, satisfying the threshold violation condition, so the system immediately marks it as the first suspicious pixel. At this time, there is another pixel m to be evaluated at the spatial coordinates (105, 100) near pixel j, with an initial stability parameter of 1.3 and a feature contrast value of 28. In existing algorithms that rely solely on static thresholds, pixel m would be considered normal background because it has not violated the threshold. However, under the topological potential field mechanism of this invention, since pixel m is closer to the identified abnormal pixel j, it will face a dynamically adjusted judgment boundary, thereby effectively preventing the omission of minor edge defects.
[0099] In S4, the system treats the first suspicious pixel, such as pixel j, as an anomalous radiation source and constructs a topological potential field based on the inverse square law of spatial distance. If the spatial distance from pixel m to pixel j is 5 pixel units, according to the formula in the specification, the single-point potential energy value is... Assuming the maximum sum of the total potential energy of all pixels in the non-suspicious region of the entire image is 0.1, then the normalized potential energy coefficient of pixel m is... This coefficient intuitively reflects the degree to which the point being evaluated is affected by the core defect region in physical space. The larger the coefficient, the higher the probability that the location is a defect edge point, and the identification sensitivity must be improved by tightening the threshold.
[0100] Subsequently, the system uses this normalized potential energy coefficient to locally evolve and correct the static threshold. For pixel m, the corrected upper stability threshold is calculated as 1.5*(1-0.385)=0.9225, while the corrected lower contrast threshold is calculated as 25*(1+0.385)=34.625. The original stability parameter of pixel m, 1.3, is now much larger than the corrected threshold of 0.9225, and its contrast value, 28, is now also lower than the corrected threshold of 34.625. Under this adaptive boundary evolution logic, pixel m is captured and marked as the second suspicious pixel. This weight calculation method, which radiates from the core defect to the periphery, enables the system to capture weak feature anomalies that were originally in the "safe zone" but have a physical correlation trend.
[0101] In S5, the system performs 3D morphological determination on the defective connected region composed of the first and second suspicious pixels. The geometric area ratio of this connected region in the image set is measured to be 0.12 (i.e., occupying 12% of the total pixels). Subsequently, the system extracts the infrared grayscale response of this region under three tilt detection channels, and the average grayscale values in the three directions are measured to be 120, 145, and 105, respectively. Based on the optical anisotropy variance calculation logic: Therefore, the discrete mean square error is calculated. Because the variance is higher than the preset equiaxed porosity dispersion threshold (usually set below 50), the system determines that the defect is not a circular porosity, but a "cold-crack level" defect with high orientation selectivity.
[0102] Finally, for the detected severe defects, the system triggers a control command with phase compensation. It is known that the casting with this defect corresponds to the M=1200th production die, and there is approximately a 20-second physical transmission time from die ejection to arrival at the inspection station. With a production line rhythm of 2 seconds per cycle, the system calculates the production die deviation (process delay coefficient) to be 10. At this point, the actual die in progress has reached the 1210th die. The system sends the command generated for the "cold-crack level"—"increase the die temperature by 30 degrees Celsius and increase the injection pressure by 5 MPa"—directly to the control terminal via the Ethernet interface. This control command is set to apply to the 1200+10+1=1211th and subsequent target dies. This timing compensation parameter, obtained by accurately calculating the transmission time difference, avoids severe lag in feedback adjustment at the die level, achieving a real-time, precise closed loop from online identification to parameter optimization.
[0103] The preferred embodiments of the present invention have been described in detail above with reference to the accompanying drawings. However, the present invention is not limited to the specific details of the above embodiments. Within the scope of the technical concept of the present invention, various simple modifications can be made to the technical solution of the present invention, and these simple modifications all fall within the protection scope of the present invention.
[0104] It should also be noted that the various specific technical features described in the above embodiments can be combined in any suitable manner without contradiction. To avoid unnecessary repetition, the present invention will not describe the various possible combinations separately.
[0105] Furthermore, various different embodiments of the present invention can be combined in any way, as long as they do not violate the spirit of the present invention, they should also be regarded as the content disclosed by the present invention.
[0106] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, and not to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the foregoing embodiments, or make equivalent substitutions for some or all of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present invention, and they should all be covered within the scope of the claims and specification of the present invention.
Claims
1. A method for detecting defects in an aluminum alloy die casting based on machine vision, characterized by, The methods include: Acquire a first time-series image set of the target area of the die-casting part at the first wavelength, and a multi-view image set at the second wavelength within the same acquisition period; Stability parameters are calculated based on the mean gray-level fluctuation of the first time-series image set and the gray-level noise variance of non-test area pixels, and contrast parameters are calculated based on the gray-level extreme value difference of the multi-view image set. The stability parameter and contrast parameter are compared with their corresponding static thresholds to screen the first suspicious pixels; A topological potential field is constructed based on the inverse square ratio of the spatial distance from each first suspicious pixel to the non-boundary pixel to be evaluated, and the normalized potential coefficient of the pixel to be evaluated is calculated. The static threshold is adaptively corrected using the normalized potential energy coefficient, and the corrected threshold is used to screen the pixels to be evaluated again to obtain the second suspicious pixels. Connectivity analysis is performed on the first and second suspicious pixels to calculate the geometric area ratio of the target connected regions, and the anisotropic variance of the target connected regions in the multi-view image set is calculated. The defect level is determined by combining the geometric area ratio and anisotropic variance, and control commands with transmission timing compensation are output.
2. The machine vision-based defect detection method for aluminum alloy die-casting parts according to claim 1, characterized in that, The acquisition of a first time-series image set of the target area of the die-casting part at a first wavelength, and a multi-view image set at a second wavelength within the same acquisition period, includes: The optical response of the first wavelength is acquired through the first detection channel to form a first time-series image set, and the optical response of the second wavelength is acquired through multiple tilted second detection channels to form a multi-view image set. The receiving front end of the first and second detection channels is equipped with filter components that match the corresponding acquisition wavelength to block cross-band reflected optical crosstalk.
3. The machine vision-based defect detection method for aluminum alloy die-casting parts according to claim 1, characterized in that, The calculated stability parameters include: Extract the square of the grayscale difference between adjacent image frames in the first temporal image set; The gray-level variance of edge pixels in non-test areas within the first time-series image set is extracted as the gray-level noise variance; The stability parameter is generated by performing a logarithmic calculation on the sum of the arithmetic mean of the squares of the grayscale differences and the variance of the grayscale noise floor.
4. The machine vision-based defect detection method for aluminum alloy die castings according to claim 1, characterized in that, The calculation of the normalized potential coefficient of the pixel to be evaluated includes: Calculate the square of the spatial distance from the pixel to be evaluated to each first suspicious pixel, take the reciprocal and sum them up to generate the single-point potential energy value of the pixel to be evaluated. The maximum value of the single-point potential energy of each pixel in the global non-suspicious region is obtained, and the ratio of the single-point potential energy of the pixel to be evaluated to the maximum value is used as the normalized potential energy coefficient.
5. The machine vision-based defect detection method for aluminum alloy die-casting parts according to claim 1, characterized in that, The adaptive correction of the static threshold using the normalized potential energy coefficient includes: The static upper limit threshold used to evaluate the stability parameter is multiplied by the first coefficient to obtain the corrected upper limit threshold, where the first coefficient is the difference between the numerical value and the normalized potential coefficient. The static lower limit threshold used to evaluate the contrast parameter is multiplied by a second coefficient to obtain the corrected lower limit threshold. The second coefficient is the sum of the numerical value and the normalized potential energy coefficient.
6. The machine vision-based defect detection method for aluminum alloy die-casting parts according to claim 1, characterized in that, The calculation of the anisotropic variance of the target connected component in the multi-view image set includes: The single-channel average grayscale of the target connected component is obtained under different view subsets of the multi-view image set; Calculate the discrete mean square error of the average gray level of each single channel relative to the overall arithmetic mean gray level, and generate anisotropic variance to characterize the symmetry of the target's three-dimensional morphology.
7. The machine vision-based defect detection method for aluminum alloy die castings according to claim 1, characterized in that, The determination of defect level by the joint geometric area ratio and anisotropic variance includes: When the anisotropy variance is not greater than the preset dispersion threshold, the target defect is determined to be of the equiaxed porosity type, and the aggregation level is classified according to the geometric area ratio. When the anisotropy variance is greater than the preset dispersion threshold, the target defect is determined to be a crack type with a directional deep valley structure.
8. The machine vision-based defect detection method for aluminum alloy die-casting parts according to claim 1, characterized in that, The output control command with transmission timing compensation includes: Based on the physical transmission time between the die-casting mold exit station and the image acquisition station, the production mold deviation is calculated and used as a timing compensation parameter. The process adjustment instructions generated for the defect level are sent to the control terminal after being supplemented with timing compensation parameters, so that they can be applied to the corresponding subsequent target modules.
9. A machine vision-based defect detection system for aluminum alloy die-casting parts, characterized in that, include: The image acquisition module is used to acquire a first time-series image set of the target area of the die casting at a first wavelength, and a multi-view image set at a second wavelength within the same acquisition period; The feature calculation module is used to calculate stability parameters based on the mean gray level fluctuation of the first time-series image set and the gray level noise variance of non-test area pixels, and to calculate contrast parameters based on the gray level extreme value difference of the multi-view image set. The initial screening module is used to compare the stability parameter and contrast parameter with the corresponding static thresholds to screen the first suspicious pixels; The boundary evolution module is used to construct a topological potential field based on the inverse square ratio of the spatial distance from each first suspicious pixel to the non-boundary pixel to be evaluated, calculate the normalized potential coefficient of the pixel to be evaluated, and use the normalized potential coefficient to adaptively correct the static threshold to obtain the second suspicious pixel. The closed-loop control module is used to determine the defect level by combining the geometric area ratio of the connected domains with the anisotropic variance, and outputs control commands with transmission timing compensation.
10. The machine vision-based defect detection system for aluminum alloy die castings according to claim 9, characterized in that, The image acquisition module is also used for: The optical response of the first wavelength is acquired through the first detection channel to form a first time-series image set, and the optical response of the second wavelength is acquired through multiple tilted second detection channels to form a multi-view image set. The receiving front end of the first and second detection channels is equipped with filter components that match the corresponding acquisition wavelength to block cross-band reflected optical crosstalk.