Multi-angle visual fusion detection method for pores and crack defects on surface of gray cast iron casting

By employing a multi-angle visual fusion detection method, which combines the synchronous acquisition and collaborative processing of visible light and thermal imaging data, the problem of insufficient detection accuracy of a single sensor is solved. This enables high-precision identification and classification of porosity and crack defects on the surface of gray cast iron castings, thereby improving the accuracy and robustness of the detection.

CN121962076APending Publication Date: 2026-05-01DONGGUAN QUNLI MOTOR CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
DONGGUAN QUNLI MOTOR CO LTD
Filing Date
2026-01-16
Publication Date
2026-05-01

AI Technical Summary

Technical Problem

In the detection of surface defects in gray cast iron castings, existing technologies rely on single sensors or single-view detection methods to accurately capture subtle morphological features such as porosity and cracks. Furthermore, thermal radiation data is easily affected by the heat dissipation characteristics of the casting itself and fluctuations in ambient temperature, leading to false detections or missed detections. Moreover, existing methods fail to fully consider the complementarity between different imaging modalities and the differences in feature contribution, resulting in insufficient discriminative power of the fused features.

Method used

The system employs multi-angle synchronous acquisition of visible light images and thermal imaging sequences. Image data is fused and processed using a dual-branch feature extraction network and an attention mechanism. Solidity index is used to screen candidate areas for pores. Finally, through three-dimensional morphology reconstruction and local normal convergence focus analysis, the system achieves accurate identification and classification of defects.

Benefits of technology

It significantly improves the detection accuracy and robustness of porosity and crack defects on the surface of gray cast iron castings, enhances the accuracy of defect location and the precision of type identification, and provides reliable industrial quality control support.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121962076A_ABST
    Figure CN121962076A_ABST
Patent Text Reader

Abstract

The invention discloses a gray cast iron casting surface pore and crack defect multi-angle visual fusion detection method. The method comprises the following steps: synchronously acquiring visible light images and thermal imaging sequences of a casting surface from a plurality of preset angles; performing oil stain area identification and illumination enhancement processing on the visible light image, and extracting a thermal radiation abnormal image from the thermal imaging sequence; respectively processing the heat radiation abnormal image and the enhanced visible light image through a double-branch feature extraction network, and performing adaptive fusion to generate an initial weight image; screening pore candidate areas based on the compactness; and performing three-dimensional shape reconstruction on the initial weight image according to morphological characteristic differences of the pore candidate areas at different angles, positioning a suspected defect area, positioning an independent defect according to a local normal convergence focus of a pixel point, and outputting a defect identification result. According to the method, the limitation of a single view angle is overcome, and the image quality and the identification degree of defect characteristics are remarkably improved, so that the accuracy of defect positioning and the fineness of type judgment are improved.
Need to check novelty before this filing date? Find Prior Art

Description

Multi-angle visual fusion detection method for surface porosity and crack defects in gray cast iron castings Technical Field

[0001] This invention relates to the field of visual inspection technology, and in particular to a multi-angle visual fusion detection method for surface porosity and crack defects in gray cast iron castings. Background Technology

[0002] In the current field of surface defect detection for gray cast iron castings, existing technologies have several limitations: First, traditional detection methods often rely on single-type sensors or single-view imaging data. While single thermal imaging technology is sensitive to temperature changes, it struggles to accurately capture the subtle morphological features of defects such as porosity and cracks. Furthermore, thermal radiation data is easily affected by the casting's own heat dissipation characteristics and ambient temperature fluctuations, leading to false positives or false negatives. Second, existing methods often employ simple weighted averaging or serial splicing in feature extraction and fusion, failing to fully consider the complementarity and differences in feature contribution between different imaging modalities. This mechanical fusion strategy struggles to adaptively highlight defect-related features and suppress non-defect interference, resulting in insufficient discriminative power of the fused features and affecting the accuracy of subsequent defect localization and classification. Furthermore, existing technologies typically segment regions based on grayscale or texture thresholds in two-dimensional images, lacking an effective assessment of the geometric integrity and spatial distribution characteristics of defect regions. This can lead to misclassification of non-porosity features such as surface scratches and stains as defects. Summary of the Invention

[0003] To address at least one of the aforementioned technical problems, this invention provides a multi-angle visual fusion detection method for porosity and crack defects on the surface of gray cast iron castings.

[0004] In a first aspect, the present invention provides a multi-angle visual fusion detection method for porosity and crack defects on the surface of gray cast iron castings. The method includes: simultaneously acquiring visible light images and thermal imaging sequences of the casting surface from multiple preset angles; performing oil stain area identification and illuminance enhancement processing on the visible light images, and extracting thermal radiation anomaly maps from the thermal imaging sequences; processing the thermal radiation anomaly maps and the enhanced visible light images separately through a dual-branch feature extraction network, and performing adaptive fusion using an attention-based fusion mechanism to generate an initial weighted image; in the initial weighted image, filtering candidate regions for porosity based on the solidity, where solidity is the ratio of the region area to the convex hull area; reconstructing the three-dimensional morphology of the initial weighted image according to the morphological feature differences of the candidate regions for porosity at different angles to generate a target detection image; locating suspected defect regions in the target detection image, locating independent defects based on the local normal convergence focus of pixels within the suspected defect regions, and outputting defect identification results based on the attributes and spatial distribution of each independent defect.

