Image detection method and system for internal air gap defects of a cable
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- CHUNHUA KUNLUN YOUJIA CABLE CO LTD
- Filing Date
- 2026-04-28
- Publication Date
- 2026-05-29
Smart Images

Figure CN122115441A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of X-ray image processing technology, and in particular to an image detection method and system for air gap defects inside cables. Background Technology
[0002] During cable production, air gap defects can easily occur in the cable's internal insulation layer when process parameters fluctuate or operations are improper. These defects can trigger partial discharge under the influence of an electric field, and over time, they can cause the cable insulation layer to age or even break down, thus posing a serious safety hazard. Therefore, detecting air gap defects inside cables is a necessary step in cable quality inspection. Currently, region growing algorithms are a commonly used technique for detecting air gap defects in cable images. This algorithm can automatically aggregate connected regions based on the similarity of pixels and is often used to segment defect targets from the background. Its basic process is as follows: first, select one or more seed points in the image, and then, with the seed point as the center, continuously merge pixels in its neighborhood that meet the preset growth criteria into the current region until no new pixels can be merged.
[0003] However, in the scenario of detecting air gap defects inside cables, the images in this scenario usually exhibit extremely low signal-to-noise ratio and contrast, and the air gap defect signal is extremely weak. However, the seed points and growth criteria of conventional region growing algorithms are highly dependent on empirical settings. This may lead to some seed points not being selected because their actual defect features are too weak, resulting in missed detection of defect areas. The growth criteria use a fixed grayscale tolerance threshold, which cannot adapt to the presence of insulation layers with uneven density, and may easily lead to over-segmentation or under-segmentation of the defect area boundary, thereby reducing the accuracy of detecting air gap defects inside cables. Summary of the Invention
[0004] To address the technical problems of conventional region growing algorithms relying solely on experience to set seed points and growth criteria, leading to missed defects and inaccurate boundary segmentation of defect regions, this invention provides an image detection method and system for air gap defects inside cables.
[0005] In a first aspect, the present invention provides an image detection method for air gap defects inside a cable, employing the following technical solution: obtaining an image of the cable to be detected using an X-ray imaging system; locating the insulation layer region in the image to be detected using a fixed segmentation template; obtaining the initial defect probability of each pixel belonging to an air gap defect based on the grayscale features and gradient features of pixels within the insulation layer region; obtaining the interference probability of each column belonging to the metal shielding layer based on the variance of the grayscale values of pixels within the column region corresponding to the metal shielding layer; obtaining the final defect probability of each pixel belonging to an air gap defect by combining the initial defect probability of each pixel belonging to an air gap defect and the interference probability of its column belonging to the metal shielding layer; and obtaining all target pixels based on the comparison result between the final defect probability and a defect probability threshold. Based on all target pixels, several candidate defect regions are obtained through a connected component labeling algorithm. The morphological defect degree of the candidate defect regions is calculated according to the circularity of the air gap defect. Combining the initial defect probability of pixels within the candidate defect regions with the distance weight of each pixel relative to the center point of its respective candidate region, the optimal probability of each pixel belonging to a seed point within the candidate defect regions is obtained. Then, the seed point with the highest optimal probability for each candidate defect region is obtained. Adaptive region growing is performed based on the seed points in the candidate defect regions to obtain the air gap defect regions inside the cable and the air gap defect evaluation results.
[0006] This method acquires images of the cable to be inspected using an X-ray imaging system, then precisely locates the insulation layer region using a fixed segmentation template, effectively eliminating interference from irrelevant structures. The initial defect probability is determined based on the grayscale and gradient features of pixels within the insulation layer region, and the final defect probability is obtained by correcting this with the column interference probability corresponding to the metal shielding layer, thus weakening the interference effect of the metal shielding layer and improving the accuracy of defect probability judgment. After screening candidate defect regions using a connected component labeling algorithm, the seed point optimization probability is calculated by comprehensively considering the circularity of the air gap defect, the initial defect probability of the pixel, and distance weights, preventing the omission of weak defect seed points. Adaptive region growth is then performed based on the optimized seed points, adapting to scenarios with uneven insulation layer density, avoiding over-segmentation and under-segmentation problems, and accurately acquiring the air gap defect region and air gap defect evaluation results inside the cable.
[0007] Preferably, the method for locating the insulation layer region in the image to be inspected using a fixed segmentation template includes: selecting several standard cable images to be inspected without air gap defects to ensure that the insulation layer structure is complete and its position is uniform; determining the fixed boundary coordinates of the insulation layer in the image by manual annotation; constructing a binary segmentation template based on these coordinates; setting the insulation layer region as the effective pixel area and assigning a pixel value of 1; setting the core wire, main insulation, water-blocking buffer layer, and metal shielding layer as the invalid pixel area and assigning a pixel value of 0, thus forming a fixed segmentation template that only defines the insulation layer region; applying this template to multiple standard cable images to be inspected to verify its segmentation accuracy and ensure that it is compatible with images of the same type of cable; and subsequently, directly calling this template to match the input image to be inspected to locate the insulation layer region.
[0008] Preferably, obtaining the initial defect probability that each pixel belongs to an air gap defect based on the grayscale features and gradient features of pixels within the insulating layer region includes: ;in, Pixels within the insulating layer area The initial defect probability belonging to air gap defects; These are the maximum grayscale value and the maximum gradient magnitude of the pixel within the insulating layer region, respectively. Pixels within the insulating layer area grayscale value; Pixels within the insulating layer area The gradient magnitude.
[0009] This method integrates the grayscale and gradient features of pixels within the insulating layer region, using the maximum grayscale value and maximum gradient amplitude of pixels within the region as reference benchmarks. It quantifies the difference between the pixel's own grayscale value and the maximum grayscale value, and the difference between its own gradient amplitude and the maximum gradient amplitude, and performs fusion calculations. This method can comprehensively and accurately capture the unique performance of air gap defects in grayscale distribution and edge characteristics, effectively distinguishing air gap defect pixels from normal insulating layer pixels. This reliably obtains the initial defect probability of each pixel belonging to an air gap defect, laying a solid foundation for subsequent calculation of the final defect probability and accurate identification of defect areas.
[0010] Preferably, obtaining the interference probability of each column belonging to the metal shielding layer based on the variance of the grayscale values of pixels within the column region corresponding to the metal shielding layer includes: ;in, It is the first in the insulation layer region The probability of interference belonging to the metal shielding layer; It is the maximum variance of the grayscale values of all corresponding pixels in the insulating layer area; It is the minimum variance of the grayscale values of all corresponding pixels in the insulating layer area; It is the first in the insulation layer area The variance of the grayscale values of all pixels in the column; It is a constant to prevent the denominator from being zero; The coordinate index of each column within the insulation layer region is determined by taking the top-left pixel of the insulation layer region as the origin and assigning positive integer numbers to each column horizontally to the right, denoted as the [number]. List.
[0011] This method focuses on the variance of pixel grayscale values within the column region corresponding to the metal shielding layer. Using the maximum and minimum variances of pixel grayscale values across all columns within the region as reference benchmarks, and incorporating a constant to prevent zero denominators and avoid anomalies during calculation, it quantifies the difference between the variance of grayscale values in each column and the maximum and minimum variances, and performs normalization operations. This accurately captures the unique characteristics of the uniformity of grayscale distribution in the column containing the metal shielding layer, reliably distinguishing columns susceptible to interference from the metal shielding layer from normal insulation layer columns. This accurately obtains the interference probability of each column belonging to the metal shielding layer, providing a scientific basis for subsequently fusing initial defect probabilities to obtain the final defect probability. It effectively weakens the interference of the metal shielding layer on air gap defect identification, reduces the risk of misjudgment due to interference, and further improves the accuracy of defect detection.
[0012] Preferably, the step of combining the initial defect probability of each pixel belonging to an air gap defect and the interference probability of its column belonging to the metal shielding layer to obtain the final defect probability of each pixel belonging to an air gap defect includes: ;in, It is a pixel. The final defect probability belonging to air gap defects; It is a pixel. The initial defect probability belonging to air gap defects; It is a pixel. The column containing the interference probability of the metal shielding layer is represented by a value for each pixel. The first Interference probability of the corresponding metal shielding layer .
[0013] This method fuses the initial defect probability of each pixel belonging to an air gap defect with the interference probability of the column containing that pixel belonging to the metal shielding layer. Based on the initial defect probability, it uses the interference probability of the column to make targeted corrections. By deducting the influence weight of interference factors, it can effectively retain the effective probability information of real air gap defect pixels, while significantly weakening the interference effect of the column containing the metal shielding layer on the defect judgment of pixels. This avoids misjudging normal insulating layer pixels affected by the metal shielding layer as defect pixels, thus accurately obtaining the final defect probability of each pixel belonging to an air gap defect. This provides a reliable basis for the accurate selection of subsequent target pixels, further reducing the risk of misjudgment in defect identification and improving the accuracy and reliability of air gap defect detection.
[0014] Preferably, obtaining all target pixels based on the comparison result of the final defect probability and the defect probability threshold includes: setting the defect probability threshold. When the final defect probability of a pixel belonging to an air gap defect is greater than or equal to the defect probability threshold. When that happens, the pixel is classified as the target pixel.
[0015] Preferably, the step of calculating the morphological defect degree of the candidate defect region based on the roundness of the air gap defect includes: ;in, It is a defect candidate region The degree of morphological defects; It is a defect candidate region The area; It is a defect candidate region circumference; It is an index of the defect candidate region.
[0016] This method focuses on the circularity of air gap defects, using the area and perimeter of candidate defect regions as the core calculation basis. Through quantitative calculation, it obtains the degree of morphological defects in the region, accurately capturing the unique advantage of real air gap defects in morphological regularity. It effectively distinguishes near-circular real air gap defect candidate regions from irregular non-defect interference regions, providing a scientific morphological reference for the subsequent calculation of seed point selection probability. This avoids misjudging non-defect interference regions as air gap defect regions, further improving the targeting and rationality of seed point selection, and providing strong support for subsequent adaptive region growth and accurate defect region identification.
[0017] Preferably, the method for obtaining the preferred probability that each pixel within the defect candidate region belongs to a seed point includes: ;in, It is a defect candidate region pixels in The probability of being a preferred seed point; It is a pixel. The initial defect probability; It is a defect candidate region The degree of morphological defects; It is a pixel. Relative to the defect candidate region The distance weight of the center point; These are the first weighted index, the second weighted index, and the third weighted index, which must meet the following conditions: ,and .
[0018] This method comprehensively integrates the initial defect probability of pixels within a defect candidate region, the degree of morphological defect in the region, and the distance weight of the pixel relative to the center point of the region. It also sets a reasonable weight index that prioritizes core factors over morphological factors, morphological factors over distance factors, and the sum of all three is equal. This approach highlights the core criterion of whether a pixel itself is an air gap defect, while also considering whether the morphology of the region matches the characteristics of air gap defects and the rationality of the pixel's position within the region. It comprehensively and selectively quantifies the suitability of each pixel as a seed point, effectively selecting the seed points that best represent real air gap defects. This avoids missing seed points due to weak defect features or misselecting seed points in non-defect areas, providing reliable support for the accurate implementation of subsequent adaptive region growth and further improving the accuracy and specificity of air gap defect region identification.
[0019] Preferably, the method for obtaining the air gap defect assessment results includes: when the total area of the air gap defect region inside the cable accounts for 50% or more of the total area of the insulation layer, the air gap defect inside the cable is considered to be at the severe defect level and needs to be scrapped; when the total area of the air gap defect region inside the cable accounts for between 20% and 50% of the total area of the insulation layer, the air gap defect inside the cable is considered to be at the medium defect level and needs to be stopped immediately for targeted repair; when the total area of the air gap defect region inside the cable accounts for less than 20% of the total area of the insulation layer, the air gap defect inside the cable is considered to be at the minor defect level and needs to be returned to the factory for local repair and re-inspection.
[0020] Secondly, the present invention provides an image detection system for internal air gap defects in cables, comprising: a processor and a memory, wherein the memory stores computer program instructions, and when the computer program instructions are executed by the processor, the above-mentioned image detection method for internal air gap defects in cables is implemented.
[0021] By adopting the above technical solution, the image detection method for internal air gap defects in cables is generated into a computer program and stored in a memory for loading and execution by a processor. This allows for the creation of a terminal device based on the memory and processor, facilitating its use.
[0022] The beneficial effects of this invention are as follows: After acquiring the image of the cable to be inspected through an X-ray imaging system, the insulation layer area is accurately located using a fixed segmentation template, effectively eliminating interference from irrelevant structures; the initial defect probability is obtained based on the grayscale and gradient features of pixels within the insulation layer area, and the final defect probability is obtained by combining the column interference probability corresponding to the metal shielding layer, significantly reducing the interference of the metal shielding layer on air gap defect identification and improving the accuracy of defect probability judgment; after screening candidate defect areas through a connected component labeling algorithm, the seed point optimization probability is calculated by comprehensively considering the circularity of the air gap defect, the initial defect probability of the pixel, and the distance weight, ensuring the rationality and targeting of seed point selection and avoiding the omission of seed points with weak defect features; adaptive region growth is performed based on the optimized seed points, without relying on experience to set fixed growth criteria, effectively adapting to the situation of uneven insulation layer density, reducing the problem of over-segmentation or under-segmentation of defect boundaries, and finally accurately obtaining the air gap defect area and air gap defect evaluation results inside the cable, greatly improving the accuracy and reliability of air gap defect detection, and providing strong support for the safe operation and targeted maintenance of cables. Attached Figure Description
[0023] Figure 1 This is a flowchart illustrating an image detection method for internal air gap defects in a cable according to the present invention.
[0024] Figure 2 This is a schematic illustration of the image to be detected after preprocessing, as part of an image detection method for internal air gap defects in cables according to the present invention.
[0025] Figure 3 This is a schematic diagram of the insulation layer region of an image detection method for internal air gap defects in a cable according to the present invention.
[0026] Figure 4 This is a schematic diagram illustrating the air gap defect region of an image detection method for internal air gap defects in cables according to the present invention. Detailed Implementation
[0027] 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, not all, of the embodiments of the present invention. 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.
[0028] The specific embodiments of the present invention will now be described in detail with reference to the accompanying drawings.
[0029] This invention discloses an image detection method for internal air gap defects in cables, referring to... Figure 1 This includes steps S1 to S4: S1. Obtain a grayscale image of the cable to be inspected using an X-ray imaging system, and perform preprocessing to obtain a preprocessed image of the cable to be inspected.
[0030] It should be noted that when using an X-ray imaging system to acquire grayscale images of the cable under test, the uneven distribution of beam intensity in the X-ray imaging system will cause differences in brightness in the grayscale image. In addition, the long-term operation of internal electronic components will cause random noise in the grayscale image. If the grayscale image is used directly for subsequent calculations, some noise will be mistakenly identified as defect pixels, which will lead to a serious overestimation of the final defect detection result of the cable under test and affect the accuracy of detecting internal air gap defects in the cable.
[0031] Based on this, this step first uses histogram equalization to correct the difference in brightness of the grayscale image caused by uneven distribution of cable strength, thereby enhancing the grayscale difference between air gap defects and normal areas and reducing the difficulty of subsequent identification. Then, a Gaussian filtering algorithm is used to specifically remove random noise in the grayscale image while preserving the details of the internal structure of the cable, resulting in a preprocessed image of the cable to be inspected. The histogram equalization method and the Gaussian filtering algorithm are existing technologies and will not be described in detail here.
[0032] Please see Figure 2 , Figure 2 The image schematically illustrates the preprocessed image to be inspected. As can be seen from the image, the preprocessed image has effectively separated the cable insulation layer area, removed interference from irrelevant structures such as the metal shielding layer, improved the uniformity of grayscale distribution inside the insulation layer, and preserved the grayscale differences of minor anomalies such as air gap defects. This provides a clear and stable image basis for subsequent initial defect probability calculation, interference probability correction, and seed point selection, making it easier to accurately identify the air gap defect features inside the insulation layer.
[0033] It should be noted that when calculating the interference probability of each column belonging to the metal shielding layer in subsequent steps, it is necessary to ensure that the metal shielding layer is roughly vertical in the image, that is, parallel to the column direction; if the image to be detected is rotated or tilted due to cable placement or imaging system installation, rotation correction is required before performing subsequent steps.
[0034] Specifically, the edge line of the metal shielding layer in the image is extracted using the Hough line detection method. The angle between this line and the vertical direction is calculated, and the image to be detected is rotated in the opposite direction by this angle, so that the edge of the metal shielding layer is basically parallel to the column direction of the image. After rotation, invalid pixels at the boundary may be introduced, which are processed by image edge filling, such as mirror filling or constant filling. If the metal shielding layer in the image is already basically vertical, that is, the angle is less than a preset threshold, such as 1°, the rotation correction step can be skipped. Through the above processing, it is ensured that the statistical direction of the "column" in the interference probability relationship is consistent with the actual extension direction of the metal shielding layer, thereby ensuring the physical validity of the relationship.
[0035] S2. Locate the insulating layer region; based on the grayscale and gradient features of the pixels within the insulating layer region, obtain the initial defect probability of each pixel belonging to the air gap defect; based on the variance of the grayscale values of the pixels in the column region corresponding to the metal shielding layer, obtain the interference probability of each column belonging to the metal shielding layer; combined with the initial defect probability of each pixel, obtain the final defect probability of each pixel belonging to the air gap defect, and obtain all target pixels.
[0036] It should be noted that in the image to be tested, the uniform rectangular area in the middle is the core wire of the cable to be tested, the white straight lines on the upper and lower sides of the core wire are the main insulation of the cable to be tested, the black raised areas at the top and bottom of the image to be tested are the water-blocking buffer layer, and the white recessed area adjacent to the water-blocking buffer layer is the metal shielding layer of the cable to be tested. The air gap defect of the cable usually manifests as a small gap inside the insulation layer between the main insulation and the water-blocking buffer layer, which is characterized by light gray value and inconsistent size. In addition, due to the influence of the varying thickness of the insulation layer, the air gap defect has the characteristics of chaotic internal gray value and blurred edges.
[0037] Specifically, since most air gap defects are located in the insulation layer, after extracting this area, only the pixels within it are analyzed. This can effectively eliminate interference from irrelevant structures such as the core wire, main insulation, water-blocking buffer layer, and metal shielding layer. Based on this understanding, this step first locates the insulation layer area. The specific operation is as follows: Since the image size and the position of the insulation layer are fixed, the insulation layer area can be directly and accurately extracted by constructing a fixed segmentation template.
[0038] Furthermore, the method for constructing the fixed segmentation template is as follows: First, select several standard cable images without air gap defects to ensure that the insulation layer structure in these images is complete and the position is uniform. Determine the fixed boundary coordinates of the insulation layer in the image by manual annotation, such as the coordinates of the upper left corner start point and the lower right corner end point. Then, construct a binary segmentation template based on the fixed boundary coordinates. Set the determined insulation layer area as the effective pixel area and assign a pixel value of 1, and set irrelevant structures such as the core wire, main insulation, water-blocking buffer layer, and metal shielding layer as the invalid pixel area and assign a pixel value of 0, forming a fixed segmentation template that only defines the insulation layer area. Next, apply the fixed segmentation template to multiple standard cable images to verify the accuracy of the insulation layer area segmentation and ensure that it can be adapted to the images of the same type of cable. Finally, store the fixed segmentation template. During subsequent inspections, directly call the template and match it with the input image to quickly segment the insulation layer area.
[0039] Furthermore, for each pixel within the insulating layer region, the grayscale value of each pixel is obtained. For example, the pixels within the insulating layer region... The grayscale value is denoted as The Sobel operator is used to obtain the gradient magnitude of each pixel within the insulating layer region. For example, the gradient magnitude of each pixel within the insulating layer region is... The gradient magnitude is denoted as ; and then obtain the maximum grayscale value of the pixel in the insulating layer region, denoted as And the maximum gradient magnitude of the pixels within the insulating layer region, denoted as To avoid the denominator being 0 in subsequent calculations, ... and Perform non-zero processing; if the calculated value is zero... If the value is 0, then it is assigned a preset small constant value; if the calculated value is... If the value is 0, it is also assigned the value of this preset infinitesimal constant; the preset infinitesimal constant takes the value of 0. The dimensionless constants within the interval are preferably adapted based on the grayscale quantization depth of the cable X-ray image to be inspected, with 10 being the preferred value for an 8-bit grayscale image. -4 And in the same batch of tests, and Use the same value.
[0040] Please see Figure 3 , Figure 3The diagram illustrates the insulation layer region. As shown, after region extraction and segmentation, the cable insulation layer region has been accurately located and separated, effectively eliminating interference from non-target structures such as the metal shielding layer and outer sheath. The grayscale distribution and micro-air gap defect characteristics inside the insulation layer are completely preserved, providing a clean and focused target area for subsequent pixel-level initial defect probability calculation, interference correction, and defect area extraction. This ensures that the detection process is carried out only inside the insulation layer, avoiding the impact of non-target areas on detection accuracy.
[0041] Based on the grayscale and gradient features of pixels, the initial defect probability of each pixel within the insulating layer region belonging to an air gap defect is obtained. For example, the following relation can be used for analysis: ; in, Pixels within the insulating layer area The initial defect probability belonging to air gap defects; These are the maximum grayscale value and the maximum gradient magnitude of the pixel within the insulating layer region, respectively. Pixels within the insulating layer area grayscale value; Pixels within the insulating layer area The gradient magnitude; when the maximum gray value of a pixel within the insulating layer region is equal to the pixel's gradient magnitude; The greater the difference in grayscale values, the more pixels are in the insulating layer area. The smaller the gradient magnitude, the more pixels in the insulating layer area... The higher the initial defect probability of an air gap defect, the lower the probability of an air gap defect, and vice versa. This allows us to obtain the initial defect probability of all pixels within the insulating layer region.
[0042] Furthermore, pixels The physical meaning of the initial defect probability belonging to air gap defects is: considering that the gray value of the air gap defect region is generally low, the ratio is used to determine the initial defect probability. This reflects the likelihood that a pixel belongs to an air gap defect from the perspective of grayscale values alone. Considering that air gap defects, due to their physical formation, usually have blurred edges rather than the steep edges of sharp noise points, the gradient magnitude within and around the air gap defect region is relatively small. The more the gradient characteristics of the pixels match the characteristics of the blurred edges of the air gap defects, the more robust and reliable the basis for subsequent seed point selection and region growth becomes.
[0043] It should be noted that, , First, the pixel set of the insulating layer region needs to be normalized to its maximum value before being substituted into the relational formula for calculation, ensuring that the initial defect probability of different detection images has a uniform probability quantification scale. Since most areas inside the insulating layer region are normal insulating materials, their pixels do not belong to air gap defects. If all pixels in the insulating layer are directly selected as seed points and grown in subsequent processes, a large amount of unnecessary calculation will be introduced, and the accuracy of defect boundaries and the execution efficiency of the algorithm may be reduced due to the probability interference of pixels in normal areas. Therefore, after obtaining the initial defect probability, preliminary screening is required to focus on pixels that may actually have defects, and these pixels will be used as target pixels for subsequent analysis.
[0044] Specifically, based on the initial defect probability corresponding to all pixels within the insulation layer region, the pixels within the insulation layer are initially screened to obtain target pixels. The specific operation is as follows: taking the top-left pixel in the insulation layer region as the origin, and horizontally to the right as... The axis, vertically downwards is Construct a rectangular coordinate system using axes; denot each column sequentially as the [number]th [axis]. Columns, pixels The column is denoted as the first. The column has an interference probability of 1 / 2 that corresponds to the metal shielding layer. abbreviated as .
[0045] It should be noted that the metal shielding layer in the insulating layer region, such as the aluminum sheath, appears as a bright band with high grayscale value in the X-ray image. Due to its dense and uniform structure, the grayscale value variance of the pixels in its column is small, meaning the grayscale distribution is concentrated. In contrast, air gap defects are low-density areas, appearing as dark spots with low grayscale value in the image. Due to their irregular internal structure, the grayscale value variance of the pixels in their column is large, meaning the grayscale distribution is chaotic. While the grayscale characteristics of the two are significantly different, the high-brightness edges of the metal shielding layer may cause a diffusion effect after image preprocessing, such as histogram equalization, or may lead to false edges in subsequent gradient calculations due to their high brightness contrast, thus interfering with the identification of air gap defects in the adjacent field of view. Therefore, it is necessary to calculate the interference probability of each column belonging to the metal shielding layer. The physical meaning is that when the grayscale value variance of a certain column of pixels is extremely small and the corresponding structure is uniform, it is highly likely that it belongs to the bright band of the metal shielding layer, and the pixels in that column should not be misjudged as low-brightness air gap defects.
[0046] Furthermore, let's analyze this using the insulation layer region as an example: The pixels in each row of the axis are the starting point, and along... Traverse the pixels along the axis direction; for example, within the insulating layer region, the first pixel... The variance of the grayscale values of all pixels in the column is denoted as . Using the same method, the maximum variance of the grayscale values of all corresponding pixels within the insulating layer region is obtained, denoted as . ; Obtain the minimum variance of the grayscale values of all corresponding pixels within the insulating layer region, denoted as Then the first [unit] in the insulating layer region is obtained. The interference probability belonging to the metal shielding layer can be found in the following formula: ; in, It is the first in the insulation layer region The probability of interference belonging to the metal shielding layer; It is the maximum variance of the grayscale values of all corresponding pixels in the insulating layer area; It is the minimum variance of the grayscale values of all corresponding pixels in the insulating layer area; It is the first in the insulation layer area The variance of the grayscale values of all pixels in the column; It is a constant to prevent the denominator from being zero, thus avoiding a denominator of zero. For example, The range of values is arrive The contrast can be adjusted based on the grayscale contrast of the X-ray image of the cable insulation layer; the lower the contrast, the better. Take the largest possible value to avoid calculation overflow; when the first value in the insulation layer region... The smaller the variance of the grayscale values of all pixels in the column, the better. The higher the probability of interference from the metal shielding layer, the higher the probability of interference from the first column. The column may belong to a metal shielding layer.
[0047] Furthermore, the interference probability of each column belonging to the metal shielding layer in the insulation layer region is obtained.
[0048] It should be noted that, due to the uniform structure of the metal shielding layer, the gray value distribution of its column is relatively concentrated, meaning the variance of the pixel gray value is small; while the structure of the air gap defect area is more complex, and the gray value distribution of its column is more chaotic, meaning the variance of the pixel gray value is larger. Therefore, the two can be distinguished by the variance of the pixel gray value in each column.
[0049] Furthermore, by combining the initial defect probability of a pixel with the interference probability of its column belonging to the metal shielding layer, the final defect probability of each pixel belonging to the air gap defect is obtained. Taking this as an example, we can obtain the pixel points. The interference probability of the column belonging to the metal shielding layer is denoted as ; Obtain pixels The final defect probability belonging to air gap defects can be found in the following formula: ; in, It is a pixel. The final defect probability belonging to air gap defects has the following physical meaning: if the column containing the pixel has a high interference probability belonging to the metal shielding layer, then the column containing the pixel may be a metal shielding layer. Suppress its final defect probability; conversely, if the column where the pixel is located has a low interference probability belonging to the metal shielding layer, then the column where the pixel is located may be an air gap region, and thus retain it. The original weights; It is a pixel. The initial defect probability belonging to air gap defects; It is a pixel. The column containing the interference probability of the metal shielding layer; when the pixel The higher the probability of an initial defect belonging to an air gap defect, the higher the pixel count. The smaller the interference probability of a column belonging to a metal shielding layer, the smaller the pixel. The higher the probability of a pixel belonging to an air gap defect, the lower the probability of a pixel belonging to an air gap defect; obtain the final defect probability of all pixels belonging to air gap defects.
[0050] Specifically, based on the comparison between the final defect probability of a pixel belonging to an air gap defect and the defect probability threshold, pixels are divided into target pixels and non-target pixels. The specific method is as follows: Set the defect probability threshold. When the final defect probability of a pixel belonging to an air gap defect is greater than or equal to the defect probability threshold. When the pixel is classified as a target pixel, the final defect probability of the pixel belonging to an air gap defect is less than the defect probability threshold. When this happens, the pixel is classified as a non-target pixel; the defect probability threshold can be set according to actual needs and must meet the following conditions: The embodiments of the present invention are not limited in many ways, for example .
[0051] All target pixels are further screened to obtain subsequent seed point selection and region growing processes; non-target pixels are excluded and do not participate in subsequent operations.
[0052] S3. Based on all target pixels, obtain several defect candidate regions through the connected component labeling algorithm; calculate the morphological defect degree of each defect candidate region according to the circularity of the air gap defect, and combine the initial defect probability and distance weight of the pixels in each defect candidate region to obtain the optimal probability of the pixels in each defect candidate region belonging to the seed point, and obtain the seed point corresponding to each defect candidate region accordingly.
[0053] It should be noted that although the initial defect probability can effectively distinguish between defects and normal insulating materials, there are still limitations to selecting seed points based solely on this probability. This is because: Firstly, some microstructures may exhibit a high initial defect probability, but they do not possess the typical and irregular circular shape of air gap defects. By calculating the degree of morphological defects, the authenticity of candidate regions can be verified, and false regions that clearly do not conform to the defect morphology can be filtered out. Secondly, using a pixel located at the edge of a candidate region as a seed point carries potential risks: because region growth is an iterative process, the position of the initial seed point will affect the growth direction and result. Seed points located at the edge may be closer to the background, i.e., normal insulating material, and are easily interfered with by background pixels too early during growth, resulting in insufficient growth and failure to completely cover the entire defect region. Conversely, a seed point located at the geometric center of the candidate region has a more uniform environment of potential defects. Starting growth from this point allows for more stable and symmetrical expansion outwards, thus making it more likely to accurately reconstruct the true and complete boundary of the defect.
[0054] Specifically, based on a binary mask constructed from all target pixels, an 8-connected component labeling algorithm is used to obtain the total number of pixels. There are connected defect candidate regions, and the index of the defect candidate region is denoted as . ,in and The integer value is used because air gap defects are physically approximated as spherical or ellipsoidal bubbles, and they typically appear as irregular regions with high roundness on two-dimensional slices. Therefore, roundness is used as the core measure of the degree of morphological defects, with defect candidate regions as the basis for evaluation. Taking this as an example, we can obtain candidate defect regions. The total number of pixels is used as a candidate region for defects. The area is denoted as ; Obtain defect candidate regions The total number of pixels at the edge is used as a candidate region for defects. The perimeter is denoted as Obtain defect candidate regions The degree of morphological defects can be specifically referred to in the following formula: ; in, It is a defect candidate region The physical meaning of the morphological defect degree is as follows: Circularity measures how close a region is to a circle. A perfect circle has a circularity of 1. Air gap defects are usually irregular but tend to be circular, so their morphological defect degree will be significantly greater than 0, for example, above 0.5. The morphological defect degree of non-air gap regions that do not tend to be circular will be close to 0. When the morphological defect degree of a defect candidate region is higher, it indicates that the defect candidate region is more consistent with the characteristics of an air gap defect in terms of morphology. It is a defect candidate region The area; It is a defect candidate region The perimeter; thus obtaining the morphological defect degree of all defect candidate regions.
[0055] It should be noted that in the morphological quantification of defects such as bubbles or air gaps in industrial images, the core idea is to use circularity to quantify the circularity of the defect. The standard circularity calculation formula is a well-known technique in the field of morphology; a perfect circle has a circularity of 1, while irregular areas have a circularity close to 0. In this embodiment, the defect candidate region... The perimeter is calculated using the number of boundary pixels.
[0056] Furthermore, using defect candidate regions For example, to obtain the defect candidate region The minimum bounding rectangle is used as the intersection of its diagonals as the candidate defect region. The center point; the candidate defect region can be obtained based on the rectangular coordinate system. The coordinates of each pixel and its center point are used to further calculate the defect candidate region. Each pixel and defect candidate region The Euclidean distance between the center points is calculated, and the obtained Euclidean distance is subjected to inverse minima-normalization. The normalized result is then used as a candidate region for defects. Each pixel in the image has its own distance weight. For example, the distance weight of each pixel is... Relative to the defect candidate region The distance weight of the center point is denoted as Among them, the inverse normalization of maximum and minimum values is a well-known technique and will not be elaborated here.
[0057] It should be noted that the core purpose of performing maximum-minimum inverse normalization on the Euclidean distance from the pixel to the center point within the defect candidate region is to map the original distance value to a dimensionless range of 0 to 1, and to achieve the quantization effect that the closer the pixel is to the center point, the larger the corresponding distance weight value. This makes the magnitude of the distance weight positively correlated with the suitability of the pixel as a seed point, and ultimately provides a quantitative index that meets the requirements of the center pixel of the priority region for calculating the seed point selection probability. Among these, maximum-minimum inverse normalization is an existing technology and will not be elaborated here.
[0058] Specifically, for each pixel in the defect candidate region, its probability of being selected as a seed point is determined by three parts: the initial defect probability of the pixel, the degree of morphological defect in the defect candidate region where the pixel is located, and the distance weight of the pixel relative to the center point of the defect candidate region. Taking this as an example, we can obtain candidate defect regions. pixels in The probability of a point being a preferred seed point can be found in the following formula: ; in, It is a defect candidate region pixels in The probability of being a preferred seed point; It is a pixel. The initial defect probability; It is a defect candidate region The degree of morphological defects; It is a pixel. Relative to the defect candidate region The distance weight to the center point is specifically the result of inverse normalization of the Euclidean distance from the pixel to the region center point, i.e., the closer the distance, the higher the weight. The larger the value, the range of values is 0 to 1; These are the first weighted index, the second weighted index, and the third weighted index, used for adjustment. The relative importance of something needs to meet the following conditions: ,and Exemplary .
[0059] It should be noted that the initial defect probability of a pixel reflects whether the pixel itself conforms to the core features of an air gap defect, namely, a small grayscale value and blurred edges. This is the basic feature for judging whether a pixel is an air gap defect. If the initial defect probability of a pixel is low and does not conform to the core features of an air gap defect, even if the shape and distance weight of the defect candidate region are good, it is difficult to become a reliable seed point. Therefore, the initial defect probability of the pixel is used as the core judgment criterion, and the corresponding first weight index should be the largest. The morphological defect degree of the defect candidate region is a verification of whether the region is a real air gap defect. Even if some pixels in the region do not conform to the morphological defect, they may be interference structures. Therefore, the morphological defect degree of the defect candidate region is used as a secondary core judgment criterion, and the corresponding second weight index is smaller than the first weight index. The optimization of the seed point position based on the distance weight of the pixel, that is, prioritizing the selection of the center pixel of the region, aims to reduce background interference during the growth process. However, this is an auxiliary adjustment under the premise that the pixel already conforms to the defect features and the shape of the defect candidate region is effective. Even if the position is slightly off the center, as long as the pixel conforms to the defect features and the shape of the defect candidate region is effective, it can still be used as a seed point. Therefore, the corresponding third weight index is the smallest.
[0060] When pixel The higher the initial defect probability, the larger the defect candidate region. The greater the degree of morphological defects, the more pixels... Relative to the defect candidate region When the distance weight of the center point is larger, the defect candidate region pixels in The higher the probability of being a seed point, the better.
[0061] Furthermore, defect candidate regions are obtained. The optimal probability of each pixel belonging to a seed point is selected; then the seed point is determined according to the following rules: if the defect candidate region If the total number of pixels is greater than or equal to 4, then all pixels with a preferred probability greater than or equal to its third quartile are used as seed points; if the defect candidate region If the total number of pixels is greater than or equal to 2 and less than 4, then the pixel with the highest probability of being selected is chosen as the seed point; if the defect candidate region... If the total number of pixels is equal to 1, then the unique pixel is directly used as the seed point. Through the above rules, it is ensured that even very small defect candidate areas can obtain effective seed points, avoiding missed detections, and thus obtaining the seed points corresponding to each defect candidate area. 2 and 4 are exemplary values and can be adjusted according to actual needs.
[0062] S4. Adaptive region growth is performed based on the seed points in the defect candidate region to obtain the air gap defect region and air gap defect evaluation results inside the cable.
[0063] It should be noted that the reliability of the seed point directly affects the growth result. The selected seed points have been verified by initial defect probability, morphological defect degree and distance weight. They have the characteristics of conforming to the air gap, typical morphology of the region, and location close to the center of the region, which lays the foundation for accurate growth. Therefore, based on the high reliability of the seed points, this step designs an adaptive growth criterion that fits the air gap characteristics, achieves accurate expansion by dynamically matching regional characteristics, and outputs defect evaluation results by combining post-processing and quantitative analysis.
[0064] Specifically, for each defect candidate region, its set of seed points is used as the initial core to construct an initial growth region containing all seed points. At the same time, the key features of this initial region are calculated and saved. These features are all extracted based on the attributes of the seed points, including: the average gray value, gray standard deviation, average gradient value, and average local gray variance of all seed points in the initial growth region. These key features are used as the benchmark for subsequent growth. The average local gray variance of the seed points is obtained by calculating the gray variance of the 3×3 neighborhood of each seed point and then taking the average of the corresponding variances of all seed points.
[0065] It should be noted that the average gray value of the seed point reflects the typical gray level of the air gap within the defect candidate region; the gray standard deviation of the seed point reflects the degree of gray disorder among the seed points within the defect candidate region; since the edge of the air gap defect is blurred, the average gradient value of the seed point can be used as a benchmark reference for the blurred edge feature of the air gap; the average local gray variance of the seed point can further quantify the degree of gray disorder in its core region.
[0066] Furthermore, to avoid the limitations of fixed thresholds, feature similarity is used to determine whether neighboring pixels of the initial growth region belong to air gap defects. Specifically, for unincluded pixels around the current growth region, the matching degree between the pixel and the current growth region is measured from three dimensions: first, the closeness of the pixel's gray value to the average gray value of the current growth region, which matches the characteristic of air gap defects having small gray values; second, the closeness of the pixel's gradient value to the average gradient value of the current growth region, which matches the characteristic of air gap defects having blurred edges; and third, the closeness of the pixel's 3×3 neighborhood gray value variance to the average local gray value variance of the current growth region, which matches the characteristic of chaotic gray values inside air gap defects. The matching degree of these three dimensions is weighted and combined into a feature similarity.
[0067] Specifically, let the current growth region be... Its key feature is: average gray value Average gradient value Local grayscale variance mean For the neighboring pixels to be judged Its grayscale value The gradient magnitude is ,That The neighborhood gray variance is Then the pixel With growth area Feature similarity is calculated using the following formula: ; in, Let be the weighting coefficient, satisfying For example, it can be set to , , , These are the grayscale matching degree, gradient matching degree, and local variance matching degree, calculated using a Gaussian function, with a range of [missing value]. : ; ; ; in, Growth areas The standard deviations of grayscale, gradient, and local grayscale variance are used to control the matching sensitivity of each feature. When any value in the set is 0, it is assigned a preset minimum constant. ,For example To avoid division by zero errors; when Greater than the preset threshold For example, At that time, the pixel points The closer the similarity of this feature is to 1, the more the pixel matches the features of the current growth region, and the more likely it is to belong to an air gap defect.
[0068] Specifically, during the iterative growth process, neighboring pixels whose feature similarity reaches a preset threshold are included in the current growth region each time, and the key features of the region are updated in real time, including the new average gray value, gray standard deviation, average gradient value, and average local gray variance. This ensures that subsequent growth judgments are always based on the latest region features and adapt to the differences in gray distribution caused by uneven insulation layer thickness inside the air gap. This process is repeated until no new pixels around the current growth region meet the preset threshold for feature similarity. At this point, growth stops, and the complete growth region corresponding to the candidate defect region is obtained.
[0069] Furthermore, post-processing is performed on all growth regions: if the growth regions of different defect candidate regions overlap and the number of overlapping pixels exceeds 10% of the area of any region, they are determined to be the same air gap defect and merged into a single region; regions with an area smaller than a preset minimum threshold, such as 5 pixels based on the minimum air gap size in cable manufacturing, are removed to eliminate noise interference; the boundaries of the retained regions are optimized through morphological closing operations, filling the internal holes and smoothing the edges to make them more in line with the actual physical shape of the air gap, and finally the air gap defect region inside the cable is obtained.
[0070] Specifically, the output includes the assessment results of air gap defects inside the cable, including: the location information of the air gap defect area inside the cable, and the total number of pixels in the air gap defect area as its corresponding area, and the assessment results are given: For example, when the total area of the air gap defect area inside the cable accounts for 50% or more of the total area of the insulation layer, the air gap defect has seriously damaged the integrity of the insulation layer, which is very likely to cause partial discharge and lead to insulation breakdown. The air gap defect inside the cable is considered to be at the severe defect level and needs to be scrapped; when the total area of the air gap defect area inside the cable accounts for 20% to 50% of the total area of the insulation layer, the structural integrity of the insulation layer is damaged, and there is a potential risk of partial discharge and accelerated insulation aging. The air gap defect inside the cable is considered to be at the medium defect level and needs to be stopped immediately for targeted repair; when the total area of the air gap defect area inside the cable accounts for less than 20% of the total area of the insulation layer, the core insulation performance of the insulation layer is not significantly affected, the potential risk is low, and the air gap defect inside the cable is considered to be at the minor defect level and needs to be arranged to return to the factory for local repair and re-inspection.
[0071] Please see Figure 4 , Figure 4 The diagram illustrates the air gap defect region. As shown in the figure, after initial defect probability calculation and interference correction, the air gap defect region inside the cable insulation layer has been accurately identified and marked. The air gap defect is presented as a low-grayscale, near-circular feature, which is clearly distinguishable from the normal area of the insulation layer. At the same time, it effectively eliminates misjudgments from interference sources such as the metal shielding layer. The location, shape, and distribution of the defect region are completely preserved, providing a reliable candidate region basis for subsequent seed point selection, region growth, and defect degree quantification.
[0072] This invention also discloses an image detection system for internal air gap defects in cables, including a processor and a memory. The memory stores computer program instructions, which, when executed by the processor, implement an image detection method for internal air gap defects in cables according to the present invention.
[0073] The system also includes other components well known to those skilled in the art, such as communication buses and communication interfaces, the settings and functions of which are known in the art and will not be described in detail here.
Claims
1. An image detection method for internal air gap defects in cables, characterized in that, include: An image of the cable to be inspected is obtained using an X-ray imaging system; the insulation layer area is located in the image using a fixed segmentation template; Based on the grayscale and gradient features of pixels within the insulating layer region, the initial defect probability of each pixel belonging to an air gap defect is obtained. Based on the variance of the gray values of the pixels in the column region corresponding to the metal shielding layer, the interference probability of each column belonging to the metal shielding layer is obtained; combining the initial defect probability of each pixel belonging to the air gap defect and the interference probability of the column belonging to the metal shielding layer, the final defect probability of each pixel belonging to the air gap defect is obtained. Based on the comparison between the final defect probability and the defect probability threshold, all target pixels are obtained; Based on all target pixels, several defect candidate regions are obtained through a connected component labeling algorithm. According to the circularity of the air gap defect, the morphological defect degree of the defect candidate region is calculated. Combining the initial defect probability of the pixels in the defect candidate region and the distance weight of the pixel relative to the center point of its defect candidate region, the optimal probability of each pixel in the defect candidate region belonging to the seed point is obtained. Then, the seed point with the highest optimal probability for each defect candidate region is obtained. Adaptive region growth is performed based on seed points in the defect candidate region to obtain the air gap defect region and air gap defect evaluation results inside the cable.
2. The image detection method for internal air gap defects in a cable according to claim 1, characterized in that, The method for locating the insulation layer region in the image to be inspected using a fixed segmentation template includes: selecting several standard cable images to be inspected without air gap defects to ensure the insulation layer structure is complete and its position is uniform; determining the fixed boundary coordinates of the insulation layer in the image by manual annotation; constructing a binary segmentation template based on these coordinates; setting the insulation layer region as the effective pixel area and assigning a pixel value of 1; setting the core wire, main insulation, water-blocking buffer layer, and metal shielding layer as the invalid pixel area and assigning a pixel value of 0, thus forming a fixed segmentation template that only defines the insulation layer region; applying this template to multiple standard cable images to be inspected to verify its segmentation accuracy and ensure compatibility with images of the same type of cable; and subsequently, directly calling this template to match the input image to be inspected to locate the insulation layer region.
3. The image detection method for internal air gap defects in a cable according to claim 1, characterized in that, The step of obtaining the initial defect probability of each pixel belonging to an air gap defect based on the grayscale and gradient features of pixels within the insulating layer region includes: ; in, Pixels within the insulating layer area The initial defect probability belonging to air gap defects; These are the maximum grayscale value and the maximum gradient magnitude of the pixel within the insulating layer region, respectively. Pixels within the insulating layer area grayscale value; Pixels within the insulating layer area The gradient magnitude.
4. The image detection method for internal air gap defects in a cable according to claim 1, characterized in that, The step of obtaining the interference probability of each column belonging to the metal shielding layer based on the variance of the grayscale values of pixels within the column region corresponding to the metal shielding layer includes: ; in, It is the first in the insulation layer region The probability of interference belonging to the metal shielding layer; It is the maximum variance of the grayscale values of all corresponding pixels in the insulating layer area; It is the minimum variance of the grayscale values of all corresponding pixels in the insulating layer area; It is the first in the insulation layer area The variance of the grayscale values of all pixels in the column; It is a constant to prevent the denominator from being zero; The coordinate index of each column within the insulation layer region is determined by taking the top-left pixel of the insulation layer region as the origin and assigning positive integer numbers to each column horizontally to the right, denoted as the [number]. List.
5. The image detection method for internal air gap defects in a cable according to claim 4, characterized in that, The final defect probability of each pixel belonging to an air gap defect is obtained by combining the initial defect probability of each pixel belonging to an air gap defect and the interference probability of its column belonging to the metal shielding layer, including: ; in, It is a pixel. The final defect probability belonging to air gap defects; It is a pixel. The initial defect probability belonging to air gap defects; It is a pixel. The column containing the interference probability of the metal shielding layer is represented by a value for each pixel. The first Interference probability of the corresponding metal shielding layer .
6. The image detection method for internal air gap defects in a cable according to claim 1, characterized in that, Based on the comparison between the final defect probability and the defect probability threshold, all target pixels are obtained, including: Set defect probability threshold When the final defect probability of a pixel belonging to an air gap defect is greater than or equal to the defect probability threshold. When that happens, the pixel is classified as the target pixel.
7. The image detection method for internal air gap defects in a cable according to claim 1, characterized in that, The calculation of the morphological defect degree of the candidate defect region based on the roundness of the air gap defect includes: ; in, It is a defect candidate region The degree of morphological defects; It is a defect candidate region The area; It is a defect candidate region circumference; It is an index of the defect candidate region.
8. The image detection method for internal air gap defects in a cable according to claim 1, characterized in that, The method for obtaining the preferred probability that each pixel within the defect candidate region belongs to a seed point includes: ; in, It is a defect candidate region pixels in The probability of being a preferred seed point; It is a pixel. The initial defect probability; It is a defect candidate region The degree of morphological defects; It is a pixel. Relative to the defect candidate region The distance weight of the center point; These are the first weighted index, the second weighted index, and the third weighted index, which must meet the following conditions: ,and .
9. The image detection method for internal air gap defects in a cable according to claim 1, characterized in that, The method for obtaining the air gap defect assessment results includes: When the total area of air gap defects inside the cable accounts for 50% or more of the total insulation area, the cable is considered to have a severe defect and must be scrapped. When the total area of air gap defects inside the cable accounts for 20% to 50% of the total insulation area, the cable is considered to have a medium defect and must be shut down immediately for targeted repair. When the total area of air gap defects inside the cable accounts for less than 20% of the total insulation area, the cable is considered to have a minor defect and must be returned to the factory for partial repair and re-inspection.
10. An image detection system for internal air gap defects in cables, characterized in that, include: A processor and a memory, the memory storing computer program instructions that, when executed by the processor, implement an image detection method for internal air gap defects in a cable according to any one of claims 1-9.