A method and system for safety assessment based on underwater fracture watershed segmentation
Patent Information
- Application Number
- CN202610680684.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-05-18
- Publication Date
- 2026-10-09
AI Technical Summary
[0003]其中,基于机器视觉的现有技术中,常用的图像增强手段多为单一的锐化、对比度拉伸或全局白平衡,分割方法多采用固定阈值二值化或传统分水岭算法,裂缝筛选仅通过简单的面积阈值判断,安全评估多仅依据裂缝长度或宽度单一指标,然而,水下环境具有光线散射、水体浑浊、光照不均等特殊性,导致现有技术存在图像增强效果差、裂缝分割精度低、裂缝筛选准确性不足、安全评估不全面及适应性差的问题,
本申请提供的一种基于水下裂缝分水岭分割进行安全评估的方法及系统,通过获取水下彩色图像作为原始图像,依次进行颜色校正和去散射预处理,有效消除水体散射与颜色偏蓝绿的影响,还原图像真实色彩与细节,提升后续处理的基础图像质量;然后通过双边滤波保边去噪、CLAHE自适应对比度增强及高斯差分锐化融合,在去除水下噪声的同时保留裂缝边缘细节,强化低对比度细小裂缝的关键特征,显著提升细小裂缝检出率;再通过自适应二值化、分级形态学开运算与背景膨胀提取、基于距离变换的自适应前景标记及分水岭分割,精准区分裂缝与背景,避免传统分水岭算法的过分割与欠分割问题,生成完整的裂缝区域掩码;之后通过连通域分析提取面积、长轴长度与短轴长度,以三重筛选条件有效区分细长裂缝与水下杂质(如污渍、附着物),输出有效裂缝掩码,大幅降低误判率;进一步通过骨架提取与距离变换精确计算裂缝总长度、平均宽度、最大宽度及最小宽度,实现裂缝的量化分析;最后基于裂缝总长度与最大宽度的加权综合安全评估模型计算安全系数并判定安全等级,克服单一指标评估的片面性,为水下结构安全决策提供科学依据。
Smart Images

