A Method and System for Crack Detection in Hydraulic Engineering Based on Intelligent Vision Recognition
By using intelligent visual recognition technology to dynamically adjust image brightness and contrast, and combining morphological operations to optimize crack edges, crack region segmentation and connectivity analysis are performed. This solves the problems of accuracy and efficiency in crack detection in water conservancy projects under complex environments, and achieves efficient and accurate crack location and monitoring.
Patent Information
- Application Number
- CN202510419142.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-03
- Publication Date
- 2025-10-31
- Estimated Expiration
- 2045-04-03
AI Technical Summary
Existing technologies cannot achieve efficient and accurate crack detection in hydraulic engineering projects under complex environments. In particular, under uneven lighting or special environmental conditions, manual detection is easily affected by external factors, making it difficult to identify small or hidden cracks. Furthermore, the difficulty of detection increases in high humidity environments, leading to the failure to detect potential structural problems in a timely manner, thus increasing the complexity and risk of maintenance.
By employing intelligent visual recognition technology, the crack edges are optimized through dynamic adjustment of image brightness and contrast, combined with morphological operations, crack region segmentation and connectivity analysis are performed, and the crack location is determined using geometric constraints, thus generating crack location results.
This technology reduces the difficulty of identification caused by inconsistent lighting in complex backgrounds, ensures the clarity and integrity of crack features, reduces the probability of false detection and missed detection, achieves efficient and accurate crack detection, and provides real-time structural monitoring support.
Smart Images