[0005] Preferably, the step of extracting the thermal radiation anomaly map from the thermal imaging sequence includes: extracting the thermal radiation intensity distribution map of the casting surface under a specific infrared band from the thermal imaging sequence, and collecting the actual thermal radiation value of each pixel in the corresponding local visible light image; calculating the theoretical thermal radiation value of each pixel in the local visible light image based on the spectral absorption data of the gray cast iron material; comparing the difference between the actual thermal radiation value and the theoretical thermal radiation value to generate the thermal radiation anomaly map.

[0006] Preferably, the step of locating independent defects based on the local normal convergence focus of pixels within the suspected defect region includes: extracting the edge point set of the suspected defect region based on the Canny operator and contour tracking algorithm; calculating the local normal direction of each edge point and counting the convergence focus of all normals within the suspected defect region; performing cluster analysis based on spatial distance on the convergence focus and grouping convergence points that are spatially adjacent into the same cluster; wherein each cluster represents an independent defect.

[0007] Preferably, after performing spatial distance-based clustering analysis on the convergence focus, the method further includes: generating a reference sub-region centered on each independent defect; calculating the spatial distance between each pixel and the center point of each reference sub-region, the boundary length of the reference sub-region to which it belongs, and the area enclosed by the pixel and the boundary of the reference sub-region based on the suspected defect region, in order to construct an attribution weight function; and determining the independent defect to which each pixel and the reference sub-region belong based on the attribution weight function.

[0008] Secondly, the present invention also provides a multi-angle visual fusion detection system for porosity and crack defects on the surface of gray cast iron castings. The system includes: an image acquisition unit, used to simultaneously acquire visible light images and thermal imaging sequences of the casting surface from multiple preset angles; perform oil stain area identification and illuminance enhancement processing on the visible light images, and extract thermal radiation anomaly maps from the thermal imaging sequences; an image fusion unit, used to process the thermal radiation anomaly map and the enhanced visible light image respectively through a dual-branch feature extraction network, and perform adaptive fusion using an attention-based fusion method to generate an initial weighted image; a morphology reconstruction unit, used to filter candidate porosity regions in the initial weighted image based on the solidity; the solidity is the ratio of the region area to the convex hull area; and perform three-dimensional morphology reconstruction on the initial weighted image according to the morphological feature differences of the candidate porosity regions at different angles to generate a target detection image; and a defect output unit, used to locate suspected defect regions in the target detection image, locate independent defects based on the local normal convergence focus of pixels within the suspected defect regions, and output defect identification results based on the attributes and spatial distribution of each independent defect.

[0009] Preferably, the image acquisition unit is further configured to: extract the thermal radiation intensity distribution map of the casting surface under a specific infrared band from the thermal imaging sequence, and acquire the actual thermal radiation value of each pixel in the corresponding local visible light image; calculate the theoretical thermal radiation value of each pixel in the local visible light image based on the spectral absorption data of the gray cast iron material; compare the difference between the actual thermal radiation value and the theoretical thermal radiation value, and generate a thermal radiation anomaly map.

[0010] Preferably, the defect output unit is further configured to: extract the edge point set of the suspected defect region based on the Canny operator and contour tracking algorithm; calculate the local normal direction of each edge point, and count the convergence focus of all normals within the suspected defect region; perform cluster analysis based on spatial distance on the convergence focus, and group convergence points that are spatially adjacent into the same cluster; wherein each cluster represents an independent defect.

[0011] Preferably, the defect output unit is further configured to: generate a reference sub-region centered on each independent defect; calculate the spatial distance between each pixel and the center point of each reference sub-region, the boundary length of the reference sub-region to which it belongs, and the area enclosed by the pixel and the boundary of the reference sub-region based on the suspected defect region, so as to construct the attribution weight function; and determine the independent defect to which each pixel and the reference sub-region belong according to the attribution weight function.

[0012] Thirdly, the present invention also provides an electronic device including a processor and a memory, the memory being used to store computer program code, the computer program code including computer instructions, wherein when the processor executes the computer instructions, the electronic device performs the method as described in the first aspect above and any possible implementation thereof.

[0013] Fourthly, the present invention also provides a computer-readable storage medium storing a computer program, the computer program including program instructions that, when executed by a processor of an electronic device, cause the processor to perform a method as described in the first aspect above and any possible implementation thereof.

[0014] Compared with existing technologies, the advantages of this invention are as follows: By simultaneously acquiring and collaboratively processing multi-angle visible light and thermal imaging data, this invention effectively overcomes the limitations of a single sensor or a single perspective. Specifically, oil stain identification and illuminance enhancement processing of visible light images significantly improve image quality and the recognizability of defect features; while the extraction of thermal radiation anomaly maps enhances the ability to capture the thermal behavior of defect areas. Through a dual-branch feature extraction network and attention mechanism fusion strategy, adaptive weighted fusion of multi-modal features is achieved, enhancing the discriminative power of defect features. Furthermore, the selection of pore candidate regions based on solidity indices and the three-dimensional morphological reconstruction of multi-angle features improve the accuracy of defect localization and the precision of type discrimination. Finally, by analyzing the spatial distribution of defects through local normal convergence focus analysis, accurate identification and classification of independent defects are achieved. The organic combination of this series of technical means significantly improves the detection accuracy and robustness of porosity and crack defects on the surface of gray cast iron castings, providing reliable technical support for the intelligent upgrading of industrial quality control.