Figure CN122887760A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the fields of image processing and structural safety inspection technology, and more specifically, to a method and system for safety assessment based on underwater crack watershed segmentation. Background Technology
[0002] Currently, crack detection in underwater structures (such as bridge piers, submarine pipelines, and reservoir dams) mainly relies on two technical approaches: one is manual diving inspection, where divers carry imaging equipment to collect images of the structure surface at close range, and then judge the crack condition by visual inspection or simple image processing software; the other is an automatic detection method based on machine vision, which acquires images through underwater camera equipment and then uses traditional image enhancement, binarization segmentation, and connected component analysis techniques to achieve automatic crack identification and measurement.
[0003] Among existing machine vision-based technologies, commonly used image enhancement methods are mostly simple sharpening, contrast stretching, or global white balance. Segmentation methods often employ fixed threshold binarization or traditional watershed algorithms. Crack screening relies solely on simple area thresholds, and safety assessments are often based on crack length or width alone. However, the underwater environment has unique characteristics such as light scattering, water turbidity, and uneven illumination, leading to problems with existing technologies, including poor image enhancement effects, low crack segmentation accuracy, insufficient crack screening accuracy, incomplete safety assessments, and poor adaptability. Therefore, there is an urgent need for a method that can adapt to complex underwater environments and achieve precise crack segmentation and comprehensive assessment. Summary of the Invention
[0004] In view of this, in order to solve the above-mentioned problems in the prior art, this application provides a method and system for safety assessment based on underwater crack watershed segmentation.
[0005] The embodiments of this application are implemented as follows: In a first aspect, this application provides a method for security assessment based on underwater fracture watershed segmentation, including: An underwater color image is acquired as the original image, and color correction and descattering preprocessing are performed on the original image to obtain a descattered image; The descattered image is converted into a grayscale image, the grayscale image is enhanced for detail to obtain a grayscale sharpened image, and then the grayscale sharpened image is converted into a color image to obtain a detail-enhanced color image. The grayscale sharpened image is sequentially subjected to Gaussian blur and adaptive binarization to obtain a binarized image. Watershed segmentation is then performed between the detail-enhanced color image and the binarized image to obtain a crack region mask. Based on the crack region mask, an effective crack mask is obtained through connected component analysis; The effective crack mask is quantitatively analyzed to obtain a security factor, and the security level is determined based on the security factor and a preset security level determination rule.
[0006] In one possible implementation, the color correction specifically includes: The original image is split into blue, green and red channels. The pixel mean of each of the three channels is calculated, and then the average gray value of the three channels is calculated. Each pixel of the blue and green channels is multiplied by a correction factor so that the mean of that channel is equal to the average gray value. The red channel remains unchanged. The resulting image is white balance image.
[0007] In one possible implementation, the descattering preprocessing specifically includes: After normalizing the white balance image, the dark channel is calculated. The dark channel is then eroded using a 15×15 rectangular kernel. The atmospheric light value and transmittance are calculated. Descattering correction is performed on each channel. After inverse normalization, the descattered image is obtained.
[0008] In one possible implementation, the enhanced details specifically include: The grayscale image is sequentially subjected to bilateral edge-preserving filtering for noise reduction, adaptive contrast enhancement, and differential sharpening to obtain the enhanced image; The enhanced image is fused with the sharpened image to obtain a grayscale sharpened image; The parameters of the bilateral filter include filter diameter d=9, color space standard deviation 30, and coordinate space standard deviation 30. The parameters of CLAHE include contrast limit clipLimit=3.0 and grid size tileGridSize=(6,6); The Gaussian difference sharpening includes: performing a first Gaussian blur using a (3,3) kernel and sigma=0.5, performing a second Gaussian blur using a (7,7) kernel and sigma=2.0, and calculating the difference between the two blurred images to obtain the DoG sharpened image; The preset weights are: the weight of the enhanced image is 1.0, and the weight of the DoG sharpened image is 0.6.
[0009] In one possible implementation, the watershed segmentation based on the enhanced detail color image and the binarized image specifically includes: The binarized image is subjected to morphological opening, background dilation extraction, adaptive foreground extraction based on distance transform, and unknown region calculation in sequence to obtain the labeled image; Using the enhanced detail color image as input and the marked image as seed, watershed segmentation is performed to obtain the segmented marked regions; Calculate the average brightness of each marked area, identify areas with average brightness less than the brightness threshold as cracks, and generate crack masks. Perform a morphological closing operation on the crack mask to obtain the crack region mask; The adaptive binarization adopts the Gaussian adaptive method, with a block size S=51 and an offset C=4. The morphological opening operation uses a 2×2 rectangular kernel and iterates once. The background dilation extraction uses a 3×3 rectangular kernel for dilation operation, iterating once; The adaptive foreground extraction based on distance transformation includes performing a distance transformation on the image after the opening operation to obtain a distance-transformed image, and setting pixels in the distance-transformed image that are greater than 0.08 times the maximum distance value as the foreground; The brightness threshold is 50; The morphological closing operation uses a 2×2 rectangular kernel and iterates once to fill in tiny fractures in the crack.
[0010] In one possible implementation, the connected component analysis specifically includes: Extract the area, major axis length, and minor axis length of each connected component; Connected components that simultaneously satisfy the following conditions are retained as valid cracks: area greater than or equal to 3 pixels, major axis length greater than or equal to the minimum length threshold, and minor axis length less than or equal to the maximum width threshold. The minimum length threshold is 10 pixels, and the maximum width threshold is 50 pixels.
[0011] In one possible implementation, the quantitative analysis specifically includes: The effective crack mask skeleton is extracted, the total crack length is obtained by counting the number of skeleton pixels, the effective crack mask is transformed by distance, and the crack width distribution is calculated by combining the skeleton position to obtain the average width, maximum width and minimum width. The length score is calculated based on the ratio of the total crack length to the critical length; The width score is calculated based on the ratio of the maximum width to the critical width. The safety factor is obtained by weighted summation of the length score and the width score; The critical length is 200 pixels, the critical width is 30 pixels, and the weight of the length score in the weighted summation is 0.6, while the weight of the width score is 0.4.
[0012] In one possible implementation, the security level determination rules include: A safety factor of 0.8 or higher is considered "safe". A safety factor of 0.5 or less, or less than 0.8, warrants caution. A safety factor of less than 0.5 is considered "dangerous".
[0013] In one possible implementation, the formula for calculating the length score is: (29); in, The total length of the crack. It is the critical length; The formula for calculating the width score is: (30); in, The maximum width of the crack. This is the critical width; The formula for calculating the safety factor is: (31); in, For length score weights, The width score weight is used, and .
[0014] Secondly, this application provides a system for security assessment based on underwater fracture watershed segmentation, comprising: The image preprocessing module is used to acquire an underwater color image as the original image, and to perform color correction and descattering preprocessing on the original image to obtain a descattered image. The detail preservation and enhancement module is used to convert the descattered image into a grayscale image, enhance the details of the grayscale image to obtain a grayscale sharpened image, and then convert the grayscale sharpened image into a color image to obtain a detail-enhanced color image. The watershed segmentation module is used to sequentially perform Gaussian blur and adaptive binarization on the grayscale sharpened image to obtain a binarized image, and to perform watershed segmentation based on the detail-enhanced color image and the binarized image to obtain a crack region mask. A thin crack screening module is used to obtain an effective crack mask based on the crack region mask through connected component analysis. The quantitative analysis and security assessment module is used to perform quantitative analysis on the effective crack mask to obtain a security coefficient, and to determine the security level based on the security coefficient and a preset security level determination rule.
[0015] The technical solution provided in this application can achieve at least the following beneficial effects: This application provides a method and system for security assessment based on underwater crack watershed segmentation. It acquires an underwater color image as the original image, and then performs color correction and descattering preprocessing to effectively eliminate the effects of water scattering and blue-green color bias, restoring the true color and details of the image and improving the basic image quality for subsequent processing. Then, through bilateral filtering for edge-preserving denoising, CLAHE adaptive contrast enhancement, and Gaussian difference sharpening fusion, underwater noise is removed while preserving crack edge details, enhancing the key features of low-contrast small cracks, and significantly improving the detection rate of small cracks. Finally, adaptive binarization, hierarchical morphological opening and background dilation extraction, adaptive foreground labeling based on distance transform, and segmentation are performed. Watershed segmentation accurately distinguishes cracks from the background, avoiding over-segmentation and under-segmentation problems common in traditional watershed algorithms, and generating complete crack region masks. Then, connected component analysis extracts area, major axis length, and minor axis length, effectively distinguishing slender cracks from underwater impurities (such as stains and attachments) using triple screening conditions, outputting effective crack masks and significantly reducing the false positive rate. Furthermore, skeleton extraction and distance transformation accurately calculate the total crack length, average width, maximum width, and minimum width, achieving quantitative crack analysis. Finally, a weighted comprehensive safety assessment model based on the total crack length and maximum width calculates the safety factor and determines the safety level, overcoming the limitations of single-index assessment and providing a scientific basis for underwater structure safety decisions.
[0016] This invention is fully adaptable to complex underwater environments, eliminating the need for frequent manual parameter adjustments. It enables automated, high-precision, and highly robust underwater crack detection and safety assessment, making it particularly suitable for industrial-grade inspection needs of concrete structures such as underwater bridges, submarine pipelines, and reservoir dams. Attached Figure Description
[0017] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0018] Figure 1 This is a schematic flowchart illustrating a method for security assessment based on underwater crack watershed segmentation, as shown in an exemplary embodiment of this application. Figure 2 This is a schematic diagram illustrating the effect of a method for security assessment based on underwater crack watershed segmentation in deep crack identification and assessment, as shown in an exemplary embodiment of this application. Figure 3 This is a schematic diagram illustrating an exemplary embodiment of the present application of a method for safety assessment based on underwater crack watershed segmentation for surface crack identification and assessment. Figure 4 This is a schematic diagram of the structure of a system for safety assessment based on underwater crack watershed segmentation, as illustrated in an exemplary embodiment of this application.
[0019] Figure label: 1. Image preprocessing module; 2. Detail preservation and enhancement module; 3. Refined watershed segmentation module; 4. Slender crack screening module; 5. Quantitative analysis and security assessment module. Detailed Implementation
[0020] To make the objectives, implementation methods and advantages of this application clearer, the exemplary implementation methods of this application will be clearly and completely described below with reference to the accompanying drawings of the exemplary embodiments of this application. Obviously, the exemplary embodiments described are only some embodiments of this application, and not all embodiments. It should be understood that the specific embodiments described herein are only used to explain this application and are not intended to limit this application.
[0021] It should be noted that the brief descriptions of terms in this application are only for the convenience of understanding the embodiments described below, and are not intended to limit the embodiments of this application. Unless otherwise stated, these terms should be understood in their ordinary and common meaning.
[0022] The terms "first," "second," "third," etc., used in the specification, claims, and accompanying drawings of this application are used to distinguish similar or related objects or entities, and do not necessarily imply a specific order or sequence, unless otherwise specified. It should be understood that such terms are interchangeable where appropriate.
[0023] The terms “comprising” and “having”, and any variations thereof, are intended to cover but not exclude inclusion, for example, a product or device that includes a range of components is not necessarily limited to all of the components that are clearly listed, but may include other components that are not clearly listed or that are inherent to such product or device.
[0024] Next, the technical solutions of this application and how they solve the aforementioned technical problems will be described in detail through embodiments and in conjunction with the accompanying drawings. The embodiments can be combined with each other, and the same or similar concepts or processes may not be repeated in some embodiments. Obviously, the described embodiments are only some, not all, of the embodiments of this application.
[0025] In one exemplary embodiment, such as Figure 1 As shown, a method for safety assessment based on underwater fracture watershed segmentation is provided. In this embodiment, the method may include the following steps: Step 100: Acquire an underwater color image as the original image, perform color correction and descattering preprocessing on the original image to obtain a descattered image; Step 200: Convert the descattered image into a grayscale image, perform detail enhancement on the grayscale image to obtain a grayscale sharpened image, and then convert the grayscale sharpened image into a color image to obtain a detail-enhanced color image; Step 300: Gaussian blur and adaptive binarization are sequentially applied to the grayscale sharpened image to obtain a binarized image. Watershed segmentation is then performed based on the detail-enhanced color image and the binarized image to obtain a crack region mask. Step 400: Based on the crack region mask, obtain the effective crack mask through connected component analysis; Step 500: Quantitatively analyze the effective crack mask to obtain a security factor, and determine the security level based on the security factor according to the preset security level determination rules.
[0026] In one embodiment, the following parameters are used to control the execution effect of each step and can be flexibly adjusted according to the actual underwater detection scenario (such as turbidity, crack size), specifically including: Min_Length: Minimum crack length threshold (in pixels), used to filter valid long and thin cracks, default value is 10; Max_Width: Maximum crack width threshold (in pixels), used to filter valid thin cracks, default value is 50; Critical_Length: Critical crack length (unit: pixels), used for safety assessment, default value is 200; Critical_Width: Critical width of the crack (unit: pixels), used for safety assessment, default value is 30; Brightness_Thresh: Crack brightness threshold, used to determine if a dark area is a crack. The default value is 50 (pixel grayscale value, 0-255).
[0027] like Figure 2 and Figure 3 As shown, the specific implementation of this method for safety assessment based on underwater fracture watershed segmentation is as follows: 1. Color correction using blue-green channel white balance: Underwater images are prone to color casts (with a stronger emphasis on blue and green) due to water absorption. By correcting the average brightness of the blue, green, and red channels, white balance is achieved, eliminating color deviations. The specific implementation is as follows: 1.1 Convert the input color image (img) to a floating-point number; split the color image into three single-channel images: blue (B), green (G), and red (R); 1.2 Calculate the pixel mean for each of the three channels: (1) Where M is the image height (pixels), N is the image width (pixels), and B(i,j), G(i,j), and R(i,j) are the pixel values of the blue, green, and red channels at coordinates (i,j), respectively.
[0028] 1.3 Calculate the average grayscale value of the three channels : (2) 1.4 Perform brightness correction on the blue and green channels separately to make the mean value of the two channels consistent with the average grayscale value: (3) 1.5 The corrected blue and green channels are merged with the original red channel to obtain the white-balanced image img_wb.
[0029] II. Dark Channel Descattering: Underwater light scattering can cause image blurring and reduced contrast. By using the dark channel prior principle, the effects of water scattering are removed, and image details are restored. The specific implementation is as follows: 2.1 Convert the white-balanced image (img_wb) to a floating-point number and normalize it to the range [0,1]: (4) 2.2 The normalized image is split into three single channels: blue (b), green (g), and red (r); 2.3 Calculate the dark channel of the image, which is the minimum value of each pixel in the three channels. The calculation formula is as follows: (5) 2.4 Construct a 15×15 rectangular kernel and perform an erosion operation on the dark channel to enhance the scattering characteristics of the dark channel; 2.5 Calculate the atmospheric light value (atm), which is the maximum pixel value in the normalized image: (6) 2.6 Calculate trans transmittance, used to characterize the degree of image scattering: (7) 2.7 Truncate the transmittance to the range of [0.1, +∞) to avoid image distortion caused by excessively low transmittance; 2.8 Perform descattering correction on each channel to restore a clear image: (8) 2.9 Denormalize the corrected image (img_dh) to the range [0,255] and convert it to uint8 type.
[0030] III. Enhanced Details: By combining bilateral filtering, CLAHE adaptive contrast, and Gaussian difference sharpening, noise is removed while crack details are enhanced. The specific implementation is as follows: 3.1 Convert the descattered color image (img_dh) to a grayscale image (gray): (9) Where R(i,j), G(i,j), and B(i,j) are the red, green, and blue channel pixel values of the descattered image at coordinate (i,j), respectively, and gray(i,j) is the converted gray value.
[0031] 3.2 Bilateral Filtering for Edge Preservation and Denoising: Bilateral filtering is used to filter the grayscale image (gray), with parameters set to filter diameter d=9, color space standard deviation 30, and coordinate space standard deviation 30, resulting in a filtered and denoised grayscale image (gray_bilateral). This step can remove noise while preserving crack edge details. The core formula for bilateral filtering is as follows: (10) Where S(i,j) is the neighborhood centered at (i,j) with diameter d, and W(i,j) is the normalized weight. For the color space Gaussian function, It is a Gaussian function in coordinate space.
[0032] 3.3 CLAHE Adaptive Contrast Enhancement: Create a CLAHE adaptive contrast enhancer with parameters set to contrast limit clipLimit=3.0 and grid size tileGridSize=(6,6) to enhance the filtered image (gray_bilateral) to obtain the contrast-enhanced image (gray_enhanced). This step can specifically enhance small cracks with low contrast.
[0033] 3.4 Difference of Gaussian (DoG) Sharpening: The enhanced image is subjected to two Gaussian blurs. The first blur parameter is (3,3) and sigma=0.5 (gauss1), and the second blur parameter is (7,7) and sigma=2.0 (gauss2). The difference between the two blurred images is calculated to obtain the DoG sharpened image (dog). (11) (12) (13) in, , These are the standard deviations of the two Gaussian blurs, This represents the convolution operation, where (x, y) are the center coordinates of the fuzzy kernel.
[0034] 3.5 Image Fusion: The enhanced image (gray_enhanced) is fused with the DoG sharpened image (dog), with weights set to 1.0 (gray_enhanced) and 0.6 (dog) to obtain the final sharpened image (gray_sharp). 3.6 Truncate the pixel values of the grayscale sharpened image (gray_sharp) to the range of 0-255, convert it to uint8 type, and then convert it to a color image (img_enhanced) for subsequent watershed segmentation.
[0035] IV. Refined watershed segmentation: Accurate crack segmentation is achieved through adaptive binarization, hierarchical morphological operations, and adaptive distance transformation thresholding. The specific implementation is as follows: 4.1 Gaussian blur preprocessing: Gaussian blur is applied to the grayscale sharpened image (gray_sharp) to reduce the impact of noise on segmentation, resulting in a blurred image (blur). (14) in, The standard deviation of the Gaussian blur. The center coordinates of the 3×3 fuzzy kernel This represents the convolution operation.
[0036] 4.2 Adaptive Binarization: The blurred image is binarized using the Adaptive Thresh Gaussian method to obtain a binary image. This step can adapt to underwater scenes with uneven lighting and accurately distinguish cracks from the background. The Gaussian adaptive binarization formula is as follows: (15) (16) Where T(i,j) is the adaptive threshold at coordinate (i,j), S=51 is the block size, and C=4 is the offset. This is a Gaussian weighting function used to perform weighted summation of pixels in the neighborhood, thereby achieving Gaussian adaptive threshold calculation.
[0037] 4.3 Morphological Opening Operation: Construct a 2×2 rectangular kernel and perform an opening operation (iteration 1) on the binary image to remove minor noise and impurities while preserving crack details. The opening operation formula is as follows: (17) in, This represents the erosion operation. This indicates an expansion operation, which first erodes away tiny impurities, then expands to restore the original shape of the crack, thus preventing the crack from being over-eroded.
[0038] 4.4 Background Extraction: Construct a 3×3 rectangular kernel and perform a dilation operation (1 iteration) on the image after the opening operation to obtain the determined background (sure_bg). This step involves slight dilation to avoid destroying the details of the crack edges. The dilation operation formula is as follows: (18) in, This represents the dilation operation, which expands the image after the opening operation using a structuring element, thereby enlarging the background area and clearly distinguishing the background from the foreground.
[0039] 4.5 Foreground Extraction: The image after the opening operation is subjected to a distance transform (distance type DIST_L2, mask size 5) to obtain a distance-transformed image (dist). The distance-transformed image is then thresholded, with the threshold set to 0.08 times the maximum value of the distance-transformed image (dist) to obtain the determined foreground (sure_fg), which is then converted to uint8 type. This adaptive threshold can adapt to cracks of varying thicknesses, avoiding missed segmentation. The distance transform and thresholding formulas are as follows: (19) (20) Where dist(i,j) is the Euclidean distance (L2 distance) from the pixel at coordinate (i,j) to the nearest background pixel, max(dist) is the maximum distance value of the distance-transformed image, and 0.08 is the adaptive threshold coefficient.
[0040] 4.6 Calculation of unknown region: Calculate the difference between the determined background (sure_bg) and the determined foreground (sure_fg) to obtain the unknown region (unknown), which is a vague region where cracks may exist; (twenty one) Specifically, when sure_bg(i,j) is 255 and sure_fg(i,j) is 0, unknown(i,j) = 255 (unknown region); otherwise, unknown(i,j) = 0.
[0041] 4.7 Watershed Labeling: Connected component labeling is performed on the determined foreground (sure_fg) to obtain the label image (markers); all pixel values of the label image are incremented by 1, so that the background label changes from 0 to 1; the label of the unknown region is set to 0, which serves as the seed point of the watershed; 4.8 Watershed Segmentation: Using the watershed segmentation (watershed) function, with the color image (img_enhanced) after detail enhancement in step 3.6 as input and the marker images (markers) as seeds, watershed segmentation is performed to obtain the segmented marker images; (twenty two) The watershed segmentation function uses the labeled image as a seed and performs "flood filling" on the image's grayscale values. The filling boundaries of different seed regions are the segmentation boundaries, effectively avoiding oversegmentation.
[0042] 4.9 Color Region Map Generation: Create a color region map (regions_color) with the same size as the input image. For each segmented labeled region (rid>0), randomly assign an RGB color in the range of 40-255 to visually display the segmentation results.
[0043] 4.10 Crack Mask Generation: Create a crack mask (crack_mask) with the same size as the grayscale sharpened image (gray_sharp). Traverse each segmentation marker region and calculate the average brightness within the region. If the average brightness is less than Brightness_Thresh, the region is determined to be a crack, and the corresponding position of the mask is set to 255 (white); otherwise, it is set to 0 (black). (twenty three) (twenty four) in, Let be the number of pixels in the 'rid'-th labeled region. The average brightness of the area is denoted by Brightness_Thresh=50, which is the threshold for determining the brightness of cracks.
[0044] 4.11 Refined Closing Operation: Using a 2×2 kernel, a closing operation (1 iteration) is performed on the crack mask to fill in the tiny fractures in the crack without destroying the overall shape of the crack, thus obtaining the final crack region mask.
[0045] (25) in, This represents the expansion operation. This indicates an corrosion operation that first expands to fill the tiny cracks and fractures, then corrodes to restore the original width of the cracks, thus avoiding excessive expansion.
[0046] V. Screening for narrow, elongated cracks: By using connected component analysis and major / minor axis parameter filtering, background impurities are removed, and effective slender cracks are retained. The specific implementation is as follows: 5.1 Mark the connected components of the crack region mask (crack_regions) and obtain the area, major axis length (L), minor axis length (W), and coordinates of each connected component; 5.2 Traverse each connected component and retain only valid cracks that meet the following conditions: the area of the connected component is ≥3 pixels, the length of the major axis L and the length of the minor axis W are valid positive values, L≥Min_Length and W≤Max_Width, and set the output mask position corresponding to the coordinates of the valid crack connected component to 255 (white). 5.3 Output the filtered valid crack mask (Crack_mark) for subsequent quantitative analysis.
[0047] VI. Crack Quantitative Analysis: This step calculates the total length, average width, maximum width, and minimum width of the crack through skeleton extraction and distance transformation, as detailed below: 6.1 Skeleton Extraction: Convert the filtered crack mask (Crack_mark) into a binary image (binary=out>0), extract the skeleton from the binary image to obtain the crack skeleton image (skeleton); convert the skeleton image to uint8 type (skeleton pixel value is 255, background is 0); 6.2 Total Length Calculation: The total length of the crack is calculated by counting the number of pixels with a value of 255 in the skeleton image. (26) 6.3 Width Calculation: Perform a distance transformation (DIST_L2 method, mask size 5) on the filtered crack mask (Crack_mark) to obtain the distance transformed image (dist); obtain the coordinates of all pixels with a value of 255 in the skeleton image; iterate through each coordinate, and the value of the distance transformed image at that coordinate is the half-width of the crack. Therefore, the crack width is: (27) 6.4 Width Statistics: Collect all crack width values (widths). If the width list is empty (no valid cracks), the average width, maximum width, and minimum width are all 0; otherwise, calculate the average width (avg_w), maximum width (max_w), and minimum width (min_w) using the following formulas. (28) wherein K is the number of width values.
[0048] VII. Safety Assessment: In this step, combining the total length and maximum width of the crack, the safety factor is calculated by weighted summation, and the safety level of the underwater structure is determined. The specific implementation is as follows: 7.1 Calculation of length score: According to the ratio of the total crack length (total_len) to the critical length (Critical_Length), the length score (len_score) is calculated, and the calculation formula is as follows (29) When total_len≥Critical_Length, len_score=0; when total_len<Critical_Length, len_score increases as total_len decreases.
[0049] 7.2 Calculation of width score: According to the ratio of the maximum crack width (max_w) to the critical width (Critical_Width), the width score (w_score) is calculated, and the calculation formula is as follows (30) When max_w≥Critical_Width, w_score=0; when max_w<Critical_Width, w_score increases as max_w decreases.
[0050] 7.3 Calculation of safety factor: The safety factor (sf) is calculated by weighted summation, wherein the weight of length score is 0.6 and the weight of width score is 0.4, and the calculation formula is as follows: (31) The value range of the safety factor sf is [0,1], and the larger sf is, the higher the structural safety level is.
[0051] 7.4 Safety level determination: The safety level is determined according to the safety factor (sf), and the determination rules are as follows: - If sf≥0.8, the safety level is "Safe"; - If 0.5≤sf<0.8, the safety level is "Caution"; - If sf<0.5, the safety level is "Dangerous".
[0052] It should be understood that although the steps in the flowcharts of the above embodiments are shown sequentially as indicated, these steps are not necessarily executed in the indicated order. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the flowcharts of the above embodiments may include multiple steps or multiple stages. These steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these steps or stages is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the steps or stages in other steps.
[0053] Corresponding to the aforementioned embodiments of the method for safety assessment based on underwater fracture watershed segmentation, and employing the same technical concept, this application also provides embodiments of a system for safety assessment based on underwater fracture watershed segmentation.
[0054] In one exemplary embodiment, such as Figure 4 As shown, the system for safety assessment based on underwater fracture watershed segmentation includes: Image preprocessing module 1 is used to acquire an underwater color image as the original image, and to perform color correction and descattering preprocessing on the original image to obtain a descattered image; The detail preservation and enhancement module 2 is used to convert the descattered image into a grayscale image, enhance the details of the grayscale image to obtain a grayscale sharpened image, and then convert the grayscale sharpened image into a color image to obtain a detail-enhanced color image. The refined watershed segmentation module 3 is used to sequentially perform Gaussian blur and adaptive binarization on the grayscale sharpened image to obtain a binarized image, and perform watershed segmentation based on the detail-enhanced color image and the binarized image to obtain a crack region mask. The slender crack screening module 4 is used to obtain an effective crack mask based on the crack region mask through connected component analysis. The quantitative analysis and security assessment module 5 is used to perform quantitative analysis on the effective crack mask to obtain a security coefficient, and to determine the security level based on the security coefficient and a preset security level determination rule.
[0055] In one embodiment, the system for security assessment based on underwater fracture watershed segmentation is implemented in the following ways: The image preprocessing module receives the raw underwater color image, performs blue-green channel white balance correction and dark channel descattering processing, and outputs a descattered image. This module includes a white balance unit and a dark channel descattering unit. The output of the white balance unit is directly used as the input of the dark channel descattering unit, and the two are cascaded.
[0056] The detail-preserving enhancement module converts the descattered image to a grayscale image, then performs bilateral filtering, CLAHE enhancement, and Gaussian difference sharpening sequentially, and finally fuses them according to weights to obtain a grayscale sharpened image and a detail-enhanced color image. This module includes: The grayscale conversion unit is used to convert a color image to a grayscale image.
[0057] Bilateral filter unit: parameters d=9, σ_color=30, σ_space=30.
[0058] CLAHE enhancement unit: clipLimit=3.0, tileGridSize=(6,6).
[0059] Difference of Gaussian sharpening unit: generates DoG image.
[0060] Image fusion unit: Receives CLAHE output and DoG output, and adds them together with weights of 1.0 and 0.6 respectively.
[0061] Its output is a grayscale sharpened image and a detail-enhanced color image. The first four units are connected in sequence, and the image fusion unit has two inputs from the CLAHE unit and the Gaussian difference sharpening unit, respectively.
[0062] The refined watershed segmentation module performs binarization, morphological operations, distance transform foreground extraction, watershed segmentation, crack detection, and closing operations on grayscale sharpened images, outputting a crack region mask. This module includes: The binarization unit is used to perform Gaussian blur and adaptive binarization on the grayscale sharpened image, and output a binary image.
[0063] The morphological processing unit performs opening operations (2×2 kernels) and background dilation extraction (3×3 kernels) on the binary image, and outputs a defined background.
[0064] The adaptive foreground extraction unit is used to perform distance transformation on the binary image, taking 0.08 times the maximum distance as the threshold, and outputting the foreground.
[0065] The unknown region calculation unit is used to receive a determined background and a determined foreground, calculate the difference to obtain the unknown region, and generate a labeled image.
[0066] The watershed segmentation unit receives the labeled image and the detail-enhanced color image, executes the watershed algorithm, and outputs the labeled region image.
[0067] The crack detection and closing operation unit is used to detect cracks based on average brightness and brightness threshold, generate crack masks, perform closing operations, and output crack region masks.
[0068] The binarization unit's output is split into two paths: one to the morphological processing unit and the other to the adaptive foreground extraction unit. The unknown region calculation unit receives the outputs from both the morphological processing unit and the adaptive foreground extraction unit. Subsequent units are connected sequentially.
[0069] The elongated crack screening module is used to perform connected component analysis on crack region masks, extract geometric attributes, and screen valid cracks based on area, major axis, and minor axis conditions. This module includes: The connected component analysis unit is used to obtain the area, major axis length, and minor axis length of each connected component using functions.
[0070] The conditional filtering unit is used to judge each connected component: area ≥ 3, major axis ≥ Min_Length (10), minor axis ≤ Max_Width (50). Components that meet the conditions are retained, otherwise they are deleted.
[0071] The quantitative analysis and security assessment module is used for skeleton extraction, length calculation, width calculation, and security assessment. This module includes: Skeleton extraction unit: refines the effective crack mask to obtain the skeleton map and calculates the total length.
[0072] Distance Transformation Unit: Performs distance transformation on the effective crack mask to obtain the width-distance map.
[0073] Weighted evaluation unit: Calculate the width list by combining the skeleton position and distance map, calculate the average / maximum / minimum width; then calculate the safety factor and determine the level based on the critical length, critical width and weight.
[0074] Its output includes total crack length, average width, maximum width, minimum width, safety factor, and safety level.
[0075] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0076] The embodiments described above are merely illustrative of several implementation methods of this application, and while the descriptions are relatively specific and detailed, they should not be construed as limiting the scope of the invention patent. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the protection scope of this application. Therefore, the protection scope of this patent application should be determined by the appended claims.
Claims
1. A method for safety assessment based on underwater fracture watershed segmentation, characterized in that, include: An underwater color image is acquired as the original image, and color correction and descattering preprocessing are performed on the original image to obtain a descattered image; The descattered image is converted into a grayscale image, the grayscale image is enhanced for detail to obtain a grayscale sharpened image, and then the grayscale sharpened image is converted into a color image to obtain a detail-enhanced color image. The grayscale sharpened image is sequentially subjected to Gaussian blur and adaptive binarization to obtain a binarized image. Watershed segmentation is then performed between the detail-enhanced color image and the binarized image to obtain a crack region mask. Based on the crack region mask, an effective crack mask is obtained through connected component analysis; The effective crack mask is quantitatively analyzed to obtain a security factor, and the security level is determined based on the security factor and a preset security level determination rule.
2. The method for safety assessment based on underwater fracture watershed segmentation as described in claim 1, characterized in that, The color correction specifically includes: The original image is split into blue, green and red channels. The pixel mean of each of the three channels is calculated, and then the average gray value of the three channels is calculated. Each pixel of the blue and green channels is multiplied by a correction factor so that the mean of that channel is equal to the average gray value. The red channel remains unchanged. The resulting image is white balance image.
3. The method for safety assessment based on underwater fracture watershed segmentation as described in claim 1, characterized in that, The descattering preprocessing specifically includes: After normalizing the white balance image, the dark channel is calculated. The dark channel is then eroded using a 15×15 rectangular kernel. The atmospheric light value and transmittance are calculated. Descattering correction is performed on each channel. After inverse normalization, the descattered image is obtained.
4. The method for safety assessment based on underwater fracture watershed segmentation as described in claim 1, characterized in that, The enhanced details include: The grayscale image is sequentially subjected to bilateral edge-preserving filtering for noise reduction, adaptive contrast enhancement, and differential sharpening to obtain the enhanced image; The enhanced image is fused with the sharpened image to obtain a grayscale sharpened image; The parameters of the bilateral filter include filter diameter d=9, color space standard deviation 30, and coordinate space standard deviation 30. The parameters of CLAHE include contrast limit clipLimit=3.0 and grid size tileGridSize=(6,6); The Gaussian difference sharpening includes: performing a first Gaussian blur using a (3,3) kernel and sigma=0.5, performing a second Gaussian blur using a (7,7) kernel and sigma=2.0, and calculating the difference between the two blurred images to obtain the DoG sharpened image; The preset weights are: the weight of the enhanced image is 1.0, and the weight of the DoG sharpened image is 0.
6.
5. The method for safety assessment based on underwater fracture watershed segmentation as described in claim 1, characterized in that, The watershed segmentation based on the enhanced detail color image and the binarized image specifically includes: The binarized image is subjected to morphological opening, background dilation extraction, adaptive foreground extraction based on distance transform, and unknown region calculation in sequence to obtain the labeled image; Using the enhanced detail color image as input and the marked image as seed, watershed segmentation is performed to obtain the segmented marked regions; Calculate the average brightness of each marked area, identify areas with average brightness less than the brightness threshold as cracks, and generate crack masks. Perform a morphological closing operation on the crack mask to obtain the crack region mask; The adaptive binarization adopts the Gaussian adaptive method, with a block size S=51 and an offset C=4. The morphological opening operation uses a 2×2 rectangular kernel and iterates once. The background dilation extraction uses a 3×3 rectangular kernel for dilation operation, iterating once; The adaptive foreground extraction based on distance transformation includes performing a distance transformation on the image after the opening operation to obtain a distance-transformed image, and setting pixels in the distance-transformed image that are greater than 0.08 times the maximum distance value as the foreground; The brightness threshold is 50; The morphological closing operation uses a 2×2 rectangular kernel and iterates once to fill in tiny fractures in the crack.
6. The method for safety assessment based on underwater fracture watershed segmentation as described in claim 1, characterized in that, The connected component analysis specifically includes: Extract the area, major axis length, and minor axis length of each connected component; Connected components that simultaneously satisfy the following conditions are retained as valid cracks: area greater than or equal to 3 pixels, major axis length greater than or equal to the minimum length threshold, and minor axis length less than or equal to the maximum width threshold. The minimum length threshold is 10 pixels, and the maximum width threshold is 50 pixels.
7. The method for safety assessment based on underwater fracture watershed segmentation as described in claim 1, characterized in that, The quantitative analysis specifically includes: The effective crack mask skeleton is extracted, the total crack length is obtained by counting the number of skeleton pixels, the effective crack mask is transformed by distance, and the crack width distribution is calculated by combining the skeleton position to obtain the average width, maximum width and minimum width. The length score is calculated based on the ratio of the total crack length to the critical length; The width score is calculated based on the ratio of the maximum width to the critical width. The safety factor is obtained by weighted summation of the length score and the width score; The critical length is 200 pixels, the critical width is 30 pixels, and the weight of the length score in the weighted summation is 0.6, while the weight of the width score is 0.
4.
8. The method for safety assessment based on underwater fracture watershed segmentation as described in claim 1, characterized in that, The security level determination rules include: A safety factor of 0.8 or higher is considered "safe". A safety factor of 0.5 or less, or less than 0.8, warrants caution. A safety factor of less than 0.5 is considered "dangerous".
9. The method for safety assessment based on underwater fracture watershed segmentation as described in claim 1, characterized in that, The formula for calculating the length score is as follows: (29); in, The total length of the crack. It is the critical length; The formula for calculating the width score is: (30); in, The maximum width of the crack. This is the critical width; The formula for calculating the safety factor is: (31); in, For length score weights, The width score weight is used, and .
10. A system for safety assessment based on underwater fracture watershed segmentation, characterized in that, include: The image preprocessing module is used to acquire an underwater color image as the original image, and to perform color correction and descattering preprocessing on the original image to obtain a descattered image. The detail preservation and enhancement module is used to convert the descattered image into a grayscale image, enhance the details of the grayscale image to obtain a grayscale sharpened image, and then convert the grayscale sharpened image into a color image to obtain a detail-enhanced color image. The watershed segmentation module is used to sequentially perform Gaussian blur and adaptive binarization on the grayscale sharpened image to obtain a binarized image, and to perform watershed segmentation based on the detail-enhanced color image and the binarized image to obtain a crack region mask. A thin crack screening module is used to obtain an effective crack mask based on the crack region mask through connected component analysis. The quantitative analysis and security assessment module is used to perform quantitative analysis on the effective crack mask to obtain a security coefficient, and to determine the security level based on the security coefficient and a preset security level determination rule.