A crack global optimization reconstruction method and system for structure detection
By constructing a crack connection diagram and introducing a structural prior model, combined with multi-dimensional connection probability features and Bayesian inference optimization algorithm, the problems of fracture and misconnection in crack detection are solved, achieving high-accuracy crack reconstruction in complex environments, which is suitable for infrastructure health monitoring.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- HUNAN INST OF INFORMATION TECH
- Filing Date
- 2026-04-09
- Publication Date
- 2026-06-19
AI Technical Summary
Existing crack detection technologies struggle to achieve accurate connection and complete path recovery of crack segments in complex environments, and lack global structural optimization mechanisms, making them prone to breakage or misconnection.
By constructing a crack connection graph and combining multi-dimensional connection probability features such as spatial adjacency distance, orientation difference, gradient difference, and gray level difference, a crack connection likelihood model is established. A structural prior model is also introduced, and the crack structure is reconstructed using Bayesian inference principle and global energy optimization algorithm.
It significantly improves the accuracy and environmental adaptability of crack reconstruction, and can stably recover the complete crack path under complex texture backgrounds and noise interference. It outputs accurate information including location, length, orientation and topology, and is suitable for health monitoring and damage assessment of infrastructure.
Smart Images

Figure CN121998987B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer vision and structural surface defect detection technology, specifically to a global optimization reconstruction method and system for cracks in structural detection. Background Technology
[0002] Cracks are common surface defects in engineering structures such as concrete structures, bridges, tunnels, and industrial components. Their occurrence is usually closely related to factors such as structural stress state, material properties, construction quality, and long-term environmental effects. The appearance of cracks is often an important early signal of structural damage or performance degradation. Therefore, timely and accurate detection and analysis of surface cracks are of great significance for ensuring the safe operation of engineering structures.
[0003] Traditional crack detection primarily relies on manual inspection, where professionals visually inspect structural surfaces and record crack locations, lengths, and morphological characteristics. However, this method is not only inefficient, but the results are also easily affected by factors such as the inspector's experience, the inspection environment, and subjective judgment, making it difficult to meet the demands for high efficiency and consistency in large-scale infrastructure inspection tasks. With the development of computer vision technology, the automatic detection of structural cracks using image processing and automatic recognition techniques has gradually become a research hotspot.
[0004] In existing computer vision-based crack detection methods, one type employs traditional image processing techniques, extracting crack regions through edge detection, thresholding, and morphological operations. For example, edge detection algorithms are often used to extract regions of abrupt grayscale changes in an image to obtain crack edge information, with typical methods including Canny edge detection. These methods offer advantages such as simplicity and high computational efficiency. However, in practical applications, factors such as complex surface textures, lighting variations, and noise interference often lead to broken or discontinuous crack edge detection results, affecting the complete extraction of the crack structure.
[0005] In recent years, with the development of deep learning technology, some studies have begun to utilize convolutional neural networks (CNNs) for crack image segmentation or detection to improve the accuracy of crack recognition. For example, extracting multi-scale features through deep CNNs can improve crack recognition capabilities under complex background conditions to some extent. However, since cracks typically exhibit slender, low-contrast, and unevenly distributed structural features, subtle crack information is easily lost during multi-layer downsampling in deep networks, resulting in insufficient representation of the continuity of crack structures.
[0006] Both traditional image processing methods and deep learning-based crack detection methods typically output crack edge maps or crack segmentation maps. In these results, the crack structure often appears as multiple discrete crack segments, and due to image noise, occlusion, and edge detection errors, these crack segments usually exhibit varying degrees of breakage. If crack analysis relies solely on the original edge detection or segmentation results, it is difficult to accurately reconstruct the complete crack path, thus affecting the calculation of key parameters such as crack length, direction, and structural morphology.
[0007] To address the problem of crack fragment fracture, existing methods typically connect crack fragments using morphological closing operations, region growing, or distance-based connection strategies. However, these methods mostly rely on local geometric rules, such as simple conditions like endpoint distance or orientation difference, for connection judgment, lacking a systematic modeling of the overall crack structure characteristics. When the structural surface has a complex texture background or multiple cracks are close to each other, incorrect connections or missed connections are prone to occur, thus reducing the accuracy of crack structure reconstruction.
[0008] In summary, existing crack detection technologies still have the following shortcomings: First, crack detection results often show a large number of discrete crack segments, making it difficult to directly form a continuous crack structure; second, most existing crack connection methods rely on simple local geometric rules and lack a global structural optimization mechanism, which easily leads to false connections; third, in the process of connecting crack segments, there is a lack of comprehensive modeling of the overall structural characteristics of the crack path, making it difficult to simultaneously consider multiple factors such as connection cost, crack path length, and the number of isolated crack segments.
[0009] Therefore, there is an urgent need in this field for a crack detection method that can effectively solve the above-mentioned technical problems, so as to achieve accurate connection of crack segments and complete path recovery. Summary of the Invention
[0010] The purpose of this application is to provide a global optimization and reconstruction method and system for crack detection in structural detection, which can improve the accuracy and continuity of crack detection in complex scenarios.
[0011] The technical solution provided in this application is as follows:
[0012] In a first aspect, this application provides a global optimization and reconstruction method for crack detection in structural testing, comprising the following steps:
[0013] S1. Image preprocessing and crack fragment extraction: The image data of the surface of the structure to be detected is preprocessed, crack detection is performed on the preprocessed image, and connected component analysis is performed on the crack detection results to obtain a discrete set of crack fragments.
[0014] S2. Extraction of geometric features of crack segments: Extract geometric features for each crack segment in the crack segment set to form the geometric feature information of each crack segment;
[0015] S3. Candidate Connection Set Construction: Based on the geometric feature information of the crack fragments, calculate the spatial adjacency distance for each crack fragment pair, and select the crack fragment pairs that meet the conditions according to the preset spatial neighborhood threshold to construct a candidate connection set.
[0016] S4. Crack Connection Graph Construction: Construct a crack connection graph using crack segments as nodes and crack segment pairs in the candidate connection set as edges.
[0017] S5. Construction of connection probability feature vector: For each candidate connection corresponding to each edge in the crack connection graph, extract its connection probability features and construct a connection probability feature vector.
[0018] S6. Construction of probabilistic graphical model: Based on the connection probability feature vector, a crack connection likelihood model is established. Combined with the physical topological characteristics of the crack, a structural prior model is constructed. The likelihood model and the prior model are fused to obtain the probabilistic graphical model of the crack structure.
[0019] S7. Global Energy Function Construction: The maximum a posteriori probability estimation problem of the probabilistic graphical model is transformed into an energy minimization problem, and the corresponding global energy function of the crack structure is constructed.
[0020] S8. Energy Minimization Iterative Optimization: The maximum a posteriori probability inference algorithm based on dynamic updating of structural state is adopted to iteratively optimize the crack connection graph with the goal of minimizing global energy, and to select the set of connection edges that minimizes global energy.
[0021] S9. Global Crack Optimization and Reconstruction: Update the crack connection graph based on the optimized set of connection edges to obtain the optimal crack connection graph. Merge crack segments according to the connection relationship of the graph to achieve global optimization and reconstruction of the crack structure.
[0022] Further, in S1, the preprocessing includes at least one of image size normalization, grayscale normalization, noise filtering, and contrast enhancement; the crack detection uses an edge detection operator to perform gradient analysis on the preprocessed normalized image to obtain a crack edge response map, and then performs connected component analysis on the crack edge response map to obtain a discrete set of crack segments.
[0023] Furthermore, in S2, the geometric features include the length of the crack segment, the principal orientation angle, and the endpoint position; the length of the crack segment is the cumulative path length obtained by successively accumulating the Euclidean distances of adjacent pixels in the crack segment, the principal orientation angle is calculated by least squares fitting the crack segment as a straight line model, and the endpoint position is the coordinates of the pair of pixels with the largest Euclidean distance in the pixel set of the crack segment.
[0024] Furthermore, in S3, for each pair of crack segments, the spatial adjacency distance is the minimum Euclidean distance among all combinations of the endpoints of the two crack segments, calculated using the following formula: ,in , This is the sequence number of the crack segment. Crack fragment and Spatial adjacency distance, Crack fragment No. The coordinates of the endpoints, These are crack segments. No. The coordinates of each endpoint; the preset spatial neighborhood threshold is set according to the image resolution, crack scale, or average crack width.
[0025] Further, in S5, the connection probability features include spatial distance features, directional difference features, gradient difference features, and grayscale difference features; the spatial distance feature is the spatial adjacency distance between two crack segments, the directional difference feature is the absolute value of the difference in the principal direction angle between the two crack segments, the gradient difference feature is the absolute value of the difference in the average gradient intensity of the local statistical regions of the two crack segments, and the grayscale difference feature is the absolute value of the difference in the average grayscale value of the local statistical regions of the two crack segments; the local statistical region is the region obtained by expanding the neighborhood with a specific radius centered on the pixel set of the corresponding crack segment, and the average gradient intensity and average grayscale value are statistically obtained within this local statistical region.
[0026] Furthermore, in S6, the crack connection likelihood model is established as follows: for any crack segment... and The elements of the connection probability feature vector between the two are weighted and summed, and then converted into values in the interval of 0 to 1 through a monotonic probability mapping function to obtain the crack segment. and The probability of the existence of connections between them ,in Indicates a crack segment and The connection relationship variables between them, when crack segments and When there is a connection relationship ,otherwise The crack connection likelihood model is obtained by multiplying the probabilities of connections between all crack segments, as shown in the formula: in Indicates in Under the conditions The probability of occurrence This represents the set of connection probability eigenvectors for all pairs of crack segments. This represents the set of connection state variables for all crack segment pairs, signifying the overall connection state of the crack connection diagram. Represents the set of candidate connections;
[0027] The prior structural model is: ,in Crack connection diagram The prior probability, This indicates the number of branching nodes in the crack connection diagram. A measure of the complexity of a crack structure (e.g., based on the number of connected edges, node connectivity, etc.). and These are the fork weight and the complexity weight, respectively. Indicating a positive correlation, the above structural prior model represents... and They are positively correlated, that is The value of It increases with the increase of;
[0028] The fusion of the likelihood model and the prior model is as follows: Based on the Bayesian inference principle, the posterior probability model of the crack structure is obtained by fusing the likelihood model and the prior model, and the formula is: ,in This represents the set of observed crack segments. Crack connection structure under conditions The posterior probability, is a normalization constant; the posterior probability model is used as a probabilistic graphical model of the crack structure.
[0029] Further, in S8, the specific process of the energy minimization iterative optimization is as follows: First, calculate the initial energy contribution of all candidate connections based on the existence probability of the candidate connections, sort the candidate connections in ascending order of initial energy contribution, and initialize the crack connection graph with an empty connection edge set; then, select the candidate connection with the smallest energy contribution from the sorted candidate connections, calculate the global energy change of the crack connection graph after adding the candidate connection, and if the global energy change is less than 0, accept the candidate connection and update the connection edge set of the crack connection graph; after each update, recalculate the prior correlation of the crack structure and the energy contribution of each candidate connection, reorder the candidate connections and continue iterating until the candidate connections are traversed or the global energy function converges, and obtain the optimal connection edge set.
[0030] Furthermore, the formula for calculating the initial energy contribution is as follows: ,in Crack fragment and The initial energy contribution of the connection relationship between them; the global energy change is the difference between the global energy function value of the crack connection map after the candidate connection is added and before the addition.
[0031] Secondly, this application provides a global optimization and reconstruction system for crack detection in structural testing, comprising:
[0032] The image preprocessing and crack fragment extraction module is used to preprocess the image data of the surface of the structure to be detected, perform crack detection on the preprocessed image, and perform connected component analysis on the crack detection results to obtain a discrete set of crack fragments.
[0033] The crack segment geometric feature extraction module is used to extract geometric features for each crack segment in the crack segment set, forming the geometric feature information of each crack segment;
[0034] The candidate connection set construction module is used to calculate the spatial adjacency distance for each crack segment pair based on the geometric feature information of the crack segments, and to select the crack segment pairs that meet the conditions according to the preset spatial neighborhood threshold to construct the candidate connection set.
[0035] The crack connection graph creation module is used to create a crack connection graph with crack segments as nodes and crack segment pairs in the candidate connection set as edges.
[0036] The connection probability feature vector construction module is used to extract the connection probability features of each candidate connection corresponding to each edge in the crack connection graph and construct the connection probability feature vector.
[0037] The probabilistic graphical model building module is used to establish a crack connection likelihood model based on the connection probability feature vector, construct a structural prior model by combining the crack physical topological characteristics, and obtain a probabilistic graphical model of the crack structure by fusing the likelihood model and the prior model.
[0038] The global energy function construction module is used to transform the maximum a posteriori probability estimation problem of the probabilistic graphical model into an energy minimization problem and construct the corresponding global energy function for the crack structure.
[0039] The energy minimization iterative optimization module is used to perform iterative optimization of the crack connection graph with the goal of minimizing global energy by using the maximum a posteriori probability inference algorithm based on dynamic updating of structural state, and to select the set of connection edges that minimizes global energy.
[0040] The global crack optimization and reconstruction module is used to update the crack connection graph based on the optimized set of connection edges, obtain the optimal crack connection graph, and merge crack segments according to the connection relationship of the graph to achieve global optimization and reconstruction of the crack structure.
[0041] Thirdly, this application provides an electronic device, including: a memory and a processor;
[0042] The memory is used to store computer programs;
[0043] The processor is used to invoke the computer program to execute the method described above.
[0044] Fourthly, this application provides a computer-readable storage medium storing a computer program that, when executed on an electronic device, causes the electronic device to perform the method described above.
[0045] Fifthly, this application provides a computer program product, including a computer program that, when run on an electronic device, causes the electronic device to perform the method described above.
[0046] The specific implementation methods of the second to fifth aspects of this application can refer to the implementation methods of the first aspect, and will not be elaborated here.
[0047] The global optimization and reconstruction method and system for structural crack detection proposed in this application have the following significant advantages compared with existing technologies:
[0048] This application overcomes the limitations of traditional local geometric rule connections. By constructing a crack connection graph, discrete crack segments are modeled as graph nodes. Candidate connections are selected based on spatial adjacency distance. Combining multi-dimensional connection probability features such as spatial distance, direction difference, gradient difference, and grayscale difference, a crack connection likelihood model is established to fully utilize local observation information. At the same time, a structural prior model is introduced, using the number of bifurcation nodes and structural complexity as constraints to suppress unreasonable multi-bifurcation, isolated segments, and other non-physical structures. The optimal connection selection is completed under the global energy optimization framework, fundamentally solving the pain points of unrepaired crack fractures and misconnections in existing technologies. It can achieve accurate global connection of crack segments and significantly improve the accuracy of crack reconstruction.
[0049] This application, based on the Bayesian inference principle, integrates the crack connection likelihood model and the structural prior model to construct a crack structure probabilistic graphical model, transforming the maximum a posteriori (MAP) inference into a global energy minimization problem. Through a MAP iterative optimization algorithm based on dynamic updates of structural state, the algorithm uses the global energy change before and after connection addition as the decision criterion to achieve competitive selection of connection structures. Even under harsh conditions such as complex texture backgrounds, noise interference, and uneven illumination, it can still stably recover complete crack paths that conform to physical laws, significantly improving the algorithm's environmental adaptability and robustness in complex scenarios.
[0050] The structural prior model in this application closely matches the physical properties of real material cracks. It uses the number of branching nodes and structural complexity (number of connecting edges, node connectivity, etc.) of the crack connection diagram as constraints to construct a model that closely resembles the crack's crack structure. Positively correlated prior probabilities constrain the rationality of crack structures at a global level, avoiding the generation of abnormal crack topologies that do not conform to engineering realities. The final output complete crack path contains full-dimensional information such as location, length, direction, and topology, which can be directly used for health monitoring and damage assessment of infrastructure such as concrete bridges, tunnel linings, dams, and industrial components, and has extremely high engineering application value. Attached Figure Description
[0051] Figure 1 This is a flowchart of one embodiment of the present application. Detailed Implementation
[0052] To enable those skilled in the art to better understand the present application, the technical solution of the present application will be further described in detail below with reference to the embodiments and accompanying drawings.
[0053] This application addresses the problems of easy breakage at the crack edges and difficulty in structural continuity in existing crack detection methods. It aims to solve the problem of connecting discrete crack segments after crack detection or segmentation, and can be widely applied to the health monitoring and damage assessment of infrastructure such as concrete bridges, tunnel linings, dams and industrial components. This technology proposes a crack fragment reconstruction method and system based on graph optimization and competitive connection mechanisms. The core idea is to construct crack fragments as graph structure nodes. First, the input image is preprocessed and edge detected to extract discrete crack fragments and establish geometric features including length, direction, and endpoints. Then, a candidate connection set and crack connection graph are established based on the minimum Euclidean distance between the fragment endpoints. Next, feature vectors composed of spatial distance, direction difference, gradient difference, and grayscale difference are extracted. A connection likelihood model is established by combining spatial geometry and image texture features. Simultaneously, a structural prior model reflecting the physical topological characteristics of the crack and suppressing bifurcation and complexity is introduced. These two models are then fused to construct a probabilistic graphical model and a global energy function based on negative log-likelihood. Finally, a maximum a posteriori probability (MAP) inference algorithm based on dynamic updates of structural states is used. Under the framework of global energy minimization, the overall energy change before and after adding connections is iteratively compared to achieve competitive selection and reconstruction of the optimal crack connection structure. The connection decision takes into account geometric feature consistency, image texture matching degree, and global structural constraints, ultimately achieving optimal connection and overall path recovery of crack fragments. This effectively improves the accuracy and physical rationality of crack structure recovery under complex texture backgrounds and noise interference.
[0054] Example 1:
[0055] like Figure 1As shown, this application provides a crack connection optimization method based on a probabilistic graphical model, which mainly includes steps such as crack segment extraction and geometric feature representation, candidate connection set construction and crack connection graph representation, crack connection probabilistic feature modeling, and crack structure inference based on the probabilistic graphical model. Each step is described in detail below.
[0056] (I) Crack fragment extraction and geometric feature representation:
[0057] First, image data of the surface of the structure to be detected is acquired, and the image data is preprocessed to obtain a standardized image, which improves the stability of subsequent crack edge detection and crack structure analysis.
[0058] In some embodiments, image data of the surface of the structure to be inspected can be acquired using an industrial camera, a mobile inspection terminal, or a drone acquisition device.
[0059] Preprocessing operations may include image size normalization, grayscale normalization, noise filtering, and contrast enhancement to improve the identifiability of cracked areas. These preprocessing operations can be represented as: ;in, This represents the original acquired image of the structural surface. This represents an image preprocessing function, which converts the original image into standardized image data with a uniform size and grayscale range. In a preferred embodiment, this function may include image size normalization, grayscale value linear normalization, and noise suppression operations such as median filtering or Gaussian filtering. This represents the standardized image generated after transformation by the preprocessing function, which is then used for subsequent calculations.
[0060] Crack detection is then performed on the preprocessed image to obtain the crack pixel regions. Crack detection can be achieved using existing image processing methods or deep learning methods, such as crack recognition algorithms based on edge detection, threshold segmentation, or convolutional neural networks.
[0061] In some embodiments, crack detection includes: extracting crack edge information from a standardized image. This is achieved using an edge detection operator. Gradient analysis is performed on the input standardized image to obtain the crack edge response map. The crack edge extraction process can be represented as: ;in This represents the edge detection operator. This represents the crack edge response image. In this response image, regions with larger pixel values indicate locations in the image where grayscale changes are significant; these locations typically correspond to crack edges or structural texture edges. In a preferred embodiment, an edge detection algorithm based on gradient magnitude and a dual-threshold connection strategy can be used.
[0062] By performing connected region analysis on the crack detection results (such as crack edge response maps), continuous crack pixels can be divided into several crack segments, thus forming a set of crack segments.
[0063] In some embodiments, after obtaining the crack edge response map, independent structural (crack segment) units in the crack edge are extracted through connected component analysis, thereby obtaining multiple discrete crack segments. The set of crack segments is defined as follows: ;in Indicates the first A crack segment, This represents the total number of crack fragments extracted from the image.
[0064] For each crack segment, its geometric information can be further extracted, including the endpoint position of the crack segment and the local direction information of the crack.
[0065] Each crack segment consists of a set of spatially continuous edge pixels, and its pixel set can be represented as: ;in, Represents the set of edge pixels. Indicates a crack segment The Middle The coordinates of each edge pixel. Indicates a crack segment The total number of pixels contained, and the pixel coordinates are usually represented as a two-dimensional vector in the form of image coordinates.
[0066] Crack fragment representation is used to characterize the geometric features of the extracted discrete fragments.
[0067] To describe the geometric features of a crack segment, its length parameter needs to be calculated for each segment. The crack segment length is defined as the cumulative distance (cumulative path length) of the crack segment pixels along the path, and can be expressed as:
[0068] ;
[0069] in Indicates a crack segment The length (the cumulative distance of the crack fragment pixels along the path). and Represents the coordinates of two adjacent pixels in a crack segment, symbol This represents the Euclidean distance operation, which calculates the path length of the crack segment in the image space by accumulating the distances between adjacent pixels.
[0070] To further describe the spatial propagation direction of the crack segment, it is necessary to calculate the principal direction parameters of the crack segment. Let the set of pixel coordinates of the crack segment be... An approximate linear model of the crack segment can be obtained using the least squares fitting method:
[0071] ;
[0072] in The slope parameter represents the line fitted to the crack segment. This represents the line intercept parameter. The principal orientation angle of the crack segment can be further calculated based on the slope of the fitted line.
[0073] ;
[0074] in Indicates a crack segment The principal direction angle is used to describe the direction of crack segment propagation in the image.
[0075] To describe the possible connections between crack segments, it is necessary to further determine the endpoints of the crack segments. Let the crack segments be... The two endpoints are respectively .
[0076] In a preferred embodiment, this can be achieved by using the pixel set. Find the pair of pixels that are furthest apart (maximum Euclidean distance) to obtain the two endpoints of the crack segment. and .Right now:
[0077] ;
[0078] in, This represents the set of pixels in a crack segment, that is, the set of coordinates of all edge pixels contained in the segment. and express The coordinates of any two pixels in the image. (Symbol) This indicates that Euclidean distance calculation is performed, and the final generated endpoint pairs are taken from a set of pixel coordinate combinations that maximize the distance function.
[0079] Through the above steps, the system can extract multiple crack segments with clear geometric properties from the original crack edge map, and establish structural features such as length parameters, orientation parameters, and endpoint positions for each crack segment, thereby providing basic data for subsequent modeling of crack segment connection relationships.
[0080] (II) Construction of candidate connectivity set and representation of crack connectivity diagram:
[0081] Candidate connection construction is used to build a graph structure based on the spatial adjacency between fragment endpoints.
[0082] After obtaining the set of crack fragments, it is necessary to analyze the spatial relationships between different crack fragments to determine possible crack connection relationships. To this end, a set of candidate crack connections is constructed in the system, and a crack connection graph structure is built based on this.
[0083] Let the set of crack segments be:
[0084] ;
[0085] in Indicates the first Each crack segment has two endpoints. and .
[0086] For any two crack segments and There are four possible combinations of endpoints, therefore the spatial distance between two crack segments is defined as the minimum Euclidean distance among all endpoint combinations:
[0087] ;
[0088] in Indicates a crack segment With crack fragments Spatial adjacency distance, i.e. and The minimum endpoint distance between them (the minimum Euclidean distance in the endpoint combination). Indicates a crack segment The endpoint coordinates Indicates a crack segment The endpoint coordinates, variables and The variable is used as an index to iterate through the endpoint combinations, and its final value is determined by selecting the minimum distance calculated from the four endpoint pairing combinations. This represents the Euclidean distance operation, which selects the group with the smallest distance among four combinations of endpoints as the connection distance between crack segments, and can more accurately characterize the degree of spatial adjacency between two crack segments.
[0089] To determine whether two crack segments have a potential connection, a spatial neighborhood threshold is set. When satisfied At that time, it was considered that the crack fragments With crack fragments They are in adjacent regions in space, which allows for the establishment of candidate connections between two crack segments.
[0090] The spatial neighborhood radius can be set according to the image resolution or crack scale. In a preferred embodiment, it can be set according to the average crack width or crack detection resolution, for example, taking a number of times the average crack width as the neighborhood radius.
[0091] All crack fragment pairs that satisfy the spatial adjacency condition constitute the candidate connection set:
[0092] ;
[0093] in Indicates a crack segment With crack fragments There are potential connections between them.
[0094] After obtaining the set of crack fragments and the set of candidate connections, the crack connection graph structure can be constructed:
[0095] ;
[0096] in This represents the set of nodes in the graph, corresponding to the set of crack segments. ,Right now , This represents the set of edges in the graph, and the corresponding set of candidate connections. .
[0097] In this graph structure, each node represents a crack segment, and each edge represents a possible connection between two crack segments. This graph structure transforms the problem of connecting crack segments into a unified edge selection problem, thus providing a consistent data structure foundation for subsequent crack connection probability feature modeling and crack structure optimization calculations.
[0098] Through the above process of crack fragment extraction and candidate connection set construction, the system can convert the original crack edge detection results into a structured crack connection graph model, so that the potential connection relationship between crack fragments can be uniformly represented in the graph structure, laying the foundation for subsequent crack structure inference models and connection optimization algorithms.
[0099] (III) Crack connection probability feature modeling:
[0100] After constructing the crack fragment set and candidate connectivity graph structure, it is necessary to further establish a probabilistic feature model of the connectivity relationships between crack fragments to assess the probability that two crack fragments belong to the same physical crack path. Since cracks in real materials typically exhibit continuously extending geometric structures, adjacent crack fragments usually show high consistency in spatial location, orientation changes, and image texture structure. Based on this physical characteristic, this application constructs crack connectivity probabilistic features from two aspects: spatial geometric features and image structural features.
[0101] In some embodiments, the crack connection probability features include spatial distance features, orientation difference features, gradient difference features, and grayscale difference features. Specifically, the spatial distance feature describes the spatial proximity between the endpoints of two crack segments; the orientation difference feature describes the continuity between the extension directions of two crack segments; the gradient difference feature describes the consistency of the edge intensity of the crack region; and the grayscale difference feature describes the consistency of the brightness distribution in the crack region.
[0102] First, define the spatial distance characteristics between crack segments.
[0103] Each crack segment has two endpoints.
[0104] For any two candidate connected crack segments and Its spatial distance is defined as the minimum Euclidean distance among all combinations of endpoints:
[0105] ;
[0106] in Indicates a crack segment With crack fragments The spatial distance between two crack segments is used to characterize how close they are in space. When a crack extends continuously along the surface of a structure, the distance between adjacent crack segments is typically small, and therefore smaller. This indicates a higher likelihood of connection.
[0107] Furthermore, to describe the consistency of crack propagation direction, a direction difference feature is introduced. Let the crack segment... and The principal direction angles are respectively and Then the direction difference is defined as:
[0108] ;
[0109] in This indicates the degree of directional difference between two crack segments. When a crack extends continuously, the directional change between adjacent crack segments is usually small; therefore, a smaller directional difference indicates a higher degree of structural continuity.
[0110] In addition to geometric features, cracked regions typically exhibit a certain degree of consistency in image texture structure. Therefore, this application further introduces gradient features and grayscale features.
[0111] When calculating gradient and grayscale features, a local statistical region needs to be defined around the crack fragment. In some embodiments, the region where the crack fragment is located is defined as a local pixel region formed within a certain neighborhood around the crack fragment pixel set. In a preferred embodiment, this region can be obtained by expanding the neighborhood of the crack fragment pixel set by a fixed radius, that is, setting a strip-shaped region with a certain distance around the edge pixels of the crack fragment, and statistically analyzing the image gradient features within this region to obtain the average gradient intensity of the crack fragment region. The average gradient intensity of the crack fragment region is obtained by statistically analyzing the image gradient intensity and grayscale value within this region. and average gray value .
[0112] Suppose a crack segment The average gradient intensity in the region is Crack fragments The average gradient intensity in the region is The gradient difference is then defined as:
[0113] ;
[0114] in This represents the difference (gradient difference) between the average gradient intensities of two crack segment regions.
[0115] Further set crack segments The average gray value of the area is Crack fragments The average gray value of the area is Then the grayscale difference is defined as:
[0116] ;
[0117] in This represents the difference (grayscale difference) between the average grayscale values of two crack segment regions. The average grayscale value of the crack segment region is also statistically calculated within the aforementioned neighborhood region.
[0118] Based on the aforementioned spatial distance features, orientation features, and image structure features, a corresponding connection probability feature vector can be constructed for each candidate connection. The crack connection probability feature vector can be expressed as:
[0119] ;
[0120] This represents the feature vector representing the probability of crack connection.
[0121] This feature vector is used to describe crack segments. With crack fragments The connection characteristics between them. In the subsequent probabilistic graphical model, this feature vector will serve as the observed feature of the connection relationship, used to establish a probabilistic model of crack connection, thereby providing basic data for crack structure inference.
[0122] Through the above-described crack connection probability feature modeling process, the spatial geometric relationship and image structure information between crack segments can be uniformly represented as feature vectors, providing a unified feature expression basis for subsequent probabilistic modeling and optimization inference of crack structures.
[0123] (iv) Crack structure inference based on probabilistic graphical model:
[0124] Connection optimization computation is used to build a maximum a posteriori probability estimation model on the graph structure. This step first extracts feature vectors containing distance, orientation difference, and image structure differences. Establish the likelihood probability term; then introduce a term that includes the number of fork nodes. With complexity Based on prior constraints, construct the overall energy function of the system. The details are as follows:
[0125] After constructing the crack fragment set and modeling the crack connection probability features, it is necessary to further establish a probabilistic inference model of the crack structure to achieve overall optimization of crack connection relationships. Unlike the traditional method of selecting connections one by one based on local cost functions, this application formulates the crack connection problem as a structural inference problem in a probabilistic graphical model. By establishing a crack connection likelihood model and a crack structure prior model, the crack connection graph with the highest probability is found among all possible connection structures.
[0126] Let the set of crack segments be The crack connection diagram is denoted as: ,in Represents the set of nodes, corresponding to the set of crack fragments. , This represents the final set of connected edges. The crack structure inference problem can be expressed as solving for the optimal crack connection graph structure given observation information of crack segments.
[0127] First, a likelihood model of crack connection is established, that is, a probability model of the existence of connections between crack segments. Let the connection probability eigenvector between crack segments be... Then the crack segment and The probability of the existence of a connection between them can be expressed as: ,in Indicates a crack segment and The connection relationship variables between them, when crack segments and When there is a connection relationship ,otherwise This probability reflects the likelihood that two crack segments belong to the same crack path under the observed characteristic conditions.
[0128] This probability value is calculated from the mapping relationship between the crack connection probability feature vector and the model parameters.
[0129] In a preferred embodiment, the probability of connection between crack segments can be obtained by weighting and combining the connection probability feature vectors and converting them into probability values in the range of 0 to 1 through a monotonic probability mapping function.
[0130] The likelihood of all candidate connections in the entire crack connectivity diagram can be expressed as:
[0131] ;
[0132] in, Indicates in Under the conditions The probability of occurrence This represents the set of connection probability eigenvectors for all pairs of crack segments. This represents the set of connection state variables for all crack segment pairs, signifying the overall connection state of the crack connection diagram. Represents the set of candidate connections. For defined in set The binary join variable on. When hour, ;when hour, , express and The difference set.
[0133] After establishing the crack connection probability model, it is also necessary to constrain the overall rationality of the crack structure. Therefore, this embodiment introduces a priori model of the crack structure to constrain the overall structural complexity of the crack connection diagram. Let the crack connection diagram structure be... The corresponding structural prior probability can be expressed as: It is used to characterize the overall rationality of the crack structure.
[0134] Cracks in real materials typically exhibit relatively continuous path structures with fewer branching or isolated segments. To avoid generating unreasonable crack structures, this application constrains the overall structure of the crack connection graph by constructing a prior function for the crack structure. In the specific implementation, this prior probability is modeled through the structural complexity of the crack connection graph. For example, the complexity of the crack structure is measured by graph structure indicators such as the number of crack connection edges, node connectivity, and the number of branching nodes, thereby suppressing unreasonable crack connection structures and ensuring that the reconstructed crack path conforms to the real physical topology.
[0135] Let the prior probability of the cracked structure be:
[0136] ;
[0137] in This represents the prior probability of the crack connection diagram structure. This indicates the number of branching nodes in the crack connection diagram. A measure of the complexity of crack structures. and The weight parameters are the bifurcation weight and complexity weight, respectively, used to adjust the influence of different structural constraints on the prior model. This prior model can reduce the probability of unreasonable structures appearing during the optimization process. By taking the negative logarithm of the probability values, the maximum a posteriori probability estimation problem is transformed into an equivalent energy minimization problem.
[0138] Based on the likelihood model and the prior model, a global probabilistic model of the crack connection diagram can be constructed. If the observed set of crack segments is... The crack connection diagram structure The posterior probability can be expressed as .
[0139] According to the Bayesian inference principle, this posterior probability can be expressed as:
[0140] ;
[0141] in This represents the set of observed crack segments. Crack connection structure under conditions The posterior probability, This is the normalization constant.
[0142] Based on this, the optimal crack connection structure can be determined using the maximum a posteriori probability inference method. Specifically, it is necessary to find the crack connection pattern that maximizes the a posteriori probability among all possible crack connection patterns, i.e.:
[0143] ;
[0144] in This represents the optimal crack connection diagram structure.
[0145] This optimization problem is the maximum a posteriori estimation problem for cracked joint structures. Due to the normalization constant... With structure Since it is irrelevant, the problem can be further transformed into:
[0146] ;
[0147] In practical calculations, the crack connection structure can be solved using an iterative optimization approach. First, candidate connections are initialized and sorted based on their connection probabilities. Then, higher-probability candidate connections are progressively added to the current crack connection graph structure. After each connection operation, the current crack structure state is updated, and the connection probabilities of relevant candidate connections are recalculated, thus forming a state-driven iterative optimization process. By continuously updating the crack connection graph structure, the crack connection result that maximizes the overall posterior probability is finally obtained.
[0148] After obtaining the optimal crack connectivity graph structure, the original crack segments can be merged according to the connectivity relationships in the graph structure to reconstruct the complete crack path. The final output includes complete crack structure information, including crack path location, crack length, and crack topology.
[0149] By constructing the above probabilistic graphical model, the crack connection problem is transformed from a traditional local connection rule selection problem into a global structure inference problem in a probabilistic model. This enables crack connection decisions to be uniformly optimized under the constraints of the overall structure, thereby significantly improving the continuity and structural rationality of crack path recovery and providing a clear theoretical basis for the design of subsequent crack structure inference algorithms.
[0150] (v) Maximum A Posteriori (MAP) inference algorithm for cracked structures:
[0151] Crack structure reconstruction is used to perform MAP inference based on dynamic state updates. Candidate connections are sorted according to their initial energy, and the energy change after adding a new edge is calculated iteratively. ;like The connection is then accepted and the graph structure state is dynamically updated until the energy function converges to output the optimal crack path. The details are as follows:
[0152] After completing the probabilistic feature modeling of crack connections and the construction of the crack structure probabilistic model, it is necessary to further design specific solution algorithms to obtain the optimal crack connection structure in the sense of maximum posterior probability. Based on the aforementioned probabilistic graphical model, the crack structure inference problem can be expressed as finding the crack connection graph with the highest posterior probability among all possible connection structures, i.e.:
[0153] ;
[0154] in This represents the structure of a crack connection diagram. This represents the set of observed crack fragments. This represents the posterior probability of a cracked joint structure under the observed data conditions. This represents the optimal crack connection structure obtained from the final inference.
[0155] Since the posterior probability satisfies the Bayesian relation:
[0156] ;
[0157] Therefore, the maximum a posteriori estimation problem can be transformed into:
[0158] ;
[0159] In the actual solution process, to facilitate optimization calculations, the negative logarithm of the above probability expression can be taken, transforming it into an equivalent energy minimization problem:
[0160] ;
[0161] in The energy function of a crack structure is defined as follows:
[0162] ;
[0163] in This represents the set of selected connection edges in the current crack connection graph. Indicating in connection probability features Crack fragments under conditions and The probability of the existence of connections between them. This represents the prior probability of a cracked structure. The energy function, composed of the connection likelihood term and the structural prior term, is used to comprehensively evaluate the overall rationality of a cracked connection structure.
[0164] Since the number of candidate connections in the crack connection diagram may be large, the computational complexity of directly performing a global search on all possible structures is high. Therefore, this application designs a MAP inference algorithm based on dynamic updating of structural state. The crack connection structure is gradually constructed through iteration, and the connection probability is recalculated after each structural update, thereby approximating the optimal crack structure.
[0165] First, calculate the initial connection probability for all candidate connections in the candidate connection set. For each candidate connection... Based on the connection probability feature vector Calculate its connection probability And accordingly obtain the corresponding energy contribution. :
[0166] ;
[0167] After completing the initial energy calculation for all candidate connections, a connection energy set can be formed. The candidate connections are then sorted according to their energy from smallest to largest, thus forming a candidate connection sequence. Since smaller energy indicates a higher connection probability, the early connections in the sorted sequence have higher structural rationality.
[0168] The algorithm then proceeds to the structure inference phase. Let the current crack connection diagram be... ,in Indicates the first The set of connections selected in the next iteration, initially in the following state. In each iteration, the connection with the lowest energy is selected from the candidate connection sequence. Update edges as current candidate structures.
[0169] Before adding this connection, its impact on the overall energy function needs to be calculated. Assume that adding the connection results in a new set of connections:
[0170] ;
[0171] The updated crack connection diagram is as follows: Based on the energy function defined in Section 4, the energy difference before and after the structural update can be calculated:
[0172] ;
[0173] variable Representative at the The change in total system energy (energy difference) caused by introducing candidate connection edges during each algorithm iteration is a variable. and These represent the structural energy function values before and after updating the connection state, respectively. The sign of this variable determines the system's decision to accept or reject the current candidate connection.
[0174] When satisfied If the connection is positive, it means that adding the connection can reduce the overall structural energy, thereby increasing the posterior probability of the crack connection structure. In this case, the connection is accepted and the crack connection graph structure is updated; otherwise, the connection is rejected and the next candidate connection is examined.
[0175] After each connection relationship update, it is necessary to recalculate the prior correlation quantities of the crack structure, such as the number of crack paths, path length, and number of bifurcation nodes, to update the prior probability of the structure. Because the structural priors have changed, the energy values of some candidate connections will also change accordingly. Therefore, it is necessary to recalculate the energy of candidate connections based on the updated structural state and reorder the candidate connection sequence.
[0176] Through the iterative inference process of “connection selection - structure update - energy recalculation - priority update”, the crack connection diagram structure can be continuously adjusted as the crack path gradually forms, thereby gradually approaching the optimal crack structure corresponding to the maximum a posteriori probability under the constraints of the overall probability model.
[0177] When the candidate connection set has been traversed or the structural energy function converges (e.g., the energy change is less than a threshold, the number of iterations reaches a preset value, etc.), the algorithm stops iterating and outputs the final crack connection structure. ,in This represents the final set of crack connection edges. Based on this set, the complete crack path structure can be reconstructed, thus obtaining continuous and structurally sound crack detection results.
[0178] Through the MAP inference algorithm described above, the connection decision between crack segments no longer depends on a single local rule, but performs global structural optimization under the probabilistic graphical model and structural prior constraints, so that the crack connection result can simultaneously meet multiple constraints such as spatial continuity, directional consistency and image structural consistency, thereby effectively improving the accuracy and stability of crack path recovery.
[0179] The above method can achieve reliable connection between crack segments under complex background conditions, thereby obtaining a more continuous and complete crack structure and improving the accuracy and stability of crack detection and structural analysis.
[0180] It should be understood that the numbers S1 to S9 in this application are only used to distinguish and facilitate the expression of different steps, and do not necessarily constitute a restriction on the execution order between the steps.
[0181] Experimental verification:
[0182] To verify the reconstruction performance of this method in a challenging environment, this experiment selected road surface cracks, which have the most widespread application scenarios and extremely complex background textures, as the test object. Due to the presence of a large amount of random noise, aggregate interference, and non-uniform lighting, the road surface environment is an ideal scenario for testing the robustness and topology inference capabilities of the crack reconstruction algorithm.
[0183] The experimental dataset consists of 200 high-resolution images of road surface cracks taken in real-world conditions. Complete crack pixel sets were manually annotated to serve as the baseline. The experiment used a random line segment occlusion algorithm to cut the original path, generating test samples with low, medium, and high fracture strengths, corresponding to fracture spacing. Distributed in , , Pixel range. Global energy optimization model. The structural prior penalty term parameter is set as follows: the penalty coefficient for bifurcation nodes. Structural complexity penalty coefficient .
[0184] The core evaluation metrics of the experiment consist of the connectivity restoration index (CRI) and topology accuracy (TA).
[0185] ;
[0186] variable The connectivity restoration index measures an algorithm's ability to eliminate non-physical breaks at the macroscopic topological level. (Variable) Represents the total number of initial discrete fragments generated by random reduction before performing MAP inference; variable This represents the number of independent connected components in the optimal connectivity graph output by the algorithm. The closer the value of this variable is to 1, the higher the integrity of the algorithm in reintegrating fragmented pieces into a continuous physical path.
[0187] ;
[0188] variable Represents the topology reconstruction accuracy, used to evaluate the geometric accuracy of the reconstructed path in pixel space. (Variable) Represents the set of pixel values of the connecting lines generated after MAP inference. (Variable) This variable represents the set of pixels representing the original, complete crack skeleton, which is manually annotated. The validity of the connection is determined by calculating the proportion of the reconstructed lines that fall within the neighborhood of the real path.
[0189] Table 1 records the performance comparison between the method of this application and traditional morphological closing operation and simple distance threshold greedy connection method (Greedy) under different degrees of breakage.
[0190] Table 1: Comparison of performance indicators of different algorithms under different fracture degrees
[0191] ;
[0192] Experimental results show that when dealing with large-span fractures (10-50px), traditional morphological methods lack the ability to infer crack orientation, which is a significant limitation. The metric is only 0.35, accompanied by an extremely high number of faulty connections. While the greedy join method can improve... The accuracy was reduced to 0.65, but the inability to distinguish between noise and the true extension direction led to a significant decrease in topology accuracy. The method proposed in this application maintains... At a high of 0.91, while... The value remained around 0.92, proving the validity of the introduced fork penalty term. With its energy minimization mechanism, it can effectively suppress non-physical misconnections and has strong engineering applicability in complex road surface environments.
[0193] Example 2:
[0194] This embodiment provides a global optimization and reconstruction system for structural crack detection, including:
[0195] The image preprocessing and crack fragment extraction module is used to preprocess the image data of the surface of the structure to be detected, perform crack detection on the preprocessed image, and perform connected component analysis on the crack detection results to obtain a discrete set of crack fragments.
[0196] The crack segment geometric feature extraction module is used to extract geometric features for each crack segment in the crack segment set, forming the geometric feature information of each crack segment;
[0197] The candidate connection set construction module is used to calculate the spatial adjacency distance for each crack segment pair based on the geometric feature information of the crack segments, and to select the crack segment pairs that meet the conditions according to the preset spatial neighborhood threshold to construct the candidate connection set.
[0198] The crack connection graph creation module is used to create a crack connection graph with crack segments as nodes and crack segment pairs in the candidate connection set as edges.
[0199] The connection probability feature vector construction module is used to extract the connection probability features of each candidate connection corresponding to each edge in the crack connection graph and construct the connection probability feature vector.
[0200] The probabilistic graphical model building module is used to establish a crack connection likelihood model based on the connection probability feature vector, construct a structural prior model by combining the crack physical topological characteristics, and obtain a probabilistic graphical model of the crack structure by fusing the likelihood model and the prior model.
[0201] The global energy function construction module is used to transform the maximum a posteriori probability estimation problem of the probabilistic graphical model into an energy minimization problem and construct the corresponding global energy function for the crack structure.
[0202] The energy minimization iterative optimization module is used to perform iterative optimization of the crack connection graph with the goal of minimizing global energy by using the maximum a posteriori probability inference algorithm based on dynamic updating of structural state, and to select the set of connection edges that minimizes global energy.
[0203] The global crack optimization and reconstruction module is used to update the crack connection graph based on the optimized set of connection edges, obtain the optimal crack connection graph, and merge crack segments according to the connection relationship of the graph to achieve global optimization and reconstruction of the crack structure.
[0204] This system can be implemented using a computer system. The modules communicate with each other through a data interface and complete the crack connection optimization process under the control of the computer processor.
[0205] Example 2:
[0206] This embodiment provides an electronic device, including: a memory and a processor;
[0207] The memory is used to store computer programs;
[0208] The processor is configured to invoke the computer program to execute the method as described in Embodiment 1.
[0209] Example 3:
[0210] This embodiment provides a computer-readable storage medium storing a computer program. When the computer program is run on an electronic device, it causes the electronic device to perform the method described in Embodiment 1.
[0211] Example 4:
[0212] This embodiment provides a computer program product, including a computer program that, when run on an electronic device, causes the electronic device to perform the method described in Embodiment 1.
[0213] The specific implementation of the system, electronic device, computer-readable storage medium, and computer program product provided in this application can be referred to the specific embodiments of the above methods, and will not be repeated here.
[0214] Obviously, those skilled in the art should understand that the various units or steps of this application described above can be implemented using general-purpose computing devices. They can be centralized on a single computing device or distributed across a network of multiple computing devices. Optionally, they can be implemented using computer-executable program code, thereby storing them in a storage device for execution by a computing device, or fabricating them separately as individual integrated circuit modules, or fabricating multiple modules or steps into a single integrated circuit module. Thus, this application is not limited to any particular combination of hardware and software.
[0215] The above description is merely a preferred embodiment of this application and is not intended to limit this application. Various modifications and variations can be made to this application by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the protection scope of this application.
Claims
1. A method for crack global optimization reconstruction of structural inspection, characterized in that, Includes the following steps: S1. Image preprocessing and crack fragment extraction: The image data of the surface of the structure to be detected is preprocessed, crack detection is performed on the preprocessed image, and connected component analysis is performed on the crack detection results to obtain a discrete set of crack fragments. S2. Extraction of geometric features of crack segments: Extract geometric features for each crack segment in the crack segment set to form the geometric feature information of each crack segment; S3. Candidate Connection Set Construction: Based on the geometric feature information of the crack fragments, calculate the spatial adjacency distance for each crack fragment pair, and select the crack fragment pairs that meet the conditions according to the preset spatial neighborhood threshold to construct a candidate connection set. S4. Crack Connection Graph Construction: Construct a crack connection graph using crack segments as nodes and crack segment pairs in the candidate connection set as edges. S5. Construction of connection probability feature vector: For each candidate connection corresponding to each edge in the crack connection graph, extract its connection probability features and construct a connection probability feature vector. S6. Construction of probabilistic graphical model: Based on the connection probability feature vector, a crack connection likelihood model is established. Combined with the physical topological characteristics of the crack, a structural prior model is constructed. The likelihood model and the prior model are fused to obtain the probabilistic graphical model of the crack structure. The crack connection likelihood model is established as follows: for any crack segment pair and The connection probability feature vector between the two The elements in the sample are weighted and summed, then converted to values between 0 and 1 using a monotonic probability mapping function to obtain the crack segment. and The probability of the existence of connections between them ,in Indicates a crack segment and The connection relationship variables between them, when crack segments and When there is a connection relationship ,otherwise The crack connection likelihood model is obtained by multiplying the probabilities of connections between all crack segments, as shown in the formula: ,in Indicates in Under the conditions The probability of occurrence This represents the set of connection probability eigenvectors for all pairs of crack segments. This represents the set of connection state variables for all crack segment pairs, signifying the overall connection state of the crack connection diagram. Represents the set of candidate connections; The prior model of the structure is: ,in Crack connection diagram The prior probability, This indicates the number of branching nodes in the crack connection diagram. A measure of the complexity of a crack structure. and These are the fork weight and the complexity weight, respectively. Indicating a positive correlation, the above structural prior model represents... and They are positively correlated, that is The value of varies It increases with the increase of; The fusion of the likelihood model and the prior model is as follows: Based on the Bayesian inference principle, the posterior probability model of the crack structure is obtained by fusing the likelihood model and the prior model, and the formula is: ,in This represents the set of observed crack segments. Crack connection diagram under conditions The posterior probability, is a normalization constant; the posterior probability model is used as a probabilistic graphical model of the crack structure; S7. Global Energy Function Construction: The maximum a posteriori probability estimation problem of the probabilistic graphical model is transformed into an energy minimization problem, and the corresponding global energy function of the crack structure is constructed: ; wherein, is the global energy function of the crack structure, denotes the selected set of connection edges in the current inferred crack connection graph; S8. Energy Minimization Iterative Optimization: A maximum a posteriori probability inference algorithm based on dynamic updating of structural states is used to iteratively optimize the fracture connection graph with the goal of minimizing global energy, selecting the set of connection edges that minimizes global energy. The specific process is as follows: First, calculate the initial energy contribution of all candidate connections based on their existence probability. Sort the candidate connections in ascending order of their initial energy contributions and initialize the cracked connection graph with an empty edge set. Then, select the candidate connection with the smallest energy contribution from the sorted candidate connections and calculate the global energy change after adding the candidate connection to the cracked connection graph. If the global energy change is less than 0, accept the candidate connection and update the edge set of the cracked connection graph. After each update, recalculate the prior correlation of the crack structure and the energy contribution of each candidate connection, re-sort the candidate connections, and continue iterating until the candidate connections are traversed or the global energy function converges, thus obtaining the optimal edge set. The formula for calculating the initial energy contribution is: wherein is the initial energy contribution of the connection relationship between the crack segment and ; The global energy change is the difference between the global energy function value of the push fracture connection diagram after the candidate connection is added and before the addition; S9. Global Optimization and Reconstruction of Cracks: Update the crack connection graph based on the optimized set of connecting edges to obtain the optimal crack connection graph. Merge crack segments according to the connection relationship of the optimal crack connection graph to achieve global optimization and reconstruction of the crack structure.
2. The method of claim 1, wherein, In S1, the preprocessing includes at least one of image size normalization, grayscale normalization, noise filtering, and contrast enhancement; the crack detection uses an edge detection operator to perform gradient analysis on the preprocessed normalized image to obtain a crack edge response map, and then performs connected region analysis on the crack edge response map to obtain a discrete set of crack segments.
3. The method of claim 1, wherein, In S2, the geometric features include the length of the crack segment, the principal orientation angle, and the endpoint position; the length of the crack segment is the cumulative path length obtained by successively accumulating the Euclidean distances of adjacent pixels in the crack segment, the principal orientation angle is calculated by fitting the crack segment as a straight line model using least squares, and the endpoint position is the coordinates of the pair of pixels with the largest Euclidean distance in the pixel set of the crack segment.
4. The method of claim 3, wherein, In S3, for each pair of crack segments, the spatial adjacency distance is the minimum Euclidean distance among all combinations of the endpoints of the two crack segments, calculated using the following formula: ,in , This is the sequence number of the crack segment. Crack fragment and Spatial adjacency distance, Crack fragment No. The coordinates of the endpoints, These are crack segments. No. The coordinates of each endpoint; the preset spatial neighborhood threshold is set according to the image resolution, crack scale, or average crack width.
5. The method of claim 1, wherein, In S5, the connection probability features include spatial distance features, orientation difference features, gradient difference features, and grayscale difference features. The spatial distance feature is the spatial adjacency distance between two crack segments. The orientation difference feature is the absolute value of the difference in the principal orientation angle between the two crack segments. The gradient difference feature is the absolute value of the difference in the average gradient intensity of the local statistical regions of the two crack segments. The grayscale difference feature is the absolute value of the difference in the average grayscale value of the local statistical regions of the two crack segments. The local statistical region is the region obtained by expanding the neighborhood with a specific radius around the pixel set of the corresponding crack segment. The average gradient intensity and average grayscale value are both statistically obtained within this local statistical region.
6. A global optimization and reconstruction system for structural crack detection, characterized in that, The system for implementing the method according to any one of claims 1 to 5 comprises: The image preprocessing and crack fragment extraction module is used to preprocess the image data of the surface of the structure to be detected, perform crack detection on the preprocessed image, and perform connected component analysis on the crack detection results to obtain a discrete set of crack fragments. The crack segment geometric feature extraction module is used to extract geometric features for each crack segment in the crack segment set, forming the geometric feature information of each crack segment; The candidate connection set construction module is used to calculate the spatial adjacency distance for each crack segment pair based on the geometric feature information of the crack segments, and to select the crack segment pairs that meet the conditions according to the preset spatial neighborhood threshold to construct the candidate connection set. The crack connection graph creation module is used to create a crack connection graph with crack segments as nodes and crack segment pairs in the candidate connection set as edges. The connection probability feature vector construction module is used to extract the connection probability features of each candidate connection corresponding to each edge in the crack connection graph and construct the connection probability feature vector. The probabilistic graphical model building module is used to establish a crack connection likelihood model based on the connection probability feature vector, construct a structural prior model by combining the crack physical topological characteristics, and obtain a probabilistic graphical model of the crack structure by fusing the likelihood model and the prior model. The global energy function construction module is used to transform the maximum a posteriori probability estimation problem of the probabilistic graphical model into an energy minimization problem and construct the corresponding global energy function for the crack structure. The energy minimization iterative optimization module is used to perform iterative optimization on the fracture connection graph with the goal of minimizing global energy by using the maximum a posteriori probability inference algorithm based on dynamic updating of structural state, and to select the set of connection edges that minimizes global energy. The global crack optimization and reconstruction module is used to update the crack connection graph based on the optimized set of connection edges, obtain the optimal crack connection graph, and merge crack segments according to the connection relationship of the optimal crack connection graph to achieve global optimization and reconstruction of the crack structure.