[0015] It should be understood that the above general description and the following detailed description are exemplary and explanatory only, and are not intended to limit this disclosure. Attached Figure Description

[0016] To more clearly illustrate the technical solutions in the embodiments of the present invention or the background art, the accompanying drawings used in the embodiments of the present invention or the background art will be described below.

[0017] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this disclosure and, together with the specification, serve to illustrate the technical solutions of this disclosure.

[0018] Figure 1 is a flowchart illustrating a multi-angle visual fusion detection method for surface porosity and crack defects in gray cast iron castings provided in an embodiment of the present invention; Figure 2 is a structural schematic diagram illustrating a multi-angle visual fusion detection system for surface porosity and crack defects in gray cast iron castings provided in an embodiment of the present invention. Detailed Implementation

[0019] To enable those skilled in the art to better understand the present invention, 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. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0020] The terms "first," "second," etc., used in the specification, claims, and accompanying drawings of this invention are used to distinguish different objects, not to describe a specific order. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion. For example, a process, method, system, product, or apparatus that includes a series of steps or units is not limited to the listed steps or units, but may optionally include steps or units not listed, or may optionally include other steps or units inherent to these processes, methods, products, or apparatuses.

[0021] In this document, the term "embodiment" means that a particular feature, structure, or characteristic described in connection with an embodiment may be included in at least one embodiment of the invention. The appearance of this phrase in various places throughout the specification does not necessarily refer to the same embodiment, nor is it a separate or alternative embodiment mutually exclusive with other embodiments. It will be explicitly and implicitly understood by those skilled in the art that the embodiments described herein can be combined with other embodiments.

[0022] Please refer to Figure 1, which is a flowchart illustrating a multi-angle visual fusion detection method for porosity and crack defects on the surface of gray cast iron castings according to an embodiment of the present invention. As shown in Figure 1, the method includes: S10, simultaneously acquiring visible light images and thermal imaging sequences of the casting surface from multiple preset angles; performing oil stain area identification and illuminance enhancement processing on the visible light images, and extracting thermal radiation anomaly maps from the thermal imaging sequences; deploying a system consisting of multiple fixed-position image acquisition units in an industrial setting. Each unit includes a high-resolution visible light camera and an infrared thermal imager, ensuring that they are synchronously triggered in hardware, thereby simultaneously capturing visible light images and thermal imaging sequences of the same area of ​​the casting from different preset angles, i.e., multiple consecutive frames of thermal images within a short period of time.

[0023] Visible light image processing includes oil stain region identification and illumination enhancement. Oil stain region identification employs image segmentation algorithms based on color features (such as setting thresholds for hue (H) and saturation (S) in the HSV color space) and texture analysis (such as Local Binary Pattern (LBP)) to identify oil stain regions in visible light images caused by residual coolant, lubricating oil, etc. Illumination enhancement involves using adaptive histogram equalization (CLAHE) and other techniques to improve local contrast in the identified oil stain regions. For non-oil stain regions or the entire image, algorithms based on Retinex theory or deep learning enhancement models can be used to correct uneven illumination and highlight surface micro-textures. Temporal analysis is performed on the acquired thermal imaging sequences (usually containing dozens of frames). The statistical characteristics (such as standard deviation and deviation from the mean) of the thermal radiation intensity (temperature) of each pixel along the sequence time axis are calculated to generate a "thermal radiation anomaly map." This image can highlight areas with abnormal heat capacity or heat dissipation characteristics caused by defects such as pores and cracks; these areas typically appear as overheated or undercooled spots.

[0024] Multi-angle synchronous acquisition ensures the consistency of data from different modalities and perspectives in time and space, laying a reliable data foundation for subsequent multi-source information fusion and 3D analysis, and avoiding registration errors caused by casting movement or state changes. Oil stain area identification and targeted enhancement effectively overcome the occlusion and interference caused by oil stains on visible light images, avoiding misjudging oil stains as defects or obscuring defects within oil stains, significantly improving the quality of useful information in visible light images. Extracting thermal radiation anomaly maps from thermal sequences instead of using single-frame thermal images amplifies transient or weak thermal anomalies caused by defects, suppresses random noise and background thermal interference, making the thermal characteristics of defects more significant and stable.

