X-ray based cable eccentricity detection method and system
By using a contour tracking method that combines gradient characteristics and multi-point prediction with ellipse fitting and rigorous pairing screening, the accuracy and reliability issues of cable eccentricity detection in existing technologies have been resolved, achieving high-precision cable eccentricity measurement.
Patent Information
- Application Number
- CN202511608192.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-11-05
- Publication Date
- 2026-01-27
- Estimated Expiration
- 2045-11-05
AI Technical Summary
Existing methods for detecting X-ray cable eccentricity suffer from inaccurate contour extraction, easy tracking deviation, and misjudgment in pairing, resulting in low accuracy and reliability of measurement results.
By selecting pixels with the local maximum gradient magnitude within eight neighborhoods and low neighborhood normalized gradient field divergence as contour starting points, contour tracking is performed in combination with the tangential direction of multi-point prediction. Ellipse fitting and a rigorous pairing selection mechanism, including size constraints, distance constraints and root mean square error evaluation, are adopted to ensure the accuracy of the contour.
It effectively eliminates noise and image interference, ensures the accuracy of the contour starting point, generates a continuous and complete contour, reduces the misjudgment rate, improves the accuracy of the geometric center positioning of the conductor and insulation layer, and meets the precision and reliability requirements of cable production.
Smart Images

