A method for connecting fractured fractures based on double-triangle inner angle constraint
By using the double-triangle interior angle constraint method, the Euclidean distance between the endpoints is calculated and the double-triangle interior angle constraint is constructed, which solves the problem of inaccurate connection of interrupted cracks in the existing technology and achieves higher connection accuracy and stability.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- SHAANXI HAIRONG INTELLIGENT ELECTROMECHANICAL TECH CO LTD
- Filing Date
- 2026-04-03
- Publication Date
- 2026-07-03
Smart Images

Figure CN122335618A_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of digital image processing and computer vision technology, and relates to a fracture crack connection method, specifically a fracture crack connection method based on double triangle interior angle constraints. Background Technology
[0002] Semantic segmentation models based on deep learning (such as U-Net and DeepLabV3+) have been widely used for automatic crack identification. However, these models often segment physically continuous cracks into multiple discrete fracture segments due to problems such as limited receptive field, image noise, or uneven illumination. These discontinuous cracks severely interfere with subsequent quantitative analysis of the crack's true length, width, and morphology.
[0003] Several crack connection methods have been proposed in the prior art. For example, patent CN113486896B discloses "An Automatic Connection Method for Discontinuous Cracks in Pavement Images." This method, after acquiring the crack semantic segmentation image output by a deep learning model, first extracts the crack skeleton and obtains the endpoint positions on both sides of the skeleton line segments, calculates the direction of the endpoint extension lines, and then uses connected component analysis to label the connected components of any crack skeleton. Finally, starting from the endpoints, a sliding window is used along the extension line direction, and the connection of the endpoints is determined by judging whether the endpoints belong to different connected components and the angle between the extension line directions (≥135° and ≤225°).
[0004] This method is somewhat similar to the present invention, as it also repairs fractures based on the direction and angle of the crack endpoint's extension. However, this method has several technical defects in practical applications, and the present invention has made several improvements to address these issues:
[0005] 1. The method for calculating the extension line of the endpoint is not clearly defined; 2. Lack of explicit distance search stopping conditions: This method uses a sliding window to search for other endpoints along the extension direction of the endpoints, without explicitly specifying search stopping conditions (number of searches, maximum distance). This implicit distance limitation makes it difficult to precisely control the range of broken connections, the connection judgment is not rigorous enough, it is difficult to find distant endpoints when the number of searches is too small, and it increases the computation time when the number of searches is too large.
[0006] 3. Overly broad directional constraints: Using the angle between the extension of a single endpoint and the line connecting the two endpoints as the directional constraint (≥135° and ≤225°) is relatively broad. This broad constraint may cause the fracture connection direction to not conform to the actual extension trend of another fracture, especially in complex fracture scenarios, where it is easy to misjudge the endpoints between different fractures as needing to be connected.
[0007] Another common region growing method (such as CN114972274A) achieves connection by merging adjacent connected regions, but it is essentially based on region similarity and distance, lacking accurate utilization of the key physical property of crack geometric extension direction, which can easily lead to over-connection or misconnection.
[0008] Therefore, there is an urgent need for a fracture repair method that can more accurately determine the connection, has stronger anti-interference ability, and can better maintain the natural extension shape of the crack. Summary of the Invention
[0009] To address the shortcomings of existing technologies, the present invention aims to provide a fracture crack connection method based on double triangle interior angle constraints, thereby solving the technical problems of existing crack endpoint connection methods being unable to connect longer fractures and inaccurate directional constraints leading to misconnections.
[0010] To solve the above-mentioned technical problems, the present invention adopts the following technical solution: A fracture crack connection method based on double triangle interior angle constraints includes the following steps: S1. Obtain the binary image of crack semantic segmentation output by the deep learning model, filter it, and obtain the filtered binary image. S2, extract a single-pixel width skeleton map from the filtered binary image, detect all endpoints in the single-pixel width skeleton map by topological analysis, and determine the orientation reference point of each endpoint; S3, calculate the Euclidean distance between any two endpoints, and select all endpoint pairs with the smallest Euclidean distance that is less than a preset distance threshold as candidate endpoint pairs (Pi). Pj), that is, the set of candidate endpoint pairs is obtained; S4. Determine whether the candidate endpoint pair (Pi, Pj) in the candidate endpoint pair set obtained in S3 satisfies the double triangle interior angle constraint. If it satisfies, connect endpoint Pi and endpoint Pj on the filtered binary image and proceed to S5. If it does not satisfy, let i = i + 1 and j = j + 1, and re-determine. The interior angle constraint of the double triangle is: the angle between the line connecting endpoints Pi and Pj in the candidate endpoint pair (Pi, Pj) and the line connecting endpoint Pi and its corresponding reference point, as well as the angle between the line connecting endpoint Pj and its corresponding reference point, are both greater than a preset angle threshold. S5, let i=i+1, j=j+1, return to S4, until all candidate endpoint pairs have been judged and the binary image of the crack after connection is completed is output.
[0011] This invention also includes the following technical features: In S2, the steps to determine the direction reference point for each endpoint are as follows: For each endpoint, trace back N consecutive skeleton points along its corresponding single-pixel width skeleton map to obtain a point set. Use the least squares method to fit a straight line to this point set to obtain a fitted straight line. Calculate the distance from each skeleton point in the point set to the fitted straight line and use this distance as the weight of the skeleton point. Perform a weighted average on the N consecutive skeleton points to obtain the weighted centroid, which is defined as the direction reference point of the endpoint.
[0012] In S2, the value of N ranges from 50 to 200.
[0013] In S3, the preset distance threshold is 100~500 pixels.
[0014] S4 specifically includes the following sub-steps: S4.1, Obtain the direction reference point Ri and direction reference point Rj corresponding to endpoint Pi and endpoint Pj in each candidate endpoint pair (Pi,Pj); S4.2, Construct the first triangle △RiPiPj, and calculate the angle between vectors RiPi and PiPj. ; S4.3, Construct a second triangle △PiPjRj, and calculate the angle between vector PjRj and vector PiPj. ; S4.4, Determine the included angle and If both angles are greater than the preset angle threshold, then the endpoint pair satisfies the double triangle interior angle constraint. Then connect endpoint Pi and endpoint Pj on the filtered binary image. If not, let i = i + 1 and j = j + 1, and re-evaluate.
[0015] In S4.4, the preset angle threshold is 120~150 degrees.
[0016] In S4, the connection between endpoints Pi and Pj is achieved by using the Bresenham algorithm to draw a connecting line segment between endpoints Pi and Pj on the filtered binary image, or by using morphological dilation to connect the regions where endpoints Pi and Pj are located, and then thinning is performed.
[0017] Compared with the prior art, the beneficial technical effects of this invention are: (I) This invention incorporates distance judgment and double-triangle interior angle constraints. This requires not only that the two endpoints to be connected be close in distance, but also that the connecting line segment (PiPj) between the two endpoints smoothly connects with the original orientations of the connecting line segments (RiPi and PjRj) between the two endpoints and their corresponding reference points (i.e., the included angle is greater than a threshold). This dual physical constraint significantly reduces the risk of incorrectly connecting two spatially close but discontinuous cracks, significantly improving the accuracy of connection decisions and solving the technical problem of inaccurate orientation constraints leading to incorrect connections in existing crack endpoint connection methods.
[0018] (II) In this invention, when calculating the extension direction of the endpoint, a certain number of points are backtracked, and the straight line obtained by multi-point fitting can more accurately reflect the extension direction of the crack end (compared to a single point on the crack and the endpoint and the connecting line). It has unique advantages for connecting curved cracks and nonlinear cracks. Even if the crack bends at the endpoint, the reference point R obtained by fitting can still reasonably characterize the trend direction of the crack segment at the connection point, making the connection more consistent with the natural geometry of the crack. At the same time, due to the stricter directional constraints, the distance threshold can be set to a larger value, which can connect longer cracks and solve the technical problem that the existing crack endpoint connection methods cannot connect longer fractures.
[0019] (III) This invention generates direction reference points by performing straight line fitting on points adjacent to the endpoints, replacing the traditional method of directly using the local tangent direction of the endpoints. This method effectively averages the direction jitter caused by local pixel noise and burrs, making the direction representation more stable and better reflecting the overall extension trend of the crack segment, thereby significantly improving the robustness of the method. Attached Figure Description
[0020] Figure 1 This is an overall flowchart of the method of the present invention.
[0021] Figure 2 The binary image of crack semantic segmentation output by the deep learning model.
[0022] Figure 3 A diagram illustrating the noise filtering effect.
[0023] Figure 4 This is a schematic diagram of a skeleton with a single pixel width.
[0024] Figure 5 This is a comparison diagram showing the crack connection effect before and after applying the method of the present invention.
[0025] The specific content of the present invention will be further explained in detail below with reference to the embodiments. Detailed Implementation
[0026] It should be noted that, unless otherwise specified, all components in this invention are those known in the art.
[0027] The following are specific embodiments of the present invention. It should be noted that the present invention is not limited to the following specific embodiments. All equivalent modifications made based on the technical solutions of this application fall within the protection scope of the present invention.
[0028] This invention provides a fracture crack connection method based on double triangle interior angle constraints, comprising the following steps: S1. Obtain the binary image of crack semantic segmentation output by the deep learning model, filter it, and obtain the filtered binary image. S2, extract a single-pixel width skeleton map from the filtered binary image, detect all endpoints in the single-pixel width skeleton map by topological analysis, and determine the orientation reference point of each endpoint; S3, calculate the Euclidean distance between any two endpoints, and select all endpoint pairs with the smallest Euclidean distance that is less than a preset distance threshold as candidate endpoint pairs (Pi). Pj), that is, the set of candidate endpoint pairs is obtained; S4. Determine whether the candidate endpoint pair (Pi, Pj) in the candidate endpoint pair set obtained in S3 satisfies the double triangle interior angle constraint. If it satisfies, connect endpoint Pi and endpoint Pj on the filtered binary image and proceed to S5. If it does not satisfy, let i = i + 1 and j = j + 1, and re-determine. The interior angle constraint of the double triangle is: the angle between the line connecting endpoints Pi and Pj in the candidate endpoint pair (Pi, Pj) and the line connecting endpoint Pi and its corresponding reference point, as well as the angle between the line connecting endpoint Pj and its corresponding reference point, are both greater than a preset angle threshold. S5, let i=i+1, j=j+1, return to S4, until all candidate endpoint pairs have been judged and the binary image of the crack after connection is completed is output.
[0029] The above technical solution incorporates distance judgment and double-triangle interior angle constraints. This requires not only that the two endpoints to be connected be close in distance, but also that the connecting line segment (PiPj) between the two endpoints smoothly connects with the original orientations of the connecting line segments (RiPi and PjRj) between the two endpoints and their corresponding reference points (i.e., the included angle is greater than a threshold). This dual physical constraint significantly reduces the risk of incorrectly connecting two spatially close but discontinuous cracks, significantly improving the accuracy of connection decisions and solving the technical problem of incorrect connections caused by inaccurate directional constraints in existing crack endpoint connection methods.
[0030] In S1, the specific filtering content is: filtering contours with too small an area / perimeter (such as point noise), contours with too small an aspect ratio (non-long lines), and filtering isolated short cracks (usually false detections in segmentation models caused by shadows and scratches).
[0031] In S2, the algorithm first transforms the chaotic set of crack pixels into a clear, single-pixel-width skeleton map through skeletonization and topological analysis. In this map, the true crack trunks appear as long paths, while noise / branches appear as isolated, shorter outlines.
[0032] In S4, the difference in direction between the two fracture cracks is usually small. By simultaneously judging the angle between the extension direction of the two endpoints and the line connecting the endpoints, the consistency of direction can be accurately judged, thus avoiding incorrect connection.
[0033] This invention also includes the following technical features: In S2, the steps to determine the direction reference point for each endpoint are as follows: For each endpoint, trace back N consecutive skeleton points along its corresponding single-pixel width skeleton map to obtain a point set. Use the least squares method to fit a straight line to this point set to obtain a fitted straight line. Calculate the distance from each skeleton point in the point set to the fitted straight line and use this distance as the weight of the skeleton point. Perform a weighted average on the N consecutive skeleton points to obtain the weighted centroid, which is defined as the direction reference point of the endpoint.
[0034] In the above scheme, when calculating the extension direction of the endpoint, a certain number of points are backtracked. The straight line obtained by multi-point fitting can more accurately reflect the extension direction of the crack end (compared to a single point on the crack and the endpoint and the connecting line). It has unique advantages for connecting curved cracks and nonlinear cracks. Even if the crack bends at the endpoint, the fitted reference point R can still reasonably characterize the trend direction of the crack segment at the connection point, making the connection more consistent with the natural geometry of the crack. At the same time, due to the stricter directional constraints, the distance threshold can be set to a larger value, which can connect longer cracks and solve the technical problem that existing crack endpoint connection methods cannot connect longer fractures.
[0035] This method generates direction reference points by fitting straight lines to points near the endpoints, replacing the traditional approach of directly using the local tangent direction of the endpoints. This method effectively averages out the direction jitter caused by local pixel noise and burrs, making the direction representation more stable and better reflecting the overall extension trend of the crack segment, thus significantly improving the robustness of the method.
[0036] In S2, the value of N ranges from 50 to 200.
[0037] In S3, the preset distance threshold is 100~500 pixels.
[0038] In the above technical solution, the value of the preset distance threshold depends specifically on the image resolution and the typical maximum gap of the crack fracture.
[0039] S4 specifically includes the following sub-steps: S4.1, Obtain the direction reference point Ri and direction reference point Rj corresponding to endpoint Pi and endpoint Pj in each candidate endpoint pair (Pi,Pj); S4.2, Construct the first triangle △RiPiPj, and calculate the angle between vectors RiPi and PiPj. ; S4.3, Construct a second triangle △PiPjRj, and calculate the angle between vector PjRj and vector PiPj. ; S4.4, Determine the included angle and If both angles are greater than the preset angle threshold, then the endpoint pair satisfies the double triangle interior angle constraint. Then connect endpoint Pi and endpoint Pj on the filtered binary image. If not, let i = i + 1 and j = j + 1, and re-evaluate.
[0040] In S4.4, the preset angle threshold is 120~150 degrees.
[0041] In the above scheme, the preset angle threshold is preferably 120 degrees.
[0042] In S4, the connection between endpoints Pi and Pj is achieved by using the Bresenham algorithm to draw a connecting line segment between endpoints Pi and Pj on the filtered binary image, or by using morphological dilation to connect the regions where endpoints Pi and Pj are located, and then thinning is performed.
[0043] Example: This embodiment presents a fracture crack connection method based on double triangle interior angle constraints, wherein the preset distance threshold is 100 pixels and the preset angle threshold is 120 degrees. Specifically, it includes the following: acquiring the crack semantic segmentation binary image output by the deep learning model, such as... Figure 2 As shown, the image is filtered to obtain a filtered binary image, as follows. Figure 3 As shown in the figure, short vertical cracks are filtered out, thus preventing incorrect connection of crack segments in both horizontal and vertical directions. A single-pixel width skeleton map is extracted from the filtered binary image, and all endpoints in the single-pixel width skeleton map are detected using topological analysis. The orientation reference point of each endpoint is determined. The Euclidean distance between any two endpoints is calculated, and all endpoint pairs with the smallest Euclidean distance less than a preset distance threshold are selected as candidate endpoint pairs (Pi). Pj), that is, the set of candidate endpoint pairs is obtained, such as Figure 4As shown, the candidate endpoint pair (P1, P2) is obtained, indicated by the center of the red circle in the figure. The corresponding reference points R1 and R2 are calculated, indicated by the center of the green cross in the figure. The angles between line segment P1P2 and line segments R1P1 and R2P2 in the figure are both close to 180 degrees (the preset angle threshold is 120~150 degrees), which clearly satisfies the interior angle constraint of the double triangle. Therefore, endpoint P1 and endpoint P2 are connected, as shown by the blue line in the figure. Figure 5 The image above shows a comparison of the effects of using the method of this invention to connect cracks. The top image is a binary image of crack semantic segmentation output by a deep learning model, and the bottom image is a complete crack after connection.
Claims
1. A method for connecting broken cracks based on the inner angle constraint of double triangles, characterized in that, Includes the following steps: S1. Obtain the binary image of crack semantic segmentation output by the deep learning model, filter it, and obtain the filtered binary image. S2, extract a single-pixel width skeleton map from the filtered binary image, detect all endpoints in the single-pixel width skeleton map by topological analysis, and determine the orientation reference point of each endpoint; S3, calculate the Euclidean distance of any two endpoints, screen out all endpoint pairs with the smallest Euclidean distance and less than the preset distance threshold, and take them as candidate endpoint pairs (Pi Pj), that is, obtain the candidate endpoint pair set; S4. Determine whether the candidate endpoint pair (Pi, Pj) in the candidate endpoint pair set obtained in S3 satisfies the double triangle interior angle constraint. If it satisfies, connect endpoint Pi and endpoint Pj on the filtered binary image and proceed to S5. If it does not satisfy, let i = i + 1 and j = j + 1, and re-determine. The interior angle constraint of the double triangle is: the angle between the line connecting endpoints Pi and Pj in the candidate endpoint pair (Pi, Pj) and the line connecting endpoint Pi and its corresponding reference point, as well as the angle between the line connecting endpoint Pj and its corresponding reference point, are both greater than a preset angle threshold. S5, let i=i+1, j=j+1, return to S4, until all candidate endpoint pairs have been judged and the binary image of the crack after connection is completed is output.
2. The method of claim 1, wherein the method is based on the inner angle constraint of double triangles. In S2, the steps to determine the direction reference point for each endpoint are as follows: For each endpoint, trace back N consecutive skeleton points along its corresponding single-pixel width skeleton map to obtain a point set. Use the least squares method to fit a straight line to this point set to obtain a fitted straight line. Calculate the distance from each skeleton point in the point set to the fitted straight line and use this distance as the weight of the skeleton point. Perform a weighted average on the N consecutive skeleton points to obtain the weighted centroid, which is defined as the direction reference point of the endpoint.
3. The method of claim 2, wherein the method is based on the inner angle constraint of double triangles. In S2, the value of N ranges from 50 to 200.
4. The method of claim 1, wherein the method is based on the inner angle constraint of double triangles. In S3, the preset distance threshold is 100~500 pixels.
5. The method of claim 1, wherein the method is based on the inner angle constraint of double triangles. S4 specifically includes the following sub-steps: S4.1, Obtain the direction reference point Ri and direction reference point Rj corresponding to endpoint Pi and endpoint Pj in each candidate endpoint pair (Pi,Pj); S4.2, construct the first triangle RiPiPj, calculate the angle between vector RiPi and vector PiPj ; S4.3, Construct a second triangle △PiPjRj, and calculate the angle between vector PjRj and vector PiPj. ; S4.4, Determine the included angle and If both angles are greater than the preset angle threshold, then the endpoint pair satisfies the double triangle interior angle constraint. Then connect endpoint Pi and endpoint Pj on the filtered binary image. If not, let i = i + 1 and j = j + 1, and re-evaluate.
6. The fracture crack connection method based on double triangle interior angle constraints as described in claim 5, characterized in that, In S4.4, the preset angle threshold is 120~150 degrees.
7. The fracture crack connection method based on double triangle interior angle constraints as described in claim 1, characterized in that, In S4, the connection between endpoints Pi and Pj is achieved by using the Bresenham algorithm to draw a connecting line segment between endpoints Pi and Pj on the filtered binary image, or by using morphological dilation to connect the regions where endpoints Pi and Pj are located, and then thinning is performed.