[0025] S20. A dual-branch feature extraction network is used to process the thermal radiation anomaly image and the enhanced visible light image separately. An attention-based fusion method is used for adaptive fusion to generate an initial weight image. When constructing the dual-branch feature extraction network, a deep learning model containing two parallel sub-networks (branches) is built. One branch (e.g., based on a ResNet or VGG backbone network) is dedicated to processing the enhanced visible light image, extracting spatial features related to surface texture, geometry, and color differences. The other branch (which may have a relatively lightweight structure) is dedicated to processing the thermal radiation anomaly image, extracting thermal features related to thermal distribution anomalies. After the two branches extract high-level feature maps, an attention mechanism (e.g., channel attention, spatial attention, or a hybrid attention module) is introduced. This mechanism automatically learns and generates a set of weight maps that dynamically evaluate the importance of visible light and thermal features at each spatial location and in each feature channel. Then, the two features are weighted and fused according to these weights to generate an "initial weight image" that integrates visible light texture details and thermal anomaly information. In this image, pixels in defect areas will receive high weight values. Dual-branch networks allow for specialized feature extraction from image data with different physical properties, avoiding the feature confusion or suppression problems that may occur when a single network processes multimodal data, and fully leveraging the advantages of each modality. Adaptive fusion based on an attention mechanism can intelligently determine which modality's information is more reliable and important in different regions of the image. For example, in areas with oil residue, the system may rely more on thermal features; in clean areas, it may focus more on visible light texture features. This dynamic weighted fusion method is far superior to fixed-rule fusion methods; the generated initial weight image can more accurately highlight real defect areas and suppress irrelevant background.

[0026] S30. In the initial weighted image, candidate regions for pores are screened based on their solidity; the solidity is the ratio of the region area to the convex hull area. The initial weighted image is reconstructed in three dimensions based on the morphological differences of the candidate pore regions at different angles to generate a target detection image. High-weighted suspected regions are initially identified on the initial weighted image using methods such as threshold segmentation or region growing. Then, the "solidity" of each suspected region is calculated, which is the ratio of the actual area of ​​the region to its minimum convex hull area. Pores are usually approximately circular or elliptical, with relatively solid interiors, thus having a high solidity (close to 1); while linear defects or noise regions such as cracks and scratches have lower solidity. By setting a high solidity threshold, candidate pore regions can be effectively screened from other types of suspected defects. Using data collected from multiple angles, for the selected stomatal candidate regions, based on their morphological characteristics (such as contour, apparent size, and differences in projected shape in the initial weighted image) under different viewpoints, 3D reconstruction techniques such as stereo vision or shape-from-X are used to calculate the 3D topography (depth information or point cloud data) of the region. Thus, the initial weighted images from multiple viewpoints are fused to generate a "target detection image" containing 3D spatial information.

[0027] Introducing solidity as a screening metric is a simple yet effective morphological filtering method. It can significantly reduce the probability of misclassifying non-porosity defects such as linear cracks and surface scratches into the porosity detection range, thereby improving the specificity of porosity identification. Three-dimensional morphology reconstruction based on multi-view differences elevates the detection from a two-dimensional plane to three-dimensional space, effectively restoring the true depth and three-dimensional morphology of defects. This helps distinguish surface stains (without depth variation) from true pores and cracks (with depth variation) and allows for more accurate measurement of the physical dimensions of defects, providing crucial three-dimensional geometric information for subsequent defect classification and severity assessment.

[0028] S40. Locate suspected defect areas in the target detection image, locate independent defects based on the local normal convergence focus of pixels within the suspected defect areas, and output defect recognition results based on the attributes and spatial distribution of each independent defect.

[0029] On target detection images containing 3D information, clustering algorithms (such as DBSCAN) or connected component analysis are used, combined with 3D spatial coordinates and feature values, to locate connected suspected defect regions. For each suspected defect region, the local normal direction of each point in its surface point cloud is calculated. For porosity-type depressions, the local normals of its internal points converge towards the depression center. By analyzing the convergence of these normal vectors, one or more "foci" can be found, each of which can be located as an independent defect core. Cracks can be regarded as a series of continuous small depressions or grooves, and can also be segmented and located by normal distribution patterns. Combining the attributes of each independent defect, such as 3D size, depth, solidity, boundary shape regularity, and their spatial distribution relationship (such as whether they belong to different segments on the same crack path), the final defect identification result is output. The result may include information such as the type of defect (porosity, crack, etc.), location, number, size, and severity level.

[0030] This embodiment provides a powerful geometric tool that can accurately segment a connected suspected region (which may contain multiple adjacent defects) into independent defect units based on its surface geometry. This effectively solves the problem of "one detection of multiple defects" (misdetecting multiple adjacent defects as one) in traditional methods, greatly improving the accuracy of defect counting. Combining three-dimensional attributes and spatial distribution for comprehensive judgment means that defect identification results are no longer limited to two-dimensional image features, but are based on three-dimensional geometric features that are closer to physical reality. This greatly improves the accuracy of defect type classification (such as distinguishing between deep pits and shallow spots) and the ability to analyze complex crack morphologies. The final output results are more reliable and detailed, providing precise data support for quality control and process improvement.

[0031] In one embodiment, extracting the thermal radiation anomaly map from the thermal imaging sequence includes: extracting the thermal radiation intensity distribution map of the casting surface under a specific infrared band from the thermal imaging sequence, and acquiring the actual thermal radiation value of each pixel in the corresponding local visible light image; calculating the theoretical thermal radiation value of each pixel in the local visible light image based on the spectral absorption data of the gray cast iron material; comparing the difference between the actual thermal radiation value and the theoretical thermal radiation value to generate the thermal radiation anomaly map.