Figure CN121074027B_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of cable eccentricity detection, specifically relating to an X-ray-based method and system for cable eccentricity detection. Background Technology
[0002] Eccentricity is one of the core indicators for evaluating cable quality, reflecting the degree of misalignment between the conductor center and the insulation center. During cable production, excessive eccentricity not only severely affects the cable's electrical performance, such as causing uneven electric field distribution, partial discharge, and reduced insulation breakdown voltage, but also weakens its mechanical strength and service life. Therefore, accurate and real-time online detection of eccentricity during production is crucial to ensuring cable quality.
[0003] Currently, the mainstream testing method in the industry is non-contact measurement technology. Among non-contact measurements, X-ray inspection technology is widely used for online monitoring of cable eccentricity because it can penetrate opaque insulation and sheath materials, thus enabling direct imaging of the internal conductor and external contours of the cable. X-ray inspection technology typically acquires X-ray images of the cable cross-section, then uses image processing algorithms to identify and extract the contours of the conductor and insulation layer. Next, it determines the geometric centers of the conductor and insulation layer through fitting and other methods, and finally calculates the offset between the two geometric centers, i.e., the eccentricity.
[0004] However, X-ray imaging inevitably introduces noise, and the complex internal structure of the cable, such as shielding layers and fillers, can create interference in the image. These two factors combined lead to blurred, discontinuous, and even false edges on the conductor and insulation layers. Existing edge detection algorithms often struggle to accurately and completely extract the target contour when processing images with low signal-to-noise ratios and high interference, easily resulting in broken or incorrect edge point sets. Furthermore, in the subsequent contour tracking stage, the tracking path is easily deviated by noise points or nearby artifacts, leading to distorted contour data. Inaccurate contour data directly affects the subsequent geometric center localization. In addition, when multiple candidate contours exist in the image due to interference, existing methods have relatively simple screening and verification mechanisms, making it difficult to accurately screen and match the true inner and outer conductor contours, easily leading to misjudgments. Summary of the Invention
[0005] Therefore, the purpose of this invention is to propose an X-ray-based cable eccentricity detection method and system to solve the problem of low accuracy and reliability of the final measurement results caused by defects such as inaccurate contour extraction, easy tracking deviation, and easy misjudgment of pairing in existing detection methods.
[0006] To address the above problems, the present invention provides a technical solution for a cable eccentricity detection method based on X-rays:
[0007] An X-ray-based method for detecting cable eccentricity includes the following steps:
[0008] Acquire X-ray images of the cable under test and calculate its corresponding gradient magnitude map and gradient direction map; in the gradient magnitude map, select pixels with a gradient magnitude that is the local maximum in eight neighborhoods and whose neighborhood normalized gradient field divergence is lower than a preset first threshold as the contour starting point.
[0009] Contour tracking is performed starting from each contour starting point to generate multiple contour point sets. The next contour point is determined as follows: the tangential prediction direction is determined based on the current contour point and at least two previous contour points. In the neighborhood of the tangential prediction direction, the pixel point with the smallest angle difference between the gradient direction and the tangential prediction direction and the gradient magnitude is selected.
[0010] For each set of contour points, an ellipse fitting algorithm is executed to obtain the geometric center, major and minor axis parameters, and root mean square error of each fitted ellipse. Based on the major axis parameter, all fitted ellipses are divided into outer candidate ellipses and inner candidate ellipses. For any outer candidate ellipse, from the inner candidate ellipses whose major axis ratio meets the preset range, the one with the closest distance to the geometric center of the outer candidate ellipse is selected to form a candidate pair.
[0011] All candidate pairs are screened based on the following criteria: the root mean square error of the outer candidate ellipse in the candidate pair is less than a preset second threshold, and the weighted sum of the root mean square errors of the inner candidate ellipse and the outer candidate ellipse is less than a third threshold determined by the major axis parameter of the outer candidate ellipse. Based on the geometric center coordinates of the outer candidate ellipse and the inner candidate ellipse in the screened candidate pair, the eccentricity of the cable under test is calculated.
[0012] Furthermore, methods for selecting the starting point of the contour include:
[0013] Centered on the pixel to be screened, a neighborhood window of a preset size is selected; the normalized gradient field divergence value within the neighborhood window is calculated; the pixel is determined as the contour starting point only if the gradient magnitude of the pixel is the maximum value among its eight neighboring pixels, and the neighborhood normalized gradient field divergence value of the pixel is less than a preset first threshold.
[0014] Furthermore, the method for contour tracking starting from each contour starting point includes:
[0015] Based on the current contour point and the two adjacent previous contour points, a quadratic polynomial fitting is used to determine the tangent direction for these three contour points, and this direction is used as the predicted direction.
[0016] Within a circular region of a preset radius centered on the current contour point, search for all pixels with non-zero gradient magnitudes.
[0017] Among the searched pixels, the pixel with the smallest absolute value of the angle between the gradient direction and the predicted direction, and whose angle is less than a preset angle threshold, is selected as the next contour point.
[0018] Furthermore, the method of classifying all fitted ellipses into outer candidate ellipses and inner candidate ellipses based on the major axis parameter is as follows: calculate the average value of the major axis parameter of all fitted ellipses, classify fitted ellipses with major axis parameters greater than the average value as outer candidate ellipses, and classify fitted ellipses with major axis parameters less than or equal to the average value as inner candidate ellipses.
[0019] Furthermore, the third threshold is directly proportional to the major axis parameter of the corresponding external candidate ellipse.
[0020] Furthermore, the formula for calculating the weighted sum of the root mean square errors of the inner and outer candidate ellipses in the candidate pairing is as follows: ;In the formula, Let be the root mean square error of the outer candidate ellipse. denoted as the root mean square error of the inner candidate ellipse; The weights are the root mean square errors of the outer candidate ellipse; Let be the weight of the root mean square error of the inner candidate ellipse, and Greater than .
[0021] Furthermore, the method for obtaining the gradient magnitude map and gradient direction map is as follows:
[0022] The Sobel operator is applied to the X-ray image to perform a convolution operation, resulting in a horizontal gradient operator and a vertical gradient operator.
[0023] The gradient magnitude of each pixel in the X-ray image is obtained by calculating the square root of the sum of the squares of the horizontal gradient operator and the squares of the vertical gradient operator. The gradient magnitude map is composed of the gradient magnitudes of all pixels in the X-ray image.
[0024] The gradient direction value of each pixel in the X-ray image is obtained by calculating the arctangent of the vertical and horizontal gradient operators. The gradient direction map is composed of the gradient direction values of all pixels in the X-ray image.
[0025] The technical solution of the cable eccentricity detection system based on X-ray provided by this invention is as follows:
[0026] An X-ray-based cable eccentricity detection system includes:
[0027] The image acquisition unit acquires the X-ray image of the cable under test and calculates its corresponding gradient magnitude map and gradient direction map. In the gradient magnitude map, the pixel point with the gradient magnitude being the local maximum in the eight-neighbor area and the neighborhood normalized gradient field divergence being lower than the preset first threshold is selected as the contour starting point.
[0028] The next contour point determination unit starts from each contour starting point to perform contour tracking to generate multiple contour point sets. The next contour point is determined as follows: based on the current contour point and at least two previous contour points, the tangential prediction direction is determined. In the neighborhood of the tangential prediction direction, the pixel point with the smallest angle difference between the gradient direction and the tangential prediction direction and the gradient magnitude is selected.
[0029] The ellipse fitting unit performs an ellipse fitting algorithm on each contour point set to obtain the geometric center, major and minor axis parameters, and root mean square error of each fitted ellipse. Based on the major axis parameter, all fitted ellipses are divided into outer candidate ellipses and inner candidate ellipses. For any outer candidate ellipse, the inner candidate ellipse whose major axis ratio meets the preset range is selected to be the one with the closest distance to the geometric center of the outer candidate ellipse, forming a candidate pair.
[0030] The ellipse screening unit filters all candidate pairs. The screening criteria are: the root mean square error of the outer candidate ellipse in the candidate pair is less than a preset second threshold, and the weighted sum of the root mean square errors of the inner candidate ellipse and the outer candidate ellipse is less than a third threshold determined by the major axis parameter of the outer candidate ellipse. Based on the geometric center coordinates of the outer candidate ellipse and the inner candidate ellipse in the screened candidate pair, the eccentricity of the cable under test is calculated.
[0031] Furthermore, the method for the image acquisition unit to filter contour starting points includes:
[0032] Centered on the pixel to be screened, a neighborhood window of a preset size is selected; the normalized gradient field divergence value within the neighborhood window is calculated; the pixel is determined as the contour starting point only if the gradient magnitude of the pixel is the maximum value among its eight neighboring pixels, and the neighborhood normalized gradient field divergence value of the pixel is less than a preset first threshold.
[0033] Furthermore, the method by which the next contour point determination unit performs contour tracking starting from each contour starting point includes:
[0034] Based on the current contour point and the two adjacent previous contour points, a quadratic polynomial fitting is used to determine the tangent direction for these three contour points, and this direction is used as the predicted direction.
[0035] Within a circular region of a preset radius centered on the current contour point, search for all pixels with non-zero gradient magnitudes.
[0036] Among the searched pixels, the pixel with the smallest absolute value of the angle between the gradient direction and the predicted direction, and whose angle is less than a preset angle threshold, is selected as the next contour point.
[0037] Furthermore, the method of classifying all fitted ellipses into outer candidate ellipses and inner candidate ellipses based on the major axis parameter is as follows: calculate the average value of the major axis parameter of all fitted ellipses, classify fitted ellipses with major axis parameters greater than the average value as outer candidate ellipses, and classify fitted ellipses with major axis parameters less than or equal to the average value as inner candidate ellipses.
[0038] Furthermore, the third threshold is directly proportional to the major axis parameter of the corresponding external candidate ellipse.
[0039] Furthermore, the formula for calculating the weighted sum of the root mean square errors of the inner and outer candidate ellipses in the candidate pairing is as follows: ;In the formula, Let be the root mean square error of the outer candidate ellipse. denoted as the root mean square error of the inner candidate ellipse; The weights are the root mean square errors of the outer candidate ellipse; Let be the weight of the root mean square error of the inner candidate ellipse, and Greater than .
[0040] Furthermore, the method for obtaining the gradient magnitude map and gradient direction map is as follows:
[0041] The Sobel operator is applied to the X-ray image to perform a convolution operation, resulting in a horizontal gradient operator and a vertical gradient operator.
[0042] The gradient magnitude of each pixel in the X-ray image is obtained by calculating the square root of the sum of the squares of the horizontal gradient operator and the squares of the vertical gradient operator. The gradient magnitude map is composed of the gradient magnitudes of all pixels in the X-ray image.
[0043] The gradient direction value of each pixel in the X-ray image is obtained by calculating the arctangent of the vertical and horizontal gradient operators. The gradient direction map is composed of the gradient direction values of all pixels in the X-ray image.
[0044] The beneficial effects of this invention are as follows:
[0045] In the contour starting point screening stage, this invention combines the local maximum characteristic of the eight-neighborhood of the gradient magnitude with the neighborhood normalized gradient field divergence threshold to effectively eliminate false edge points formed by noise, shielding layers, or fillers in X-ray images. This ensures that the starting point is only a strong edge point of the true conductor or insulation layer contour, improving the basic accuracy of subsequent processing from the source. In the contour tracking stage, tangential directions predicted based on multiple historical points are used for guidance. Compared with the traditional single-direction tracking method, this invention ensures the generation of continuous and complete contours even when the edges are weak or there are discontinuities. Moreover, this invention proposes a rigorous inner and outer contour pairing screening mechanism, comprehensively utilizing size constraints, distance constraints, and fitting quality evaluation based on root mean square error. In particular, by setting a joint error threshold related to the outer contour size, it can accurately identify and confirm the true inner and outer contours from multiple candidate targets, reducing the misjudgment rate caused by image interference and improving the accuracy of conductor and insulation layer geometric center positioning. This effectively meets the stringent requirements of cable production for detection accuracy and reliability. Attached Figure Description
[0046] Figure 1 This is a flowchart of the X-ray-based cable eccentricity detection method of the present invention;
[0047] Figure 2 The image shows the X-ray image of the cable under test and its corresponding gradient amplitude.
[0048] Figure 3 This is a schematic diagram of contour tracking.
[0049] Figure 4 This is a schematic diagram of ellipse fitting. Detailed Implementation
[0050] To make the objectives, technical solutions, and advantages of this invention clearer, the technical solutions of this invention will be clearly and completely described below in conjunction with specific embodiments and corresponding drawings. Obviously, the described embodiments are only a part of the embodiments of this invention, and not all of them. Based on the embodiments of this invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this invention.
[0051] Specific embodiments of the X-ray-based cable eccentricity detection method of the present invention:
[0052] like Figure 1 As shown, the X-ray-based cable eccentricity detection method includes the following steps:
[0053] S1. Obtain an X-ray image of the cable under test, and calculate the gradient magnitude map and gradient direction map of the X-ray image; in the gradient magnitude map, select the pixel points with a gradient magnitude that is locally maximum in eight neighborhoods and whose neighborhood normalized gradient field divergence is lower than a first threshold as the contour starting point.
[0054] In this step, X-rays passing through the moving cable on the production line are continuously acquired using an X-ray source and a linear or area array detector, generating a series of two-dimensional grayscale images, i.e., X-ray images of the cable under test. For each frame of the X-ray image, a 3×3 Sobel operator is applied for convolution to obtain the horizontal and vertical gradient operators. The gradient magnitude of each pixel in the X-ray image is obtained by calculating the square root of the sum of the squares of the horizontal and vertical gradient operators. The gradient magnitude map is composed of the gradient magnitudes of all pixels in the X-ray image, as shown below. Figure 2 As shown, the gradient magnitude map displays the intensity of the edge of each pixel in the X-ray image. The sharper the edge and the higher the contrast, the larger the gradient magnitude. The gradient direction value of each pixel in the X-ray image is obtained by calculating the arctangent of the vertical and horizontal gradient operators. The gradient direction map is composed of the gradient direction values of all pixels in the X-ray image. The gradient direction map shows the orientation of the edge of each pixel.
[0055] In step S1, the method for selecting the starting point of the contour includes:
[0056] Centered on the pixel to be screened, a neighborhood window of a preset size is selected; the normalized gradient field divergence value within the neighborhood window is calculated; the pixel is determined as the contour starting point only if the gradient magnitude of the pixel is the maximum value among its eight neighboring pixels, and the neighborhood normalized gradient field divergence value of the pixel is less than a preset first threshold.
[0057] This method identifies the starting point of the contour using dual criteria, eliminating interference from noise and non-edge regions. Local maxima of gradient magnitude ensure that the pixel is a strong edge point, while low divergence values indicate that the gradient direction of the pixel's neighborhood is consistent, possibly belonging to a continuous true contour.
[0058] For example, a pixel Q with a gradient magnitude of 180 is detected in the gradient magnitude map, and a preset first threshold is 0.2. The gradient magnitudes of Q are compared with those of its eight neighboring pixels. If the gradient magnitude of Q is the maximum among these nine gradient magnitudes, it satisfies the local maximum condition, indicating that Q is a potential strong edge point. A 5×5 pixel window is constructed centered on Q. The divergence of the gradient field is calculated within the pixel window, which is the sum of the partial derivatives of the horizontal component of the gradient vector along the x-direction and the partial derivatives of the vertical component along the y-direction for each pixel within the pixel window. The divergence value is normalized using the sum of all gradient magnitudes within the pixel window to obtain the normalized gradient field divergence. Gradient field divergence measures the degree of convergence or divergence of gradient vectors. For ideal straight lines or smooth curve edges, gradient vectors should be approximately parallel, and the divergence value should be close to zero. Assuming the calculated normalized gradient field divergence value of the neighborhood of Q is 0.15, which is less than the preset first threshold, it indicates that the gradient direction of the region where Q is located is consistent, and it is likely to belong to a continuous contour. Since point Q satisfies both the conditions of maximum local gradient magnitude and low divergence of the neighborhood normalized gradient field, point Q is determined as a reliable starting point for the profile.
[0059] S2, Starting from each contour starting point, perform contour tracking to generate multiple contour point sets. The next contour point is determined as follows: Based on the current contour point and at least two preceding contour points, determine the tangential prediction direction. In the neighborhood of the tangential prediction direction, select the pixel point with the smallest angle difference between the gradient direction and the tangential prediction direction and the gradient magnitude is non-zero.
[0060] This step expands the isolated contour starting point from step S1 into a complete and continuous set of contour points. Traditional contour tracking methods easily lose track of or jump to incorrect artifacts when encountering blurred edges or breakpoints caused by noise. This step, however, predicts the direction using at least two preceding contour points, essentially utilizing the contour's historical trajectory and inertia. This prediction-based tracking method is more robust; even with weak edge features or small breakpoints, it can accurately skip interference and breakpoints and continue tracking along the correct contour path using the predicted inertial direction, thereby generating a more continuous and complete set of contour points and avoiding contour data distortion.
[0061] When the set of contour points contains at least three contour points, i.e., the current contour point Previous contour point and the previous outline point At that time, through connection and The two contour points form a vector, and the direction of this vector is the direction of the line segment. Predicted direction of contour points. Within a fan-shaped search region centered on the prediction direction, traverse all pixels with non-zero gradient magnitudes. Calculate the absolute value of the angle between the gradient direction of each pixel and the prediction direction. Select the pixel with the smallest absolute angle, which is less than a preset angle threshold, as the next contour point. Repeat this process until the tracing path returns to the vicinity of the contour's starting point or no subsequent contour points that meet the conditions can be found, thus forming a complete set of contour points.
[0062] In an optional embodiment, the step of performing contour tracking from each contour starting point to generate multiple contour point sets includes:
[0063] Based on the current contour point and the two adjacent previous contour points, a quadratic polynomial fitting is used to determine the tangent direction for these three contour points, and this direction is used as the predicted direction.
[0064] Within a circular region centered on the current contour point and with a radius of 3 pixels, search for all pixels with a gradient magnitude greater than 0.
[0065] Among the searched pixels, the pixel with the smallest absolute angle between the gradient direction and the predicted direction, which is less than 15 degrees, is selected as the next contour point.
[0066] For example, such as Figure 3 As shown, three candidate points A, B, and C were found, with gradient directions of 38 degrees, 52 degrees, and 30 degrees, respectively. The absolute values of the angles between the gradient directions of these three candidate points and the predicted direction of 35 degrees were calculated, yielding results of 3 degrees, 17 degrees, and 5 degrees, respectively. According to the selection rule, the point with the smallest absolute angle value, less than 15 degrees, was selected. In this example, point A was selected as the next contour point.
[0067] S3. Perform an ellipse fitting algorithm on each contour point set to obtain the geometric center, major and minor axis parameters, and root mean square error of each fitted ellipse. Based on the major axis parameter, divide all fitted ellipses into outer candidate ellipses and inner candidate ellipses. For any outer candidate ellipse, select the inner candidate ellipse whose major axis ratio meets the preset range and whose geometric center is closest to the outer candidate ellipse to form a candidate pair.
[0068] Using the pixel coordinates of all points in each contour point set as input data, ellipse fitting is performed using the direct least squares method. This is achieved by constructing an equation for a quadratic curve of the ellipse. An overdetermined system of six equations with six undetermined coefficients, subject to elliptic constraints. The optimal coefficients are obtained by solving the problem. A to FBased on the coefficients obtained from the solution, the geometric center coordinates, lengths of the major and minor axes, and rotation angles of the fitted ellipse are analytically determined through algebraic operations. Simultaneously, the nearest geometric distance from each contour point to the boundary of the fitted ellipse is calculated. The square root of the sum of the squares of all distances is then taken to obtain the root mean square error of the fitted ellipse. Figure 4 As shown.
[0069] In an optional embodiment, the average value of the major axis parameters of all fitted ellipses is calculated, and fitted ellipses with major axis parameters greater than the average value are classified as outer candidate ellipses, while fitted ellipses with major axis parameters less than or equal to the average value are classified as inner candidate ellipses.
[0070] For each outer candidate contour, select its paired inner candidate contours to form a filter pair. The specific filtering method consists of two steps, including:
[0071] For each outer candidate ellipse, traverse all inner candidate ellipses, calculate the ratio of the major axis of the inner candidate ellipse to the major axis of the outer candidate ellipse, and determine whether the ratio falls within a preset reasonable range, such as between 0.2 and 0.6.
[0072] Among all the inner candidate ellipses that satisfy the above size ratio conditions, calculate the Euclidean distance between their respective geometric centers and the geometric center of the current outer candidate ellipse, and select the inner candidate ellipse with the smallest Euclidean distance to form a candidate pair with the current outer candidate ellipse.
[0073] The above screening method significantly narrows the search range by using the major axis ratio and the proximity of the geometric center as physical constraints. It can filter out a large number of incorrect combinations that do not conform to the cable structure or are not concentric. The screening process is repeated for all external candidate ellipses to find all possible candidate pairs.
[0074] S4. Filter all candidate pairs. The filtering conditions are: the root mean square error of the outer candidate ellipse in the candidate pair is less than the preset second threshold, and the weighted sum of the root mean square errors of the inner candidate ellipse and the outer candidate ellipse is less than the third threshold determined by the major axis parameter of the outer candidate ellipse; calculate the eccentricity of the cable under test based on the geometric center coordinates of the outer candidate ellipse and the inner candidate ellipse in the filtered candidate pair.
[0075] This step involves selecting the pair of ellipses from the multiple candidate pairs chosen in step S3 that best fits the characteristics of a coaxial cable, specifically the outer contour of the insulation layer and the inner contour of the conductor. There are two selection criteria: one is a constraint on the root mean square error of the outer candidate ellipses alone, ensuring the reliable fitting quality of the outer contour (insulation layer) itself; if the outer contour fits poorly, the candidate pair is eliminated. The other is a joint constraint on the root mean square errors of both the inner and outer candidate ellipses, used to comprehensively evaluate the overall fitting quality of the inner and outer contours.
[0076] Specifically, a fixed fitting quality threshold is obtained as a preset second threshold, for example, 0.9. Each candidate pair is examined; if the root mean square error (RMSE) of the outer candidate ellipse is greater than 0.9, the candidate pair is directly eliminated. For candidate pairs that pass the initial screening, the weighted sum of the RMSEs of the inner and outer candidate ellipses in the candidate pair is calculated. In this embodiment, the formula for calculating the weighted sum of the RMSEs of the inner and outer candidate ellipses in the candidate pair is: ;In the formula, Let be the root mean square error of the outer candidate ellipse. denoted as the root mean square error of the inner candidate ellipse; The weights are the root mean square errors of the outer candidate ellipse; Let be the weight of the root mean square error of the inner candidate ellipse, and Greater than In one specific embodiment, Take 0.4, We set it to 0.6. This calculation formula gives a higher weight to the root mean square error of the inner candidate ellipse.
[0077] The third threshold is directly proportional to the major axis parameter of the outer candidate ellipse. In this embodiment, the third threshold is defined as... The major axis parameter of the outer candidate ellipse is Through formula The third threshold can be calculated. When When the inner and outer candidate ellipses in the candidate pair are determined to be the final required inner and outer contours, they represent the optimal identification result for the coaxial cable end face.
[0078] In an optional embodiment, the geometric center coordinates of the finally determined outer contour are defined as ( The geometric center coordinates of the inner contour are ( The offset distance between the two geometric centers is The cable's eccentricity percentage is S.
[0079] in, The calculation formula is: .
[0080] Additionally, obtain the average radius R of the outer contour. 外 That is, half the sum of the major and minor axes of the outer contour; similarly, obtain the average radius R of the inner contour. 内 .
[0081] The formula for calculating the cable's eccentricity percentage S is: .
[0082] Specific embodiments of the X-ray-based cable eccentricity detection system of the present invention:
[0083] The X-ray-based cable eccentricity detection system includes:
[0084] The image acquisition unit acquires the X-ray image of the cable under test and calculates its corresponding gradient magnitude map and gradient direction map. In the gradient magnitude map, the pixel point with the gradient magnitude being the local maximum in the eight-neighbor area and the neighborhood normalized gradient field divergence being lower than the preset first threshold is selected as the contour starting point.
[0085] The next contour point determination unit starts from each contour starting point to perform contour tracking to generate multiple contour point sets. The next contour point is determined as follows: based on the current contour point and at least two previous contour points, the tangential prediction direction is determined. In the neighborhood of the tangential prediction direction, the pixel point with the smallest angle difference between the gradient direction and the tangential prediction direction and the gradient magnitude is selected.
[0086] The ellipse fitting unit performs an ellipse fitting algorithm on each contour point set to obtain the geometric center, major and minor axis parameters, and root mean square error of each fitted ellipse. Based on the major axis parameter, all fitted ellipses are divided into outer candidate ellipses and inner candidate ellipses. For any outer candidate ellipse, the inner candidate ellipse whose major axis ratio meets the preset range is selected to be the one with the closest distance to the geometric center of the outer candidate ellipse, forming a candidate pair.
[0087] The ellipse screening unit filters all candidate pairs. The screening criteria are: the root mean square error of the outer candidate ellipse in the candidate pair is less than a preset second threshold, and the weighted sum of the root mean square errors of the inner candidate ellipse and the outer candidate ellipse is less than a third threshold determined by the major axis parameter of the outer candidate ellipse. Based on the geometric center coordinates of the outer candidate ellipse and the inner candidate ellipse in the screened candidate pair, the eccentricity of the cable under test is calculated.
[0088] It should be noted that the working processes of the image acquisition unit, the next contour point determination unit, the ellipse fitting unit, and the ellipse screening unit are the same as those of steps S1, S2, S3, and S4 in the X-ray-based cable eccentricity detection method, and will not be described in detail here.
[0089] While various embodiments of the invention have been shown and described in this specification, it will be apparent to those skilled in the art that such embodiments are provided by way of example only. Many modifications, alterations, and alternatives will occur to those skilled in the art without departing from the spirit and essence of the invention.
Claims
1. A method for detecting cable eccentricity based on X-rays, characterized in that, Includes the following steps: Acquire X-ray images of the cable under test and calculate its corresponding gradient magnitude map and gradient direction map; In the gradient magnitude map, pixels whose gradient magnitude is the local maximum in eight neighborhoods and whose neighborhood normalized gradient field divergence is lower than a preset first threshold are selected as contour starting points. Contour tracking is performed starting from each contour starting point to generate multiple contour point sets. The next contour point is determined as follows: the tangential prediction direction is determined based on the current contour point and at least two previous contour points. In the neighborhood of the tangential prediction direction, the pixel point with the smallest angle difference between the gradient direction and the tangential prediction direction and the gradient magnitude is selected. For each set of contour points, an ellipse fitting algorithm is executed to obtain the geometric center, major and minor axis parameters, and root mean square error of each fitted ellipse. Based on the major axis parameter, all fitted ellipses are divided into outer candidate ellipses and inner candidate ellipses. For any outer candidate ellipse, from the inner candidate ellipses whose major axis ratio meets the preset range, the one with the closest distance to the geometric center of the outer candidate ellipse is selected to form a candidate pair. All candidate pairs are screened, and the screening criteria are: the root mean square error of the outer candidate ellipse in the candidate pair is less than the preset second threshold, and the weighted sum of the root mean square errors of the inner candidate ellipse and the outer candidate ellipse is less than the third threshold determined by the major axis parameter of the outer candidate ellipse. Based on the geometric center coordinates of the outer and inner candidate ellipses in the selected candidate pairs, the eccentricity of the cable under test is calculated.
2. The X-ray-based cable eccentricity detection method according to claim 1, characterized in that, Methods for selecting the starting point of a contour include: Centered on the pixel to be screened, a neighborhood window of a preset size is selected; the normalized gradient field divergence value within the neighborhood window is calculated; the pixel is determined as the contour starting point only if the gradient magnitude of the pixel is the maximum value among its eight neighboring pixels, and the neighborhood normalized gradient field divergence value of the pixel is less than a preset first threshold.
3. The X-ray-based cable eccentricity detection method according to claim 2, characterized in that, The method for contour tracking starting from each contour starting point includes: Based on the current contour point and the two adjacent previous contour points, a quadratic polynomial fitting is used to determine the tangent direction for these three contour points, and this direction is used as the predicted direction. Within a circular region of a preset radius centered on the current contour point, search for all pixels with non-zero gradient magnitudes. Among the searched pixels, the pixel with the smallest absolute value of the angle between the gradient direction and the predicted direction, and whose angle is less than a preset angle threshold, is selected as the next contour point.
4. The X-ray-based cable eccentricity detection method according to claim 1, characterized in that, The method for classifying all fitted ellipses into outer candidate ellipses and inner candidate ellipses based on their major axis parameters is as follows: calculate the average value of the major axis parameters of all fitted ellipses, classify fitted ellipses with major axis parameters greater than the average value as outer candidate ellipses, and classify fitted ellipses with major axis parameters less than or equal to the average value as inner candidate ellipses.
5. The X-ray-based cable eccentricity detection method according to claim 1, characterized in that, The third threshold is directly proportional to the major axis parameter of the corresponding external candidate ellipse.
6. The X-ray-based cable eccentricity detection method according to claim 1, characterized in that, The formula for calculating the weighted sum of the root mean square errors of the inner and outer candidate ellipses in the candidate pairing is as follows: ;In the formula, Let be the root mean square error of the outer candidate ellipse. denoted as the root mean square error of the inner candidate ellipse; The weights are the root mean square errors of the outer candidate ellipse; Let be the weight of the root mean square error of the inner candidate ellipse, and Greater than .
7. The X-ray-based cable eccentricity detection method according to claim 1, characterized in that, The method for obtaining the gradient magnitude map and gradient direction map is as follows: The Sobel operator is applied to the X-ray image to perform a convolution operation, resulting in a horizontal gradient operator and a vertical gradient operator. The gradient magnitude of each pixel in the X-ray image is obtained by calculating the square root of the sum of the squares of the horizontal gradient operator and the squares of the vertical gradient operator. The gradient magnitude map is composed of the gradient magnitudes of all pixels in the X-ray image. The gradient direction value of each pixel in the X-ray image is obtained by calculating the arctangent of the vertical and horizontal gradient operators. The gradient direction map is composed of the gradient direction values of all pixels in the X-ray image.
8. An X-ray-based cable eccentricity detection system, characterized in that, include: The image acquisition unit acquires the X-ray image of the cable under test and calculates its corresponding gradient magnitude map and gradient direction map. In the gradient magnitude map, the pixel point with the gradient magnitude being the local maximum in the eight-neighbor area and the neighborhood normalized gradient field divergence being lower than the preset first threshold is selected as the contour starting point. The next contour point determination unit starts from each contour starting point to perform contour tracking to generate multiple contour point sets. The next contour point is determined as follows: based on the current contour point and at least two previous contour points, the tangential prediction direction is determined. In the neighborhood of the tangential prediction direction, the pixel point with the smallest angle difference between the gradient direction and the tangential prediction direction and the gradient magnitude is selected. The ellipse fitting unit performs an ellipse fitting algorithm on each contour point set to obtain the geometric center, major and minor axis parameters, and root mean square error of each fitted ellipse. Based on the major axis parameter, all fitted ellipses are divided into outer candidate ellipses and inner candidate ellipses. For any outer candidate ellipse, the inner candidate ellipse whose major axis ratio meets the preset range is selected to be the one with the closest distance to the geometric center of the outer candidate ellipse, forming a candidate pair. The ellipse filtering unit filters all candidate pairs. The filtering conditions are: the root mean square error of the outer candidate ellipse in the candidate pair is less than the preset second threshold, and the weighted sum of the root mean square errors of the inner candidate ellipse and the outer candidate ellipse is less than the third threshold determined by the major axis parameter of the outer candidate ellipse. Based on the geometric center coordinates of the outer and inner candidate ellipses in the selected candidate pairs, the eccentricity of the cable under test is calculated.
9. The X-ray-based cable eccentricity detection system according to claim 8, characterized in that, The method for selecting contour starting points by the image acquisition unit includes: Centered on the pixel to be screened, a neighborhood window of a preset size is selected; the normalized gradient field divergence value within the neighborhood window is calculated; the pixel is determined as the contour starting point only if the gradient magnitude of the pixel is the maximum value among its eight neighboring pixels, and the neighborhood normalized gradient field divergence value of the pixel is less than a preset first threshold.
10. The X-ray-based cable eccentricity detection system according to claim 8, characterized in that, The method for the next contour point determination unit to perform contour tracking starting from each contour starting point includes: Based on the current contour point and the two adjacent previous contour points, a quadratic polynomial fitting is used to determine the tangent direction for these three contour points, and this direction is used as the predicted direction. Within a circular region of a preset radius centered on the current contour point, search for all pixels with non-zero gradient magnitudes. Among the searched pixels, the pixel with the smallest absolute value of the angle between the gradient direction and the predicted direction, and whose angle is less than a preset angle threshold, is selected as the next contour point.
Citation Information
Patent Citations
Automatic contour line measuring system and automatic contour line measuring method
CN103673962A
Accurate positioning method based on central image point of circular target
CN116309401A