Figure CN120339222B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of water conservancy engineering technology, and in particular to a method and system for detecting cracks in water conservancy projects based on intelligent visual recognition. Background Technology
[0002] Water conservancy engineering technology involves all engineering projects related to water resource development, utilization and management, including the design, construction, operation and maintenance of facilities such as reservoirs, rivers, lakes, irrigation systems, drainage systems and hydroelectric power stations. In this field, the technologies involved cover many aspects such as water flow control, water quality monitoring, facility structure analysis and irrigation management. With the continuous development of modern technology, water conservancy engineering has also gradually introduced intelligent and automated technical means, such as remote sensing technology, sensor technology, artificial intelligence, Internet of Things and big data analysis.
[0003] Among them, the intelligent visual recognition method for detecting cracks in water conservancy projects mainly applies intelligent visual recognition technology to detect crack problems in water conservancy projects. By automatically detecting and analyzing cracks in water conservancy facilities, the accuracy and efficiency of crack detection can be greatly improved. Especially in complex environments where manual detection is difficult or unable to detect problems in a timely manner, this technology can monitor the health status of water conservancy facilities in real time, which helps to detect and deal with potential structural problems in a timely manner and ensure the safe operation of water conservancy projects.
[0004] Current technologies rely on manual inspection or limited sensor technology for crack detection, which cannot cope with real-time monitoring in complex environments. Under uneven lighting or special environmental conditions, manual inspection is easily affected by external factors, making it impossible to achieve efficient and large-scale crack identification and monitoring. Current technologies lack adaptability and cannot automatically adjust for changes in lighting and other factors that affect the detection results. Furthermore, when cracks are small or hidden, critical crack information may be missed. In addition, in high humidity environments or in situations with standing water, existing technologies may increase the difficulty of detection due to reflection or light spots, making it difficult to achieve rapid and accurate crack detection. This affects the detection effect and the accuracy of the data, resulting in the failure to detect potential structural problems in a timely manner, and increasing the complexity and risk of subsequent maintenance. Summary of the Invention
[0005] The purpose of this invention is to overcome the shortcomings of existing technologies and propose a method and system for detecting cracks in water conservancy projects based on intelligent visual recognition.
[0006] To achieve the above objectives, the present invention adopts the following technical solution: a method for detecting cracks in hydraulic engineering based on intelligent visual recognition, comprising the following steps:
[0007] S1: Acquire images of cracks in water conservancy projects, divide the images into multiple regions, detect the brightness changes in each region, calculate its local contrast, adjust the brightness, refine the contrast between cracks and background by adjusting the regional contrast weights, and obtain the locally enhanced image.
[0008] S2: Based on the locally enhanced image, perform morphological closing operation to fill in the missing parts of the crack edge, eliminate edge distortion caused by noise or uneven lighting, and then remove background noise through morphological opening operation to retain the effective area of the crack, calculate its length, width and curvature, and obtain crack edge optimization information.
[0009] S3: Based on the crack edge optimization information, the crack region is segmented by comparing the image pixel value with the background region pixel value. By analyzing the geometric features of the crack region, it is determined whether there is a breakage or connection problem, and the crack region segmentation result is obtained.
[0010] S4: Based on the crack region segmentation results, perform connectivity analysis on the crack region to determine whether the crack is a continuous crack or an intermittent crack, and analyze the relative positions of the fracture endpoints of the crack to generate crack connectivity detection data.
[0011] The present invention is improved in that the locally enhanced image includes a region image with adjusted brightness, a region image with optimized contrast, and a crack edge refinement image. The crack edge optimization information includes crack edge filling data and crack smoothness data. The crack region segmentation result includes a segmentation threshold, crack region boundary data, and crack endpoint positioning result. The crack connectivity detection data includes crack continuity status and crack fracture endpoint data.
[0012] The present invention is improved in that the step of acquiring the locally enhanced image is specifically as follows:
[0013] S111: Acquire images of cracks in water conservancy projects, divide the images into multiple regions based on illumination information, monitor the brightness changes in each region, calculate its local contrast, and generate local contrast values.
[0014] S112: Based on the local contrast value, adjust the brightness according to the contrast difference of each region by adjusting the contrast weight of each region using the formula:
[0015]
[0016] Obtain the adjusted local contrast CR adjusted , among which, CR i WR represents the local contrast value of region i. i The contrast weight of region i, N crThe total number of regions is represented by ΔLR, which represents the local brightness difference, and CR is represented by CR. max Represents the maximum value of local contrast;
[0017] S113: Based on the adjusted local contrast, optimize the crack edge region, refine the contrast between the crack and the background, and obtain a locally enhanced image.
[0018] The present invention is improved in that the step of obtaining the crack edge optimization information is specifically as follows:
[0019] S211: Based on the locally enhanced image, extract the gray-level gradient and structural direction change values of the crack contour region, perform a closing operation to fill in discontinuous edges, and obtain the edge distortion localization range.
[0020] S212: Call the edge distortion localization interval, analyze the roughness and contour fitting residual of the crack boundary pixels, and determine smoothness and consistency using the formula:
[0021]
[0022] Calculate the crack profile continuity synergy value CE r The edge pixel structure is reconstructed to obtain a smoothed crack contour image, where... Represents the boundary roughness of the k-th pixel. This represents the mean of the boundary roughness. G represents the intensity of the grayscale transition of the k-th pixel. (avg) n represents the average intensity of grayscale jumps. ce Represents the total number of pixels;
[0023] S213: Based on the smoothed image of the crack contour, background noise is removed by opening operation, the effective area of the crack is retained, the connectivity and closure of the crack are analyzed, the key geometric features of the crack are identified, and crack edge optimization information is obtained.
[0024] The present invention is improved in that the steps for obtaining the crack region segmentation result are specifically as follows:
[0025] S311: Based on the crack edge optimization information, compare the image pixel values with the background region pixel values, analyze the grayscale differences of the data, and determine the key difference baseline by sorting the grayscale differences to obtain the crack pixel difference range.
[0026] S312: Based on the aforementioned crack pixel difference range, analyze the pixel gradient and background intensity difference using the formula:
[0027]
[0028] Obtain the optimal threshold range TB for crack segmentation optFilter the pixel regions that meet the conditions to obtain the crack grayscale boundary optimization parameters, where GB k BE represents the intensity of the local gradient change of the k-th pixel. k DB represents the average pixel intensity of the background within the k-th pixel. k n represents the grayscale difference between the k-th pixel block and its neighboring blocks. ce Represents the total number of pixels;
[0029] S313: Based on the crack grayscale boundary optimization parameters, evaluate the continuity of edge points within the region, determine whether there are breakage or connection problems, locate the endpoints and continuous regions of the crack, and obtain the crack region segmentation result.
[0030] The present invention is improved in that the step of obtaining the crack connectivity detection data is specifically as follows:
[0031] S411: Based on the crack region segmentation results, analyze the difference between the Euclidean distance between the start and end points of the main direction coordinate axis and the crack pixel boundary, identify the spatial span and geometric extension direction of the crack line segment, and obtain the crack extension geometry.
[0032] S412: Using the aforementioned crack propagation geometry, combined with the changes in boundary point width and curvature, the following formula is applied:
[0033]
[0034] Calculate the nonlinear variation degree RU of the crack to determine whether the crack is continuous or discontinuous, and obtain the geometric variation trend of the crack, where wu z Let be the width value at the z-th measuring point, wu be the average width, and ku be the width at the z-th measuring point. z Let θu be the curvature value at the z-th measurement point, ku be the average curvature, and θu be the curvature value. z Let θu be the angle of change in direction at the z-th measuring point. max N represents the maximum angle change. ru The number of key measuring points contained in the crack;
[0035] S413: Based on the trend of crack geometric change, analyze the relationship between the distance and angle between crack endpoints, determine whether adjacent crack segments are in a continuous connection state, and generate crack connectivity detection data.
[0036] The present invention is improved in that the steps further include:
[0037] S5: Based on the crack connectivity detection data, the misjudged fracture cracks are located using geometric constraints, the crack position is calibrated according to the crack geometric features, the current position coordinates of the crack are determined, and the geometric shape of the crack is verified to obtain the crack location result.
[0038] The crack location results include crack location coordinates, crack geometry calibration data, and crack correction information.
[0039] The present invention is improved in that the steps for obtaining the crack location result are specifically as follows:
[0040] S511: Based on the crack connectivity detection data, the spatial continuity of the fracture crack is quantitatively measured, and compared with the changes in the regional average crack length and orientation to determine whether the crack has structural fracture, thereby obtaining a fracture crack identification set.
[0041] S512: Based on the fracture crack identification set, analyze the position of the center point and the coordinates of the start and end points of the crack, calculate the deviation between the crack and the average distance between adjacent cracks, evaluate the direction deviation angle, and obtain the crack coordinate offset range.
[0042] S513: Based on the crack coordinate offset range, adjust the position of the center point coordinate of the crack, re-identify its geometric shape, determine the current position coordinate of the crack, and obtain the crack positioning result.
[0043] A hydraulic engineering crack detection system based on intelligent visual recognition, the system comprising:
[0044] The image processing enhancement module acquires images of cracks in hydraulic engineering projects, divides the image into multiple regions based on illumination information, detects brightness changes in each region, calculates its local contrast, adjusts brightness, and refines the contrast between cracks and background by adjusting the regional contrast weights to obtain a locally enhanced image.
[0045] The crack edge optimization module extracts the crack contour based on the locally enhanced image, performs morphological closing operation to fill in the missing parts of the crack edge, eliminates edge distortion caused by noise or uneven lighting, removes background noise through morphological opening operation, and analyzes the crack morphology features based on the geometric features of the crack to obtain crack edge optimization information.
[0046] The crack region segmentation module, based on the crack edge optimization information, compares the image pixel values with the background region pixel values to segment the crack region. By analyzing the geometric features of the crack region, it determines whether there are breakage or connection problems, locates the endpoints and continuous areas of the crack, and obtains the crack region segmentation result.
[0047] Based on the crack region segmentation results, the crack connectivity analysis module performs connectivity analysis on the crack region according to the geometric characteristics of the crack, calculates the fracture endpoints, length, width and curvature of the crack, determines whether the crack is a continuous crack or a discontinuous crack, analyzes the relative positions of the fracture endpoints of the crack, and generates crack connectivity detection data.
[0048] The crack location calibration module uses the crack connectivity detection data to locate misjudged fracture cracks using geometric constraints, calibrates the crack position based on the crack's geometric features, determines the crack's current position coordinates, and obtains the crack location result.
[0049] Compared with the prior art, the advantages and positive effects of the present invention are as follows:
[0050] In this invention, dynamic adjustment of image brightness and contrast makes cracks stand out more against complex backgrounds, especially under uneven lighting, reducing the difficulty of crack identification caused by inconsistent lighting. Morphological operations optimize crack edges, filling in missing parts of the crack, smoothing crack contours, and eliminating noise, thereby ensuring the clarity and integrity of crack features. In the crack segmentation stage, adaptive thresholding and geometric feature analysis accurately determine the fracture and connection status of cracks, achieving precise positioning of crack endpoints and their continuous areas, reducing the probability of false detection and missed detection. Combined with crack connectivity analysis and geometric constraint positioning, the accuracy and reliability of crack location are further improved. It maintains efficient monitoring capabilities under different environmental conditions, accurately calibrating the spatial location of cracks, and providing real-time and accurate detection support for structural monitoring of water conservancy projects. Attached Figure Description
[0051] Figure 1 This is a flowchart of the main steps of the present invention;
[0052] Figure 2 This is a flowchart illustrating the process of acquiring the locally enhanced image in this invention.
[0053] Figure 3 This is a flowchart illustrating the process of obtaining crack edge optimization information in this invention.
[0054] Figure 4 This is a flowchart illustrating the process of obtaining the crack region segmentation results in this invention.
[0055] Figure 5 This is a flowchart illustrating the acquisition of crack connectivity detection data in this invention.
[0056] Figure 6 This is a flowchart illustrating the process of obtaining crack location results in this invention. Detailed Implementation
[0057] To make the objectives, technical solutions, and advantages of this invention clearer, the invention will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the invention.
[0058] In the description of this invention, it should be understood that the terms "length," "width," "upper," "lower," "front," "rear," "left," "right," "vertical," "horizontal," "top," "bottom," "inner," and "outer," etc., indicating orientation or positional relationships, are based on the orientation or positional relationships shown in the accompanying drawings and are only for the convenience of describing the invention and simplifying the description, and do not indicate or imply that the device or element referred to must have a specific orientation, or be constructed and operated in a specific orientation, and therefore should not be construed as a limitation of the invention. Furthermore, in the description of this invention, "a plurality of" means two or more, unless otherwise explicitly specified.
[0059] Example
[0060] Please see Figure 1 This invention provides a technical solution: a method for detecting cracks in hydraulic engineering based on intelligent visual recognition, comprising the following steps:
[0061] S1: Acquire images of cracks in water conservancy projects, divide the images into multiple regions based on illumination information, detect brightness changes in each region, calculate local contrast, adjust brightness for contrast differences in each region, optimize crack edge regions by adjusting regional contrast weights, refine the contrast between cracks and background, and obtain locally enhanced images.
[0062] S2: Based on the locally enhanced image, extract the crack contour, perform morphological closing operation to fill in the missing parts of the crack edge, smooth the crack contour, eliminate edge distortion caused by noise or uneven lighting, and then remove background noise through morphological opening operation to retain the effective crack area. Based on the geometric features of the crack, calculate its length, width and curvature, analyze the crack morphological features, and obtain crack edge optimization information.
[0063] S3: Based on crack edge optimization information, the optimal threshold range is determined by comparing the image pixel value with the background region pixel value, the crack region is segmented, and the existence of breakage or connection problems is determined by analyzing the geometric features of the crack region. The endpoints and continuous regions of the crack are located to obtain the crack region segmentation result.
[0064] S4: Based on the crack region segmentation results, according to the geometric characteristics of the crack, perform connectivity analysis on the crack region, calculate the fracture endpoints, length, width and curvature of the crack, determine whether the crack is a continuous crack or a discontinuous crack, analyze the relative positions of the fracture endpoints of the crack, and generate crack connectivity detection data.
[0065] S5: Based on crack connectivity detection data, use geometric constraints to locate misjudged fracture cracks, calibrate the crack position according to the crack geometric characteristics, determine the current position coordinates of the crack, verify the geometric shape of the crack, and obtain the crack location result.
[0066] The locally enhanced image includes the region image after brightness adjustment, the region image after contrast optimization, and the crack edge refinement image. The crack edge optimization information includes crack edge filling data and crack smoothness data. The crack region segmentation results include segmentation threshold, crack region boundary data, and crack endpoint positioning results. The crack connectivity detection data includes crack continuity status and crack fracture endpoint data. The crack positioning results include crack location coordinates, crack geometry calibration data, and crack correction information.
[0067] Please see Figure 2 The specific steps for obtaining the locally enhanced image are as follows:
[0068] S111: Acquire images of cracks in water conservancy projects, divide the images into multiple regions based on illumination information, monitor the brightness changes in each region, calculate its local contrast, and generate local contrast values.
[0069] The process involves acquiring images of cracks in hydraulic engineering projects and dividing them into multiple regions based on illumination information. Each region represents a different part of the crack. The key to this operation is accurately acquiring the brightness information within each region to further analyze the crack characteristics. Then, by monitoring brightness changes in each region, the illumination fluctuations within that region can be analyzed. For example, in a crack image, the brightness value of a certain region may change from 100 to 150 as the illumination changes. This change reflects the contrast between light and dark areas of the crack in that region. To obtain the contrast value, the local contrast of each region needs to be calculated, which is measured by the difference in brightness values within each region of the image. For example, assuming the brightness range of a region is [80, 130], the local contrast of that region is calculated as the difference (130 - 80 = 50). This local contrast can be further quantified using a standardized formula. Through this process, the local contrast values of each region in the image can be obtained, providing basic data support for subsequent brightness adjustment and image optimization.
[0070] S112: Based on the local contrast value, adjust the brightness according to the contrast difference of each area by adjusting the contrast weight of each area using the formula:
[0071]
[0072] Obtain the adjusted local contrast CR adjusted , among which, CR i WR represents the local contrast value of region i. i The contrast weight of region i, N cr The total number of regions is represented by ΔLR, which represents the local brightness difference, and CR is represented by CR. max Represents the maximum value of local contrast;
[0073] Brightness adjustment is performed based on the contrast differences in each region. Therefore, a contrast weight for each region needs to be calculated. This weight depends on the brightness difference between regions. For example, assuming region 1 has a contrast ratio of 60 and region 2 has a contrast ratio of 40, region 1 has a larger brightness variation, so its contrast weight will be higher. The weight can be calculated as the ratio between the region's contrast ratio and its maximum contrast ratio. Assuming the maximum contrast ratio is 100, the contrast weight for region 1 can be calculated as 60 / 100 = 0.6, and the contrast weight for region 2 can be calculated as 40 / 100 = 0.4. If the brightness difference ΔLR between regions is 10, and the maximum local contrast ratio CR... max If the value is 100, substitute it into the following formula for calculation:
[0074]
[0075] By modifying the process, CR is obtained. adjusted =27, this value reflects how the contrast of each region is optimized by adjusting the contrast weight and brightness difference, thus laying the foundation for the subsequent optimization of crack images.
[0076] S113: Based on the adjusted local contrast, optimize the crack edge region, refine the contrast between the crack and the background, and obtain a locally enhanced image;
[0077] By refining the contrast between the crack and the background, the crack becomes more prominent in the image. Based on the adjusted contrast value, further pixel enhancement processing can be performed between regions, such as increasing the contrast of the crack edges to enhance their distinction from the surrounding background. The goal of this operation is to optimize the crack edges, making the crack features more prominent, and ultimately obtaining a locally enhanced image. For example, in the region with an adjusted contrast value of 70, the crack edges change from a previously blurred transition area to a clearly discernible boundary. The optimized crack image will provide more accurate visual information for subsequent analysis.
[0078] Please see Figure 3 The specific steps for obtaining crack edge optimization information are as follows:
[0079] S211: Based on the locally enhanced image, extract the gray-level gradient and structural direction change values of the crack contour region, perform a closing operation to fill in discontinuous edges, and obtain the edge distortion localization interval.
[0080] The enhanced pixel array is extracted from the image input module. The grayscale value of each pixel is read, and its grayscale gradient is calculated sequentially based on a 3×3 neighborhood window. Specifically, the absolute difference between the target pixel and its adjacent pixels (top, bottom, left, and right) is calculated. For example, if the grayscale value of a central pixel is 128, and the grayscale values of the pixels above, below, left, and right are 130, 125, 127, and 129 respectively, the grayscale gradient values are 2, 3, 1, and 1 respectively. The maximum value of the grayscale gradient is 3, which is used to characterize the boundary response intensity at that location. Subsequently, based on the edge structure direction of the image, the gradient direction angle difference between the neighboring pixels is extracted. If the direction angle between adjacent pixels exceeds 45°, it is marked as a structural abrupt change point, and a preliminary edge structure map is established. Then, morphological closing operations are performed on the extracted contours using a 5×5 circular template. The dilation operation expands the edge structure, and the erosion and shrinkage operation merges the broken parts. In the example, there is a breakpoint with a length of 3 pixels at the edge of a crack. After the closing operation, the pixel connectivity is improved, reducing the number of connected components on one side to one closed contour region. After the closing operation, the connected component detection method is called to calculate the continuity and grayscale structure change of the boundary segment. By comparing the number of connected components before and after the closing operation, regions with a change value greater than 2 are selected as candidate regions. At the same time, the average value of the structural direction angle is calculated. If the direction difference of a certain region fluctuates within more than 3 pixels and exceeds 60°, such as 10°, 75°, 25°, 90°, then the boundary of that segment is determined to have distortion. After combining the judgment results, all pixel segments that meet the conditions of connected component change amplitude greater than 2 and structural direction jump amplitude greater than 60° are extracted and defined as edge distortion localization intervals.
[0081] S212: Call the edge distortion localization interval, analyze the roughness of crack boundary pixels and contour fitting residuals, and determine smoothness and consistency using the following formula:
[0082]
[0083] Calculate the crack profile continuity synergy value CE r The edge pixel structure is reconstructed to obtain a smoothed crack contour image, where... Represents the boundary roughness of the k-th pixel, indicating the roughness of that pixel at the crack contour boundary. This is the mean of the boundary roughness, used to calculate the average roughness of the crack boundary in order to normalize the deviation of individual pixels. G represents the intensity of the grayscale transition of the k-th pixel, indicating the degree of grayscale change of that pixel in the image. A high intensity of grayscale transition indicates the presence of an edge or crack. (avg) n is the average grayscale transition intensity, used to calculate the average level of grayscale transition intensity across all pixels, allowing the transition of a single pixel to be compared to the average state. ce Represents the total number of pixels;
[0084] The edge distortion localization interval is invoked, and crack edge pixels within the interval are extracted one by one. Analysis of boundary roughness and grayscale transition intensity is then performed. First, a 3×3 neighborhood window is constructed centered on each edge pixel. The squared difference between the grayscale value of the center pixel and the mean grayscale value of the neighboring pixels is calculated to obtain the boundary roughness value of that pixel. For example, if the grayscale value of the first pixel is 148 and the neighborhood mean is 145, then the roughness is (148-145). 2 =9, which translates to a normalized value of 0.36; the grayscale value of the second pixel is 150, the neighborhood mean is 147, and the roughness is (150-147). 2 =9, normalized to 0.34; the grayscale value of the 3rd pixel is 143, the neighborhood mean is 141, and the roughness is (143-141). 2 =4, normalized to 0.28, then the set of roughness values for 3 pixels in this region is: The average roughness is calculated as follows:
[0085]
[0086] Next, the grayscale transition intensity of each pixel is obtained. Defined as the absolute difference between the current pixel's grayscale value and the average grayscale value of its neighbors, the first pixel has |148-145|=3, the second has |150-147|=3, and the third has |143-141|=2. Therefore, the set of grayscale jump intensities is: The average grayscale jump intensity is:
[0087]
[0088] Substitute the above data into the formula to calculate the crack profile continuity synergy value, and calculate the numerator:
[0089] (0.36-0.3267) 2 =0.0011;
[0090] (0.34-0.3267) 2 =0.0002;
[0091] (0.28-0.3267) 2 =0.0022;
[0092] Total numerator = 0.0011 + 0.0002 + 0.0022 = 0.0035;
[0093] Calculate the denominator:
[0094] |3-2.67|=0.33;
[0095] |3-2.67|=0.33;
[0096] |2-2.67|=0.67;
[0097] Total denominators = 0.33 + 0.33 + 0.67 = 1.33;
[0098] Final CE r for:
[0099]
[0100] The resulting crack contour continuity co-continuity value is approximately 0.00263. Compared with the set benchmark threshold of 0.005, it can be seen that the current crack edge roughness fluctuation amplitude and jump intensity deviation are both at a low level. This value is lower than the benchmark value, indicating that the structural continuity of the crack edge is relatively strong. Contour pixel reconstruction can be performed to reconstruct the crack edge structure in this area and output a smooth crack contour image.
[0101] S213: Based on the smoothed image of the crack contour, background noise is removed by opening operation, the effective area of the crack is preserved, the connectivity and closure of the crack are analyzed, the key geometric features of the crack are identified, and the crack edge optimization information is obtained.
[0102] Erosion and dilation operations are performed on the image using structuring elements with a radius of 3 to remove isolated small regions in the background. After detection and processing, only main crack structures with a connected region length greater than 40 pixels are retained. Subsequently, an equally spaced pixel sequence is established along the main axis within the crack region, and geometric feature analysis is performed on each segment to extract the average width per 10 pixels. If there is a fluctuation of more than 5 pixels in width within a segment, it is defined as a geometric change segment. The curvature value is then calculated using the three-point difference method. If the continuous curvature value in a segment exceeds 1.5 per 10 pixels, it indicates that there is a rapid change in direction in that segment. The curvature calculation uses the formula... Where S is the area of the triangle and L is the average side length. For example, if the coordinates of the three points are (20, 20), (22, 23), and (25, 28), the calculated area S is 7.5 and L is 6.3, then κ≈0.3. Frequency analysis is performed on the curvature values of all segments, and the parts with a frequency greater than 1 time / 10 pixels are identified as abrupt feature segments. Combined with the structural closure index, the judgment standard is set to a closure degree greater than 0.95. For example, if the distance between the beginning and end of the crack is less than 1 pixel, it is considered to be well closed. Finally, the key geometric features of all crack regions that meet the requirements of crack connectivity greater than 50 pixels, average width between 5 and 12 pixels, and curvature frequency between 0.8 and 2.0 are extracted, and crack edge optimization information is output.
[0103] Please see Figure 4 The specific steps for obtaining the crack region segmentation results are as follows:
[0104] S311: Based on crack edge optimization information, compare the image pixel values with the background region pixel values, analyze the grayscale differences of the data, and determine the key difference baseline by sorting the grayscale differences to obtain the crack pixel difference range.
[0105] Pixels near the crack edge and adjacent background regions are extracted from the image. For the image grayscale matrix, two pixels P1 and P2 are selected, located in the crack edge region, and their grayscale values are extracted to be 135 and 140 respectively. Simultaneously, two reference pixels Q1 and Q2 are selected in the image background region, with grayscale values of 120 and 123 respectively. The grayscale difference between the crack edge pixels and the background pixels is calculated. The difference between P1 and Q1 is 135-120=15, and the difference between P2 and Q2 is 140-123=17. The obtained differences form a difference dataset [15, 1]. [7] After sorting the dataset, an ascending sequence [15, 17] is obtained. The first derivative is then calculated, i.e., the difference between the two values is 17-15=2. The change in the difference is used to identify the distribution change point. Due to the small amount of data, the mean of the two values, 16, is directly used as the difference baseline. The difference range [14, 18] is constructed by extending 2 units upward and downward from this value as the center. Combined with the image gray-scale distribution frequency map, values with a difference frequency of less than 5% are removed (assuming that the difference values 13 and 19 have low frequencies and are removed). Finally, the crack pixel difference range is determined to be [14, 18].
[0106] S312: Based on the pixel difference range of the crack, analyze the pixel gradient and the difference in background intensity using the following formula:
[0107]
[0108] Obtain the optimal threshold range TB for crack segmentation opt Filter the pixel regions that meet the conditions to obtain the crack grayscale boundary optimization parameters, where GB k BE represents the intensity of the local gradient change of the k-th pixel. k DB represents the average pixel intensity of the background within the k-th pixel, used to compare the difference with the crack region. k n represents the grayscale difference between the k-th pixel block and its neighboring blocks, used to identify crack edges. ce Represents the total number of pixels;
[0109] Based on the pixel difference interval [14, 18] of the crack, the local gradient values of pixels P1 and P2 in the image are extracted. Let the maximum gray value of the P1 neighborhood be 150 and the minimum be 120, then the local gradient change intensity GB = 150 - 120 = 30. The maximum gray value of the P2 neighborhood is 160 and the minimum is 125, then GB = 35. The average gray value of the 5×5 pixel block surrounding P1 and P2 is used as the average background pixel intensity. Let BE = 125 for the P1 neighborhood and BE = 130 for the P2 neighborhood. Simultaneously, the difference in the average gray value between the P1 and P2 regions and their 8-neighborhoods is measured, set as DB = 6 and DB = 8, respectively. Substituting these values into the formula:
[0110] Item 1:
[0111] Item 2:
[0112] Calculate the mean:
[0113]
[0114] Obtain the optimal threshold range TB for crack segmentation opt = -37.34. Since it is a negative value, it indicates that the gray level of the crack pixel is higher than the background intensity and the gray level of the region is uneven. Subsequently, the gray level boundary interval is transformed by using its absolute value or offset remapping method to obtain the gray level boundary optimization parameters of the crack.
[0115] S313: Based on the crack grayscale boundary optimization parameters, evaluate the continuity of edge points within the region, determine whether there are breakage or connection problems, locate the endpoints and continuous regions of the crack, and obtain the crack region segmentation results.
[0116] Edge point localization analysis is performed on the regions where P1 and P2 are located. The connectivity of eight neighboring pixel groups is evaluated for each pixel. The Euclidean distance between P1 and P2 is calculated. Let the coordinates be (100, 105) and (106, 108) respectively. Then the distance is √((106-100). 2 +(108-105) 2 =√(36+9) =√45≈6.7 pixels. The critical length for fracture judgment is set to 10 pixels. 6.7<10 is judged as a continuous region. Further statistics show that the total number of pixels in the region where P1 and P2 are located is 42, and the region area is 5×10=50 pixels. Then the pixel density = 42 / 50=0.84. The density judgment benchmark value is set to 0.6, which is greater than the threshold and meets the requirement of crack connectivity. Finally, the crack region structure recognition is completed and the crack region segmentation result is obtained.
[0117] Please see Figure 5 The specific steps for obtaining crack connectivity detection data are as follows:
[0118] S411: Based on the crack region segmentation results, analyze the difference between the Euclidean distance between the start and end points of the main direction coordinate axis and the crack pixel boundary, identify the spatial span and geometric extension direction of the crack line segment, and obtain the crack extension geometry.
[0119] Contour pixel tracking is performed on the crack regions in the image to extract the start and end coordinates of each crack region on the principal direction coordinate axis. For example, in a crack, the start coordinates are (120, 340) and the end coordinates are (300, 340). The pixel difference between the two points in the x-axis direction is 180, which can be used as its Euclidean distance. Since the difference in the y-axis is 0, the Euclidean distance is 180 pixels. Then, the edge points of the crack region are filtered, and the outermost boundary pixel points within the principal direction range of the region are selected. For example, the left edge point is (121, 341) and the right edge point is (279, 340). Their pixel spacing is 158 pixels. The difference between the boundary spacing and the principal direction Euclidean distance is 22 pixels, indicating that the edge of the crack region exists. For minor offsets or irregular bends, select a crack segment with start and end points (100, 200) and (280, 210), with a main direction span of 180 pixels and a maximum edge point spacing of 230 pixels, resulting in a difference of 50 pixels. If the maximum reasonable difference threshold is set to 30 pixels, the edge extension of the second crack segment exceeds the control range of the main direction, and it is judged as an irregular extension structure. Further calculate the main direction extension value, edge extension range value, and direction angle difference of each crack segment according to this spatial structure. And construct the spatial span vector set of the crack segment by jointly using the Euclidean distance and boundary difference of each crack segment. Finally, organize the extension direction, pixel length, and edge offset information of multiple crack segments to summarize the crack extension geometry.
[0120] S412: Calling the crack propagation geometry, combined with the changes in boundary point width and curvature, using the following formula:
[0121]
[0122] Calculate the nonlinear variation degree RU of the crack to determine whether the crack is continuous or discontinuous, and obtain the geometric variation trend of the crack, where wu z Let z be the width value of the z-th measuring point. For the average width, ku z Let be the curvature value at the z-th measuring point, which is a quantitative indicator of the degree of crack bending at that point. For the mean curvature, θu z Let θu be the angle of directional change at the z-th measuring point, indicating the degree of deflection of the crack direction at that point. max N represents the maximum angle change. ru The number of key measuring points contained in the crack;
[0123] Suppose two key measuring points are extracted from a crack segment, and their width, curvature, and orientation angle data are collected to quantify nonlinear behavior. Measuring point 1 has a width of 2.0 mm, a curvature of 0.111 / m, and an orientation angle of 16 degrees. Measuring point 2 has a width of 2.3 mm, a curvature of 0.141 / m, and an orientation angle of 20 degrees. Then, the average width of the crack segment, wu, is (2.0 + 2.3) / 2 = 2.15 mm, and the average curvature is... Maximum direction angle θu max =20 degrees, substitute into the formula, where N ru =2, when calculating the first measuring point, |2.0-2.15| / 2.15 = 0.0698, The direction angle ratio is 16 / 20 = 0.8, so the first term is:
[0124] 0.0698 + (0.1225 × 0.8) = 0.0698 + 0.0980 = 0.1678;
[0125] When calculating the second measurement point, |2.3-2.15| / 2.15=0.0698. The direction angle ratio is 20 / 20 = 1, and the second term is:
[0126] 0.0698 + (0.1225 × 1) = 0.0698 + 0.1225 = 0.1923;
[0127] Take the average value:
[0128] RU=(0.1678+0.1923) / 2=0.1801;
[0129] The nonlinear variation degree of the crack was found to be RU = 0.1801. If the threshold is set to 0.12, the crack is judged to be an intermittent crack. Then, the corresponding crack geometric change trend is obtained. By constructing the normalized product of the width deviation ratio, the square root value of the curvature offset and the angle change, a comprehensive nonlinear behavior quantification mechanism is established. It can still form an effective identification standard when the amount of data is small, and realize the numerical quantification and delimitation of complex crack structures such as bending, expansion and folding.
[0130] S413: Based on the trend of crack geometric change, analyze the relationship between the distance and angle between crack endpoints, determine whether adjacent crack segments are continuously connected, and generate crack connectivity detection data;
[0131] For each crack segment, extract the coordinates of the starting and ending points. Construct adjacent crack pairs by combining them in pairs. Calculate the Euclidean distance and the difference in direction angle between each endpoint. Taking crack 1 ending at (120, 200) and crack 2 starting at (130, 198) as an example, the Euclidean distance is... The pixel and the directional angle are 20° and 23.2° respectively, with a difference of 3.2°. If the preset connectivity judgment condition is that the distance between the endpoints is less than or equal to 12 pixels and the angle difference does not exceed 5°, then the crack segment can be regarded as a continuous structure. If there are multiple crack segments that meet the above conditions, the segments are marked as the same crack cluster number, and the corresponding connectivity mapping relationship is recorded. Finally, by comparing the coordinate matching matrix with the directional difference, it is determined whether there is geometric connectivity between all crack segments, and the output is organized into a set of matrix-based connectivity comparison relationships.
[0132] Please see Figure 6 The specific steps for obtaining the crack location results are as follows:
[0133] S511: Based on crack connectivity detection data, the spatial continuity of fracture cracks is quantitatively measured and compared with the changes in regional average crack length and orientation to determine whether there is structural fracture and obtain a fracture crack identification set.
[0134] The cracks were divided into several detection units. The spatial continuity index of each crack was obtained and its measured value was recorded. The measurement method was based on the difference in the length of the connectivity segment between the endpoints of adjacent cracks. A spatial connection network between the cracks and surrounding cracks was constructed. Taking cracks F001 to F004 as examples, their spatial continuity indices were measured to be 3.2m, 2.1m, 5.4m, and 1.6m, respectively. Subsequently, the length of each crack was measured and calculated using the coordinate distance formula. For example, if the starting and ending points of F002 are (2.1, 1.5) and (4.2, 2.3), then its length is √[(4.2-2.1)]. 2 +(2.3-1.5) 2 The deviation of the obtained crack length from the average crack length of 2.5m in the region was approximately 2.3m. The deviation of F002 was found to be 0.2m. Combined with the measurement of the change in direction, the angle between the current crack segment and the adjacent segment was calculated using the line segment direction angle calculation method. The difference between the direction angle of F002 and the average direction angle of the surrounding cracks was 6.3°. The spatial continuity offset of less than 2.5m, the length deviation of no more than ±0.4m, and the change in direction of less than 10° were used as the threshold for structural fracture judgment. Based on this, all cracks were compared and judged item by item. Finally, cracks F002 and F004 that did not meet the judgment criteria were screened out, and the fracture crack identification set was obtained.
[0135] S512: Based on the fracture and crack identification set, analyze the position of the center point and the coordinates of the start and end points of the crack, calculate the deviation between the crack and the average distance between adjacent cracks, evaluate the direction deviation angle, and obtain the crack coordinate offset range.
[0136] The center point positions of F002 and F004 are extracted separately, and their average value is calculated using the start and end coordinates. For example, the center point of F002 is [(4.1+6.5) / 2] = 5.3m. At the same time, the corresponding start and end coordinate data are collected, and the average distance value between F002 and its nearest neighbor crack is calculated. The degree of offset is judged by comparing the difference. For example, the distance between F002 and its adjacent crack is 2.7m. Compared with the set benchmark distance of 2.0m, the deviation is 0.7m, which exceeds the 0.5m distance difference threshold. Then, the orientation deviation angle is evaluated. Using the direction vector angle formula, the deviation angle of F002 is 12.5°, which is 2.5° larger than the benchmark value of 10° for orientation change angle. The spatial offset state of the crack is judged based on the adjacent distance deviation threshold and the orientation deviation angle threshold. The direction component that the crack needs to be corrected is marked as east-northeast on the spatial coordinates, with an offset distance of 0.7m. Thus, the spatial correction vector range of each crack is constructed, and the crack coordinate offset interval is obtained.
[0137] S513: Based on the crack coordinate offset range, adjust the position of the crack center point coordinates, re-identify its geometric shape, determine the current position coordinates of the crack, and obtain the crack location result.
[0138] The center point coordinates of F002 and F004 were adjusted. The original center point of F002 was 5.3m, and the corrected coordinates were shifted 0.7m eastward and northward to obtain a new coordinate of 5.98m. The coordinates of the entire crack were re-extracted for the corresponding correction, and a new crack line segment was constructed. The corrected length and direction angle changes were calculated to obtain geometric morphology indicators. The corrected length of F002 was 2.4m, and the direction angle change was 8.3°. Compared with the original data, the structural offset was found to be reduced. The standard deviation of structural stability was recalculated based on all the corrected crack data. If the standard deviation was less than the initial structural reference variance of 0.35, the morphological stability and positional coordination were confirmed. The crack coordinates that met the conditions were used as the final corrected coordinates to obtain the crack location results.
[0139] A crack detection system for hydraulic engineering based on intelligent visual recognition, the system includes:
[0140] The image processing enhancement module acquires images of cracks in hydraulic engineering projects, divides the image into multiple regions based on illumination information, detects brightness changes in each region, calculates its local contrast, adjusts brightness, and refines the contrast between cracks and background by adjusting the regional contrast weights to obtain a locally enhanced image.
[0141] The crack edge optimization module extracts the crack contour based on the locally enhanced image, performs morphological closing operation to fill in the missing parts of the crack edge, eliminates edge distortion caused by noise or uneven lighting, removes background noise through morphological opening operation, and analyzes the crack morphology features based on the geometric features of the crack to obtain crack edge optimization information.
[0142] The crack region segmentation module is based on crack edge optimization information. It compares the image pixel values with the background region pixel values to segment the crack region. By analyzing the geometric features of the crack region, it determines whether there are breakage or connection problems, locates the endpoints and continuous regions of the crack, and obtains the crack region segmentation result.
[0143] The crack connectivity analysis module performs connectivity analysis on the crack region based on the crack region segmentation results and the geometric characteristics of the crack. It calculates the fracture endpoints, length, width and curvature of the crack, determines whether the crack is a continuous crack or a discontinuous crack, analyzes the relative positions of the fracture endpoints of the crack, and generates crack connectivity detection data.
[0144] The crack location calibration module uses crack connectivity detection data and geometric constraints to locate misjudged fracture cracks. It calibrates the crack position based on the crack's geometric characteristics, determines the crack's current position coordinates, and obtains the crack location result.
[0145] The above are merely preferred embodiments of the present invention and are not intended to limit the present invention in any other way. Any person skilled in the art may make changes or modifications to the above-disclosed technical content to create equivalent embodiments that can be applied to other fields. However, any simple modifications, equivalent changes, and modifications made to the above embodiments based on the technical essence of the present invention without departing from the scope of the present invention shall still fall within the protection scope of the present invention.
Claims
1. A method for detecting cracks in hydraulic engineering based on intelligent visual recognition, characterized in that, Includes the following steps: S1: Acquire images of cracks in water conservancy projects, divide the images into multiple regions, detect the brightness changes in each region, calculate its local contrast, adjust the brightness, refine the contrast between cracks and background by adjusting the regional contrast weights, and obtain the locally enhanced image. S2: Based on the locally enhanced image, perform morphological closing operation to fill in the missing parts of the crack edge, eliminate edge distortion caused by noise or uneven lighting, and then remove background noise through morphological opening operation to retain the effective area of the crack, calculate its length, width and curvature, and obtain crack edge optimization information. S3: Based on the crack edge optimization information, the crack region is segmented by comparing the image pixel value with the background region pixel value. By analyzing the geometric features of the crack region, it is determined whether there is a breakage or connection problem, and the crack region segmentation result is obtained. The specific steps for obtaining the crack region segmentation results are as follows: S311: Based on the crack edge optimization information, compare the image pixel values with the background region pixel values, analyze the grayscale differences of the data, and determine the key difference baseline by sorting the grayscale differences to obtain the crack pixel difference range. S312: Based on the aforementioned crack pixel difference range, analyze the pixel gradient and background intensity difference using the formula: ; Obtain the optimal threshold range for crack segmentation Pixel regions that meet the conditions are selected to obtain the crack grayscale boundary optimization parameters, where, Representing the The intensity of local gradient change in each pixel. Representing the Average background pixel intensity within 1 pixel Representing the The grayscale difference between a pixel block and its neighboring blocks Represents the total number of pixels; S313: Based on the crack grayscale boundary optimization parameters, evaluate the continuity of edge points within the region, determine whether there are breakage or connection problems, locate the endpoints and continuous regions of the crack, and obtain the crack region segmentation result. S4: Based on the crack region segmentation results, perform connectivity analysis on the crack region to determine whether the crack is a continuous crack or an intermittent crack, and analyze the relative positions of the crack fracture endpoints to generate crack connectivity detection data. The specific steps for obtaining the crack connectivity detection data are as follows: S411: Based on the crack region segmentation results, analyze the difference between the Euclidean distance between the start and end points of the main direction coordinate axis and the crack pixel boundary, identify the spatial span and geometric extension direction of the crack line segment, and obtain the crack extension geometry. S412: Using the aforementioned crack propagation geometry, combined with the changes in boundary point width and curvature, the following formula is applied: ; Calculate the nonlinear variation of cracks To determine whether a crack is continuous or discontinuous, the geometric trend of the crack is obtained. For the first Width value of each measuring point Average width, For the first The curvature value at each measuring point For the mean curvature, For the first The angle of change of direction at each measuring point This is the maximum angle change value. This represents the number of key measuring points contained within the crack. S413: Based on the trend of crack geometric change, analyze the relationship between the distance and angle between crack endpoints, determine whether adjacent crack segments are in a continuous connection state, and generate crack connectivity detection data.
2. The method for detecting cracks in hydraulic engineering based on intelligent visual recognition according to claim 1, characterized in that, The locally enhanced image includes a region image with brightness adjustment, a region image with contrast optimization, and a crack edge refinement image. The crack edge optimization information includes crack edge filling data and crack smoothness data. The crack region segmentation result includes segmentation threshold, crack region boundary data, and crack endpoint positioning result. The crack connectivity detection data includes crack continuity status and crack fracture endpoint data.
3. The method for detecting cracks in hydraulic engineering based on intelligent visual recognition according to claim 1, characterized in that, The specific steps for obtaining the locally enhanced image are as follows: S111: Acquire images of cracks in water conservancy projects, divide the images into multiple regions based on illumination information, monitor the brightness changes in each region, calculate its local contrast, and generate local contrast values. S112: Based on the local contrast value, adjust the brightness according to the contrast difference of each region by adjusting the contrast weight of each region using the formula: ; Obtain the adjusted local contrast ,in, Representative area Local contrast value, Representative area Contrast weights, Represents the total number of regions. Represents local brightness differences. Represents the maximum value of local contrast; S113: Based on the adjusted local contrast, optimize the crack edge region, refine the contrast between the crack and the background, and obtain a locally enhanced image.
4. The method for detecting cracks in hydraulic engineering based on intelligent visual recognition according to claim 1, characterized in that, The specific steps for obtaining the crack edge optimization information are as follows: S211: Based on the locally enhanced image, extract the gray-level gradient and structural direction change values of the crack contour region, perform a closing operation to fill in discontinuous edges, and obtain the edge distortion localization range. S212: Call the edge distortion localization interval, analyze the roughness and contour fitting residual of the crack boundary pixels, and determine smoothness and consistency using the formula: ; Calculate the co-value of crack profile continuity The edge pixel structure is reconstructed to obtain a smoothed crack contour image, where... Representing the Boundary roughness per pixel, This represents the mean of the boundary roughness. For the first The intensity of grayscale transitions in each pixel This represents the average intensity of the grayscale jump. Represents the total number of pixels; S213: Based on the smoothed image of the crack contour, background noise is removed by opening operation, the effective area of the crack is retained, the connectivity and closure of the crack are analyzed, the key geometric features of the crack are identified, and crack edge optimization information is obtained.
5. The method for detecting cracks in hydraulic engineering based on intelligent visual recognition according to claim 1, characterized in that, The steps also include: S5: Based on the crack connectivity detection data, the misjudged fracture cracks are located using geometric constraints, the crack position is calibrated according to the crack geometric features, the current position coordinates of the crack are determined, and the geometric shape of the crack is verified to obtain the crack location result. The crack location results include crack location coordinates, crack geometry calibration data, and crack correction information.
6. The method for detecting cracks in hydraulic engineering based on intelligent visual recognition according to claim 5, characterized in that, The specific steps for obtaining the crack location result are as follows: S511: Based on the crack connectivity detection data, the spatial continuity of the fracture crack is quantitatively measured, and compared with the changes in the regional average crack length and orientation to determine whether the crack has structural fracture, thereby obtaining a fracture crack identification set. S512: Based on the fracture crack identification set, analyze the position of the center point and the coordinates of the start and end points of the crack, calculate the deviation between the crack and the average distance between adjacent cracks, evaluate the direction deviation angle, and obtain the crack coordinate offset range. S513: Based on the crack coordinate offset range, adjust the position of the center point coordinate of the crack, re-identify its geometric shape, determine the current position coordinate of the crack, and obtain the crack positioning result.
7. A crack detection system for hydraulic engineering based on intelligent visual recognition, characterized in that, The method for detecting cracks in hydraulic engineering based on intelligent visual recognition according to any one of claims 1-6 is implemented, wherein the system comprises: The image processing enhancement module acquires images of cracks in hydraulic engineering projects, divides the image into multiple regions based on illumination information, detects brightness changes in each region, calculates its local contrast, adjusts brightness, and refines the contrast between cracks and background by adjusting the regional contrast weights to obtain a locally enhanced image. The crack edge optimization module extracts the crack contour based on the locally enhanced image, performs morphological closing operation to fill in the missing parts of the crack edge, eliminates edge distortion caused by noise or uneven lighting, removes background noise through morphological opening operation, and analyzes the crack morphology features based on the geometric features of the crack to obtain crack edge optimization information. The crack region segmentation module, based on the crack edge optimization information, compares the image pixel values with the background region pixel values to segment the crack region. By analyzing the geometric features of the crack region, it determines whether there are breakage or connection problems, locates the endpoints and continuous areas of the crack, and obtains the crack region segmentation result. Based on the crack region segmentation results, the crack connectivity analysis module performs connectivity analysis on the crack region according to the geometric characteristics of the crack, calculates the fracture endpoints, length, width and curvature of the crack, determines whether the crack is a continuous crack or a discontinuous crack, analyzes the relative positions of the fracture endpoints of the crack, and generates crack connectivity detection data. The crack location calibration module uses the crack connectivity detection data to locate misjudged fracture cracks using geometric constraints, calibrates the crack position based on the crack's geometric features, determines the crack's current position coordinates, and obtains the crack location result.
Citation Information
Patent Citations
Method for processing and identifying a pavement crack digital image
CN111145161A
Crack length detection system based on computer image processing
CN118037730A