[0032] First, a thermal imaging sequence (e.g., 25 frames per second, lasting 4 seconds, for a total of 100 frames) is acquired by a synchronously triggered infrared thermal imager. Simultaneously, a high-resolution image is acquired by a visible light camera at the same time. Since the two cameras are positioned differently, high-precision image registration is required. Using pre-calibrated camera parameters (stereo calibration using a checkerboard or similar calibration plate), the homography transformation matrix between the visible light image and the thermal image is calculated. This matrix is ​​then used to precisely map the thermal image onto the coordinate system of the visible light image, ensuring that each visible light pixel corresponds to the correct thermal image pixel.

[0033] Infrared thermal imagers typically operate in specific infrared bands, such as mid-wave infrared (3-5 μm) or long-wave infrared (8-14 μm). The system directly reads the radiant intensity value (or calibrated temperature value, which can be equivalently considered as radiant intensity) of each pixel from the thermal imager. Temporal analysis is then performed on the registered thermal imaging sequence. For each spatial pixel (x, y), its radiant value over the entire time series is taken, forming a time-series signal. To obtain a stable radiant distribution background, the average or median of this time-series signal is calculated. This is done to eliminate transient noise interference and obtain an "actual thermal radiation value" that represents the steady-state thermal radiation level of that point during the observation period. Combining these steady-state values ​​of all points generates a "thermal radiation intensity distribution map," where each pixel value represents the actual thermal radiation value of that point at its corresponding location in the visible light image.

[0034] Furthermore, there is a physical relationship between the thermal emissivity of an ideal surface and its reflectivity in the visible light band (for many materials, an approximate corollary of Kirchhoff's law of thermal radiation holds: regions with strong absorption in the visible light band typically also have high emissivity in the infrared band). A spectral absorption database for gray cast iron is established beforehand through experimental measurements. This database contains a model of the correspondence between the visible light band reflectivity and the infrared band emissivity of gray cast iron under different surface conditions (e.g., smooth, oxidized, covered with sand, contaminated with oil, etc.). This model can be a lookup table or an empirical formula. For example, emissivity = f(visible light gray value).

[0035] Analyze the registered local visible light image. For each pixel in the image, extract its features. These features are usually grayscale values ​​or color features (such as RGB values), which directly reflect the surface optical properties (brightness / darkness, color) of the point. Identify the surface type. Using the results of "oil stain area identification" in step S10, or a more extensive surface condition classification algorithm (such as through a lightweight CNN), classify each pixel as: clean metal surface, oxide layer, sand deposits, oil stains, etc. Based on the surface type of the pixel and its visible light features (grayscale values), query the previously established gray cast iron spectral absorption database or model to calculate or find the "theoretical thermal emissivity" that the point should have in a specific infrared band. Finally, according to Planck's blackbody radiation law, given the actual temperature of the object (which can be estimated from the average temperature of the thermal image sequence) and the calculated theoretical thermal emissivity, the theoretical thermal radiation value of the point can be calculated. This value represents "the theoretical thermal radiation intensity that the surface of the point should exhibit if it were intact."

[0036] When generating a thermal anomaly map by comparing the actual and theoretical thermal radiation values, the difference is calculated for each pixel. Common methods include: residual method: outlier = |actual thermal radiation value - theoretical thermal radiation value|; ratio method: outlier = actual thermal radiation value / theoretical thermal radiation value, then quantifying the degree of deviation of the ratio from 1; standardized residual method: dividing the residual by the standard deviation of the theoretical value to eliminate the influence of dimensions.

[0037] Then, the calculated difference values ​​for each pixel are mapped to a new image matrix. This matrix is ​​the "thermal radiation anomaly map." Typically, outliers are normalized to a range between 0 and 255 for easier display and subsequent processing. In this map, pixel brightness directly represents the degree of deviation between the actual thermal behavior of that point and the theoretical thermal behavior predicted based on its surface condition. The greater the deviation, the more truly "anomaly" the area. For example, an area that appears to be clean metal (theoretically should have low emissivity) showing a high measured radiation value strongly suggests the presence of defects such as pores causing heat leakage beneath. Conversely, an oily area exhibiting abnormally high radiation could also be a sign of a defect.

[0038] The above embodiments, by introducing a materials physics model, elevate thermal imaging detection from simply "finding hot / cold spots" to "finding behavioral anomalies." It can effectively distinguish between normal radiation changes caused by different surface conditions such as oil stains or oxidation, and abnormal radiation changes caused by internal defects, greatly reducing false alarms caused by surface contamination and thus significantly improving the specificity and reliability of thermal imaging detection.

[0039] In one embodiment, the step of locating independent defects based on the local normal convergence focus of pixels within the suspected defect region includes: extracting the edge point set of the suspected defect region based on the Canny operator and contour tracking algorithm; calculating the local normal direction of each edge point and counting the convergence focus of all normals within the suspected defect region; performing cluster analysis based on spatial distance on the convergence focus and grouping convergence points that are spatially adjacent into the same cluster; wherein each cluster represents an independent defect.

[0040] The input for this step is the "suspected defect region" located in S40. This region is a binary or grayscale image extracted from the "target detection image" containing 3D information, where the pixel values ​​of the suspected defect area are significantly higher than the background. The Canny edge detection operator is used to process this region. The advantage of the Canny operator is that it can produce refined, connected single-pixel wide edges and has good noise suppression capabilities. By setting appropriate high and low thresholds, the contour boundaries of the suspected defect region can be accurately captured. The edge map output by the Canny operator is then processed using an algorithm such as the Suzuki85 contour tracing algorithm or a similar boundary tracing algorithm. This algorithm can walk along the edge pixels, organizing continuous edge points into an ordered, closed (for pores) or open (for cracks) point set. This point set forms the basis for subsequent normal calculations.

[0041] Furthermore, the local normal direction of each edge point is calculated, and the convergence focus of all normals within the suspected defect region is statistically analyzed. For each point in the contour point set, its k adjacent points are taken to form a local edge segment. This local segment is fitted with a straight line using the least squares method to obtain a fitted straight line. The perpendicular direction of this fitted straight line is calculated; this direction is defined as the local normal direction of the point. For concave defects, this normal direction roughly points inwards from the defect. Starting from each edge point, a ray is drawn along its local normal direction into the suspected defect region. The distribution of all these rays within the region is statistically analyzed. For an ideal circular pore, the normals of all edge points will approximately converge at a single point (i.e., the center of the circle). For actual irregular defects, these rays will intersect densely within a relatively small spatial range.

[0042] The convergence focus can be defined as follows: Method A (voting method): The suspected defect region is discretized into a grid, and each grid cell traversed by a ray receives one vote. The center of a grid cell that receives more than a certain threshold of votes is a candidate convergence focus.

[0043] Method B (Distance Clustering): Calculate the pairwise intersections of all rays. These intersections will be densely distributed near the actual defect center. The set of these intersections initially constitutes a candidate set of convergence foci.

[0044] Furthermore, for the candidate convergent focus set obtained in the previous step (which may contain hundreds of intersections), an unsupervised clustering algorithm based on spatial distance is used, most typically DBSCAN (density-based spatial clustering with noise). DBSCAN's advantage lies in not requiring a pre-specified number of clusters and its ability to automatically identify noise points (i.e., isolated focuses that are far away). It groups focuses that are within the neighborhood radius and have a minimum number of samples into the same cluster by defining two parameters: neighborhood radius and minimum sample size. For each cluster obtained after clustering, the geometric center (centroid) of all its points is calculated. Each centroid represents the core spatial location of an independent defect. If only one cluster is detected within a suspected defect region, the region is considered to contain only one independent defect. If multiple clusters are detected, it indicates that the region is composed of multiple neighboring independent defects, and defect segmentation is successfully achieved.

[0045] Traditional connected component analysis or watershed algorithms based on 2D image morphology are prone to misclassifying multiple independent defects as a single large defect region when dealing with interconnected, ambiguous defect clusters, leading to missed detections and inaccurate counting. This embodiment, however, segments defects based on their inherent 3D geometric characteristics (normal convergence), unaffected by the connectivity limitations of 2D pixels. Even if multiple defects appear connected in a 2D image, as long as they have their own independent geometric centers in 3D space (the lowest point of a depression or the deepest line of a ravine), their edge normals will converge to different foci, thus being correctly distinguished into different clusters by the DBSCAN algorithm. This significantly improves the accuracy of defect counting for dense pore clusters or complex network cracks. Furthermore, the core basis of this embodiment is the 3D morphology of the defect, rather than the grayscale or texture of the 2D image. This ensures that the segmentation boundary is not based on a manually set grayscale threshold, but on the physical structure of the defect itself. The located independent defect centers are their true positions in 3D space, providing precise benchmarks for subsequent evaluation of the defect's depth, volume, and other 3D attributes, resulting in more physically meaningful and reliable results. Whether it's a nearly circular pore, a narrow crack, or an irregularly shaped defect, the local normals at their edge points all share the common characteristic of pointing inwards. Therefore, this method embodiment is universal, does not rely on prior knowledge of the specific shape of the defect, and can flexibly handle various complex defect morphologies that may appear on the surface of castings.

[0046] In one embodiment, after performing spatial distance-based clustering analysis on the convergence focus, the method further includes: generating a reference sub-region centered on each independent defect; calculating the spatial distance between each pixel and the center point of each reference sub-region, the boundary length of the reference sub-region to which it belongs, and the area enclosed by the pixel and the boundary of the reference sub-region based on the suspected defect region, to construct an attribution weight function; and determining the independent defect to which each pixel and the reference sub-region belong based on the attribution weight function.

[0047] First, the system automatically divides initial baseline sub-regions around the core points of each independent defect obtained from the previous clustering analysis. A common method is spatial nearest neighbor partitioning, where the entire suspected region is divided into several sub-regions, each containing all points closest to a particular defect's core point. This establishes an initial "sphere of influence" for each independent defect. Next, the system needs to determine which defect a pixel should belong to. This determination is not simply based on distance, but rather on a comprehensive "attribution weight function." This function primarily considers three factors: spatial proximity: calculating the straight-line distance from the pixel to each defect's core point. Obviously, the closer the pixel is to a core point, the higher the natural tendency to assign it to that defect.

[0048] Boundary sharing degree: The system analyzes the relationship between this pixel and the boundaries of each reference sub-region. If the point is adjacent to the boundary line of a sub-region, or even lies on the boundary line itself, then it is highly likely to be part of the defect boundary. The system assesses the tightness of this relationship.

[0049] Region Shape Regularity: The system simulates how assigning this pixel to a defect would affect the overall shape of the defect. Ideally, the division should make the region shape of each defect as compact and regular as possible, avoiding very abrupt or unnatural protrusions. The system evaluates whether the region shape becomes more reasonable or more distorted after the point is assigned.

[0050] By combining the scores of the three factors above in an appropriate manner, a comprehensive attribution weight score is obtained. The higher this score, the more reasonable it is for the pixel to be attributed to the corresponding defect.

[0051] For each pixel within a suspected region, the system calculates its weight score for each individual defect. Then, using a "winner-takes-all" rule, the pixel is assigned to the defect that gives it the highest weight score. In this way, all pixels are precisely assigned to their respective defects. After this pixel-level partitioning, the initial baseline sub-region boundaries may be updated. For some very small, isolated baseline sub-regions surrounded by other defect regions, the system performs a secondary assessment of overall assignment. If the vast majority of pixels within a small region are assigned to another defect, the system uniformly assigns the entire small region to that defect to maintain regional consistency and result clarity.

[0052] Compared to traditional methods that simply rely on distance to generate rigid straight-line boundaries, this method comprehensively considers the degree of boundary sharing and the regularity of region shape, enabling the final defect boundaries to better fit the actual image edges, resulting in more accurate results that conform to visually natural forms. For "controversial" pixels with unclear features located between multiple defects, this method provides a quantitative, multi-factor-balanced decision-making mechanism, greatly reducing the arbitrariness of the division and making the results more objective and stable.

[0053] Referring to Figure 2, the present invention also provides a multi-angle visual fusion detection system for porosity and crack defects on the surface of gray cast iron castings. The system includes: an image acquisition unit 100, used to simultaneously acquire visible light images and thermal imaging sequences of the casting surface from multiple preset angles; perform oil stain area identification and illuminance enhancement processing on the visible light images, and extract thermal radiation anomaly maps from the thermal imaging sequences; an image fusion unit 200, used to process the thermal radiation anomaly map and the enhanced visible light image respectively through a dual-branch feature extraction network, and perform adaptive fusion using an attention-based fusion method to generate an initial weighted image; a morphology reconstruction unit 300, used to filter candidate porosity regions in the initial weighted image based on the solidity; the solidity is the ratio of the region area to the convex hull area; and perform three-dimensional morphology reconstruction on the initial weighted image according to the morphological feature differences of the candidate porosity regions at different angles to generate a target detection image; and a defect output unit 400, used to locate suspected defect regions in the target detection image, locate independent defects based on the local normal convergence focus of pixels within the suspected defect regions, and output defect identification results based on the attributes and spatial distribution of each independent defect.

[0054] In one embodiment, the image acquisition unit 100 is further configured to: extract the thermal radiation intensity distribution map of the casting surface under a specific infrared band from the thermal imaging sequence, and acquire the actual thermal radiation value of each pixel in the corresponding local visible light image; calculate the theoretical thermal radiation value of each pixel in the local visible light image based on the spectral absorption data of the gray cast iron material; compare the difference between the actual thermal radiation value and the theoretical thermal radiation value, and generate a thermal radiation anomaly map.

[0055] In one embodiment, the defect output unit 400 is further configured to: extract the edge point set of the suspected defect region based on the Canny operator and contour tracking algorithm; calculate the local normal direction of each edge point and count the convergence focus of all normals within the suspected defect region; perform cluster analysis based on spatial distance on the convergence focus and group convergence points that are spatially adjacent into the same cluster; wherein each cluster represents an independent defect.

[0056] In one embodiment, the defect output unit 400 is further configured to: generate a reference sub-region centered on each independent defect; calculate the spatial distance between each pixel and the center point of each reference sub-region, the boundary length of the reference sub-region to which it belongs, and the area enclosed by the pixel and the boundary of the reference sub-region based on the suspected defect region, so as to construct an attribution weight function; and determine the independent defect to which each pixel and the reference sub-region belong based on the attribution weight function.

[0057] It is understood that the system provided in this embodiment has functions or includes modules that can be used to execute the methods described in the above method embodiments. The specific implementation can be referred to the description of the above method embodiments, and for the sake of brevity, it will not be repeated here.

[0058] The present invention also provides an electronic device including a processor and a memory, the memory being used to store computer program code, the computer program code including computer instructions, wherein when the processor executes the computer instructions, the electronic device performs a method as described in any of the above possible implementations.

[0059] The present invention also provides a computer-readable storage medium storing a computer program, the computer program including program instructions that, when executed by a processor of an electronic device, cause the processor to perform a method as described in any of the above possible implementations.

[0060] Those skilled in the art will recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementations should not be considered beyond the scope of this invention.

Claims

1. A multi-angle visual fusion detection method for porosity and crack defects on the surface of gray cast iron castings, characterized in that, The method includes: simultaneously acquiring visible light images and thermal imaging sequences of the casting surface from multiple preset angles; performing oil stain area identification and illuminance enhancement processing on the visible light images, and extracting thermal radiation anomaly maps from the thermal imaging sequences; processing the thermal radiation anomaly maps and enhanced visible light images separately through a dual-branch feature extraction network, and performing adaptive fusion using an attention-based fusion mechanism to generate an initial weighted image; in the initial weighted image, screening candidate pore regions based on the solidity value; the solidity value is the ratio of the region area to the convex hull area; reconstructing the three-dimensional morphology of the initial weighted image according to the morphological feature differences of the candidate pore regions at different angles to generate a target detection image; locating suspected defect regions in the target detection image, locating independent defects based on the local normal convergence focus of pixels within the suspected defect regions, and outputting defect identification results based on the attributes and spatial distribution of each independent defect.

2. The multi-angle visual fusion detection method for surface porosity and crack defects in gray cast iron castings according to claim 1, characterized in that, The step of extracting thermal radiation anomaly maps from thermal imaging sequences includes: extracting the thermal radiation intensity distribution map of the casting surface under a specific infrared band from the thermal imaging sequence, and acquiring the actual thermal radiation value of each pixel in the corresponding local visible light image; calculating the theoretical thermal radiation value of each pixel in the local visible light image based on the spectral absorption data of the gray cast iron material; comparing the difference between the actual thermal radiation value and the theoretical thermal radiation value to generate a thermal radiation anomaly map.

3. The multi-angle visual fusion detection method for surface porosity and crack defects in gray cast iron castings according to claim 1, characterized in that, The method of locating independent defects based on the local normal convergence focus of pixels within the suspected defect area includes: extracting the edge point set of the suspected defect area based on the Canny operator and contour tracking algorithm; calculating the local normal direction of each edge point and counting the convergence focus of all normals within the suspected defect area; performing cluster analysis based on spatial distance on the convergence focus and grouping convergence points that are spatially adjacent into the same cluster; wherein each cluster represents an independent defect.

4. The multi-angle visual fusion detection method for surface porosity and crack defects in gray cast iron castings according to claim 3, characterized in that, After performing spatial distance-based clustering analysis on the convergence focus, the method further includes: generating a reference sub-region centered on each independent defect; calculating the spatial distance between each pixel and the center point of each reference sub-region, the boundary length of the reference sub-region to which it belongs, and the area enclosed by the pixel and the boundary of the reference sub-region based on the suspected defect region, in order to construct the attribution weight function; and determining the independent defect to which each pixel and the reference sub-region belong based on the attribution weight function.

5. A multi-angle visual fusion detection system for surface porosity and crack defects in gray cast iron castings, characterized in that, The system includes: an image acquisition unit, used to simultaneously acquire visible light images and thermal imaging sequences of the casting surface from multiple preset angles; perform oil stain area identification and illuminance enhancement processing on the visible light images, and extract thermal radiation anomaly maps from the thermal imaging sequences; an image fusion unit, used to process the thermal radiation anomaly maps and enhanced visible light images separately through a dual-branch feature extraction network, and perform adaptive fusion using an attention-based fusion mechanism to generate an initial weighted image; a morphology reconstruction unit, used to filter pore candidate regions in the initial weighted image based on the solidity; the solidity is the ratio of the region area to the convex hull area; and perform three-dimensional morphology reconstruction on the initial weighted image according to the morphological feature differences of the pore candidate regions at different angles to generate a target detection image; and a defect output unit, used to locate suspected defect regions in the target detection image, locate independent defects based on the local normal convergence focus of pixels within the suspected defect regions, and output defect identification results based on the attributes and spatial distribution of each independent defect.

6. The multi-angle visual fusion detection system for surface porosity and crack defects in gray cast iron castings according to claim 5, characterized in that, The image acquisition unit is also used to: extract the thermal radiation intensity distribution map of the casting surface under a specific infrared band from the thermal imaging sequence, and acquire the actual thermal radiation value of each pixel in the corresponding local visible light image; calculate the theoretical thermal radiation value of each pixel in the local visible light image based on the spectral absorption data of the gray cast iron material; compare the difference between the actual thermal radiation value and the theoretical thermal radiation value, and generate a thermal radiation anomaly map.

7. The multi-angle visual fusion detection system for surface porosity and crack defects in gray cast iron castings according to claim 5, characterized in that, The defect output unit is also used to: extract the edge point set of the suspected defect region based on the Canny operator and contour tracking algorithm; calculate the local normal direction of each edge point and count the convergence focus of all normals inside the suspected defect region; perform cluster analysis based on spatial distance on the convergence focus and merge convergence points that are spatially close into the same cluster. Each cluster represents an independent defect.

8. The multi-angle visual fusion detection system for surface porosity and crack defects in gray cast iron castings according to claim 7, characterized in that, The defect output unit is also used to: generate a reference sub-region centered on each independent defect; and calculate the spatial distance between each pixel and the center point of each reference sub-region, the boundary length of the reference sub-region to which it belongs, and the area enclosed by the pixel and the boundary of the reference sub-region based on the suspected defect region, so as to construct the attribution weight function. Based on the attribution weight function, the independent defects to which each pixel and the reference sub-region belong are determined.

9. An electronic device, characterized in that, include: The electronic device includes a processor and a memory, the memory being used to store computer program code, the computer program code including computer instructions, wherein when the processor executes the computer instructions, the electronic device performs the multi-angle visual fusion detection method for surface porosity and crack defects of gray cast iron castings as described in any one of claims 1 to 4.

10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program, which includes program instructions that, when executed by a processor of an electronic device, cause the processor to perform the multi-angle visual fusion detection method for surface porosity and crack defects of gray cast iron castings as described in any one of claims 1 to 4.