A wall crack visual detection method based on an adaptive image segmentation algorithm

By combining adaptive image segmentation algorithm with morphological topology and geometric feature sequence analysis, a dual-objective fitness evaluation function is constructed, which solves the threshold robustness problem of wall crack detection in complex backgrounds and achieves high-precision crack extraction.

CN122265250APending Publication Date: 2026-06-23CHINA JILIANG UNIV
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202610406463.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-03-31
Publication Date
2026-06-23

Smart Images

  • Figure CN122265250A_ABST
    Figure CN122265250A_ABST
Patent Text Reader

Abstract

The application discloses a wall crack visual detection method based on an adaptive image segmentation algorithm, and the method comprises the following steps: performing a gray-scale conversion on an original wall crack image, taking a complete gray value range as a search interval, performing a morphological operation and a filter pretreatment on the gray-scale image, traversing each threshold value in the interval to binarize the pretreated image, and extracting a morphological topology and a geometric feature sequence corresponding to each threshold value; determining an effective threshold value search space by taking a point with the largest number of connected domains as a lower limit, performing linear normalization on the morphological topology feature sequence, and performing logarithmic smoothing and normalization processing on the geometric feature sequence; constructing a coupled double-target fitness evaluation function to obtain an optimal segmentation threshold value; obtaining a binarization result by using the optimal threshold value, removing small-area noise points and connecting broken cracks through a morphological operation, and obtaining a final crack binarization image. The method has high recognition accuracy, can adapt to uneven illumination and a large noise environment, and has a good engineering application prospect.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of building surface defect detection technology, and in particular to a visual detection method for wall cracks based on an adaptive image segmentation algorithm. Background Technology

[0002] With the acceleration of urbanization, building safety monitoring has become a key focus in the engineering field. Wall cracks, as a direct indicator of a building's structural health, can develop into serious structural safety hazards if not detected and repaired promptly. Traditional crack inspections mainly rely on manual scaffolding or suspended platforms for close-range observation. This method is not only inefficient and has limited coverage, but also poses extremely high safety risks, especially in high-rise buildings. In recent years, utilizing drones equipped with high-definition cameras to acquire images of building exterior walls and combining this with computer vision algorithms for automatic identification has become an important development direction in the field of wall defect detection.

[0003] In existing crack detection processes, the acquired raw image is typically first converted to grayscale and preprocessed, then converted into a binary mask using a fixed global threshold or an adaptive thresholding algorithm (such as the Otsu method). To filter out isolated noise points in the background, existing improved schemes usually combine simple connected component area filtering techniques, and finally output the recognition result. However, due to the complex wall environment, images acquired by drones are often affected by uneven lighting, wall stains, and fine textures, resulting in a high degree of overlap between the grayscale features of crack pixels and background noise.

[0004] Existing technologies still face the following challenges in practical applications: First, the robustness of threshold selection is poor. Traditional global thresholding methods struggle to adapt to varying imaging environments, while existing adaptive methods often lack in-depth consideration of crack morphological features, easily leading to over-segmentation or under-segmentation in complex backgrounds. Second, there are irreconcilable physical conflicts. During crack extraction, relaxing the threshold to preserve the complete scale of the main crack can cause a surge in background noise, resulting in severe interference; conversely, tightening the threshold to suppress noise can lead to the loss of fine cracks or severe breakage of the main crack. Therefore, constructing an adaptive threshold segmentation algorithm that balances "main crack scale" and "background noise suppression" to achieve more accurate wall crack detection is a pressing technical challenge in the field of building surface defect detection. Summary of the Invention

[0005] This invention provides a visual detection method for wall cracks based on an adaptive image segmentation algorithm. The method aims to obtain key information such as crack topology and pixel distribution required for wall monitoring by analyzing the morphological topology and geometric feature sequence of wall images. It has high recognition accuracy and good adaptability.

[0006] This invention provides the following technical solution: a visual detection method for wall cracks based on an adaptive image segmentation algorithm, characterized by the following steps: S1: acquiring an image of the wall crack to be detected, performing grayscale transformation on the original image, using the complete grayscale value range as the search interval, then performing morphological processing and filtering on the grayscale image, traversing each candidate threshold within the interval to binarize the preprocessed grayscale image, thereby extracting the morphological topology and geometric feature sequences corresponding to each threshold; S2: using the point with the most connected components in the morphological topology feature sequence as the lower bound to determine the effective threshold search space; and within the effective threshold search space, performing linear normalization on the morphological topology feature sequence, and logarithmic smoothing and normalization on the geometric feature sequence; S3: constructing a coupled bi-objective fitness evaluation function to obtain the optimal segmentation threshold; S4: using the optimal segmentation threshold obtained in S3 to perform binarization to obtain the image segmentation result, removing relatively small isolated noise points through morphological operations and connecting the cracks to obtain the final binary image of the crack.

[0007] In one embodiment of the present invention, S1 includes the following specific steps: S11: First, the acquired original wall crack image is converted to grayscale, and the three RGB channels are converted into a crack grayscale image with only one channel. A global grayscale search space T={t|t∈[0,L-1]} is established, where L is the total number of grayscale levels of the target grayscale image; S12: Through morphological processing and filtering, the dark details of the target are extracted from the original grayscale image and background clutter is suppressed to obtain an enhanced high-quality grayscale image; S13: Traversing within the space described in S11, the grayscale images under each grayscale threshold are binarized and connected component analysis is performed to extract the morphological topological and geometric feature sequences (including quantity feature sequences and area feature sequences) that change with the threshold.

[0008] In one embodiment of the present invention, S2 includes the following specific steps: S21: For the quantitative feature sequence obtained in S13, retrieve the global maximum value, and determine the threshold corresponding to the maximum value as the background noise peak point; extract a sub-interval from the background noise peak point to the end of the interval as the effective threshold search space, thereby filtering out invalid low-threshold noise interference; S22: Apply a logarithmic function to the area feature sequence obtained in S13 for nonlinear dimensionality reduction smoothing, using the characteristics of the logarithmic curve to suppress the weight of huge color blocks, while amplifying the differences of small cracks. Finally, normalize the smoothed area feature sequence and the quantitative feature sequence respectively to obtain the normalized quantitative index (N). norm ) and normalized area index (A norm ).

[0009] In one embodiment of the present invention, S3 includes the following specific steps: S31: Constructing a bi-objective fitness evaluation function, wherein the value of the fitness function is determined by the normalized area index (A). norm ) and the number of connected components after polarity reversal (1-N) norm The product of ) constitutes the structure; S32: Calculate the fitness score corresponding to each gray level in the effective search space. The point with the highest score represents the optimal balance between the backbone size and the number of background connected components. Extract the gray level corresponding to the highest score as the optimal segmentation threshold;

[0010] In one embodiment of the present invention, S4 includes the following specific steps: S41: Extract the optimal segmentation threshold in S32 and use it to binarize the enhanced grayscale image to output a wall crack binarized image; S42: Perform morphological processing on the binarized image to remove isolated noise points with relatively small areas and connect the fracture cracks to obtain the final crack binarized image.

[0011] The beneficial effects of this invention are as follows: The wall crack visual detection method based on adaptive image segmentation algorithm proposed in this invention exhibits good robustness in complex backgrounds; through joint evaluation of morphological topology and geometric feature sequences, this method can effectively suppress the interference of uneven lighting and random background noise on the extraction results, significantly improving the reliability and adaptability of the crack detection system in actual engineering environments, and has strong engineering significance. Attached Figure Description

[0012] Figure 1 This is a flowchart of the wall crack detection process involved in the present invention.

[0013] Figure 2 This is a grayscale schematic diagram of a wall crack image related to the present invention.

[0014] Figure 3 This is a schematic diagram of the curve showing the normalized maximum connected region area as a function of a threshold, which is involved in this invention.

[0015] Figure 4 This is a schematic diagram of the curve showing the change in the number of connected components in an image as a function of a threshold, as involved in this invention.

[0016] Figure 5 This is a schematic diagram of the comprehensive optimization curve involved in the present invention.

[0017] Figure 6 This is a schematic diagram of the binarization of a wall crack image under the optimal threshold according to the present invention.

[0018] Figure 7 This is a schematic diagram of the final binarization of a wall crack image according to the present invention. Detailed Implementation

[0019] The core of this invention lies in providing a visual detection method for wall cracks based on an adaptive image segmentation algorithm. Through joint mapping analysis of image morphological topology and geometric features, it effectively achieves automated and refined extraction of crack targets in complex wall environments, applicable to the detection of most wall cracks. To make the objectives, technical solutions, and advantages of this invention clearer, the technical solutions in the embodiments of this invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of this invention, and not all of them. Based on the embodiments of this invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this invention.

[0020] The present invention will now be further described with reference to the accompanying drawings and specific embodiments.

[0021] like Figure 1 The flowchart shown illustrates that this invention provides a visual detection method for wall cracks based on an adaptive image segmentation algorithm: S1: In this embodiment, the acquisition method of the image to be detected is not strictly limited. For example, the target wall can be captured in real time by any conventional image acquisition device. After acquiring the original image of the wall crack to be detected, it is converted to grayscale, and the complete grayscale value range is used as the search interval. Then, morphological processing and filtering are performed on the grayscale image. Each candidate threshold within the interval is traversed to binarize the preprocessed grayscale image, thereby extracting the morphological topological and geometric feature sequences corresponding to each threshold; S2: The point with the most connected components in the morphological topological feature sequence is used as the lower bound to determine the effective threshold search space; and within the effective threshold search space, the morphological topological feature sequence is linearly normalized, and the geometric feature sequence is logarithmically smoothed and normalized; S3: A coupled bi-objective fitness evaluation function is constructed to obtain the optimal segmentation threshold; S4: The optimal segmentation threshold obtained in S3 is used to perform binarization to obtain the image segmentation result. By removing isolated noise points with relatively small areas and connecting the cracks, the final crack binarized image is obtained.

[0022] The specific calculation steps for S1 are as follows:

[0023] S11: First, the obtained original wall crack image needs to be converted to grayscale. The three RGB channels are converted into a single-channel crack grayscale image to remove redundant information. The conversion formula is as follows:

[0024]

[0025] in, Figure 2The image shown is a schematic diagram of the converted grayscale image I(x, y). R, G, and B are the red, green, and blue channel component values ​​of the corresponding pixels in the original image, respectively. The coefficients before R, G, and B are transformation coefficients that conform to the human eye's perception of different color brightness. In this embodiment, the wall crack image is an 8-bit grayscale image with a total number of grayscale levels L=256. At this time, the global grayscale search space is established as T={t|t∈[0,255]}.

[0026] S12: First, select an elliptical structuring element with a template of 25×25 and perform black hat transformation on the target grayscale image I(x,y). The resulting image is denoted as H(x,y). This extracts the dark crack features in the image and suppresses low-frequency interference caused by non-uniform lighting in the background. Next, select a Gaussian convolution kernel with a template of 3×3 and perform convolution operation with the preprocessed image matrix to perform smoothing and denoising processing. This removes small isolated noise points in the image and further improves the signal-to-noise ratio of the crack target, resulting in an enhanced high-quality grayscale image G(x,y).

[0027] S13: Traverse each grayscale threshold t in the space, and binarize the preprocessed grayscale image G(x, y) to obtain the binary image sequence B. t :

[0028]

[0029] For each binary image B t Connectivity analysis is performed to extract morphological topological and geometric features at the current threshold, constructing a morphological topological feature sequence N (quantitative feature sequence) and a morphological geometric feature sequence A (area feature sequence), denoted as follows:

[0030]

[0031]

[0032] Where n t a represents the number of connected components in the image when the threshold is t. t a represents the number of pixels in the largest connected component of the image when the threshold is t. t Recorded as:

[0033]

[0034] The specific calculation steps for S2 are as follows:

[0035] S21: Perform an extreme value search on the morphological quantitative feature sequence N obtained in step S13, and retrieve the grayscale threshold corresponding to the global maximum value of the number of connected components in the sequence, and denote it as the noise peak threshold t. peak :

[0036]

[0037] With the noise peak threshold t peak Using this as the initial boundary and combining it with the global grayscale upper limit of 255, we construct the effective threshold search interval T. valid =[t peak [,255];

[0038] S22: To eliminate the differences in dimensions and numerical magnitude between geometric features (area) and topological features (quantity), this embodiment performs dimensionless processing on the extracted feature sequence. The specific steps are as follows:

[0039] For the area feature sequence A={a t |t∈T valid Since the area span of cracks and background noise typically differs by orders of magnitude, a logarithmic function is used for dynamic range compression to suppress the dominant role of abnormally large noise areas in the evaluation results and enhance the response characteristics of small-sized cracks. The calculation formula is as follows:

[0040]

[0041] The logarithmically processed sequence was then normalized by range to obtain the normalized area significance sequence A. norm :

[0042]

[0043] Wherein, ln(a t +1) operation ensures the mathematical stability of the calculation process when the pixel area is zero, and makes the feature response more focused on the geometric evolution trend of the target through nonlinear mapping.

[0044] in, Figure 3 The figure shows a curve illustrating the change of the normalized maximum connected region area with respect to the threshold, which depicts the influence of the segmentation threshold t on the degree of preservation of the crack body.

[0045] For the quantity feature sequence N={n t |t∈T valid To preserve the original distribution characteristics of background fragmentation as a function of the threshold, linear range normalization is used to map it to the [0,1] interval, resulting in the normalized background fragmentation sequence N. norm :

[0046]

[0047] Wherein, the N norm The larger the value, the higher the degree of dispersion of the image background under the current threshold, that is, the more connected components the recognition result has.

[0048] in, Figure 4 The figure shows a curve illustrating the change in the number of connected components in an image as a function of a threshold. As the threshold t increases, tiny isolated noise points in the image background are gradually eliminated, resulting in a significant decrease in the number of connected components in the image.

[0049] The specific calculation steps for S3 are as follows:

[0050] S31: Reliable crack target extraction requires simultaneously satisfying two mutually exclusive physical conditions: first, the extracted main crack size should be as large as possible; second, the number of isolated noise points in the background should be as small as possible. Based on the normalized area saliency feature A... norm With background fragmentation sequence N norm A bi-objective evaluation function f(t) is established, aiming to maximize the continuity of the objective while minimizing the number of connected components. The value of the fitness function is determined by the normalized area index (A). norm ) and the number of connected components after polarity reversal (1-N) norm The product is constructed by element-wise multiplication, and the calculation formula is as follows:

[0051]

[0052] The polarity reversal operation transforms the number of connected components, which originally represented the degree of background dispersion, into a positive gain characterizing the background noise suppression effect. This ensures that the extreme points of f(t) can simultaneously consider the geometric scale of the target and the low-noise characteristics of the detection space.

[0053] S32: Calculate the fitness score for each gray level within the effective search space. The point with the highest score represents the optimal balance between maximizing the backbone size and minimizing the number of connected components. Extract the gray level corresponding to the highest score as the optimal segmentation threshold T. best .

[0054] in, Figure 5 The diagram shows a comprehensive optimization curve, which also includes the trend of the evaluation function score (used to evaluate the comprehensive segmentation quality under different thresholds. Since the area index and the connected component quantity index are mutually exclusive as the threshold changes, the fitness score curve formed by their weighted product will show a significant peak during the traversal process. This peak point represents the optimal balance between crack feature preservation and noise suppression). This adaptive algorithm can adaptively lock the optimal segmentation threshold for the current image by searching for the global maximum value in f(t). Figure 5 (At t=30 as indicated in the text).

[0055] The specific calculation steps for S4 are as follows:

[0056] S41: Extract the optimal segmentation threshold T from S32 bestThe enhanced grayscale image is then binarized using this method, outputting a binarized image of the wall cracks. Figure 6 As shown Figure 1 The binarized image obtained by the adaptive algorithm;

[0057] S42: Morphological processing is performed on the binarized image. Specifically, the image is optimized by combining morphological opening and closing operations. First, the binarized image is opened to remove and filter out small noise and burrs in the background of the wall. Then, the image is closed to fill the small holes inside the crack and connect the local fracture areas of the crack caused by segmentation, so as to obtain the final binarized image of the crack.

[0058] By following the steps and methods described above, wall cracks can be detected in images. Figure 7 As shown Figure 6 The final binarized result image obtained after opening and closing operations.

[0059] Preferably, the present invention is developed on the Windows 11 operating system based on the Python 3.9 platform, and completes the corresponding visual processing by calling the OpenCV vision library.

[0060] The above description of the embodiments is only for the purpose of helping to understand the method and core ideas of the present invention. It should be noted that those skilled in the art can make several improvements and modifications to the present invention without departing from the principles of the present invention, and these improvements and modifications also fall within the protection scope of the claims of the present invention.

Claims

1. A visual detection method for wall cracks based on an adaptive image segmentation algorithm, characterized in that: The method includes the following steps: S1: Obtain the image of the wall crack to be detected, perform grayscale transformation on the original image, and use the complete grayscale value range as the search interval. Then, perform morphological operations and filtering preprocessing on the grayscale image, traverse each candidate threshold in the interval, and perform binarization processing on the preprocessed grayscale image to extract the morphological topology and geometric feature sequence corresponding to each threshold. S2: The point with the most connected components in the morphological topological feature sequence is used as the lower bound to determine the effective threshold search space; and within the effective threshold search space, the morphological topological feature sequence is linearly normalized, and the geometric feature sequence is logarithmically smoothed and normalized. S3: Construct a coupled dual-objective fitness evaluation function to obtain the optimal segmentation threshold; S4: Use the optimal segmentation threshold obtained in S3 to perform binarization to obtain the image segmentation result. Remove isolated noise points with relatively small areas through morphological operations and connect the fracture cracks to obtain the final crack binarized image.

2. The wall crack detection method according to claim 1, characterized in that: S1 includes the following specific steps: S11: First, the original wall crack image is converted to grayscale, and the three RGB channels are converted into a single-channel crack grayscale image. Then, a global grayscale search space T={t|t∈[0,L-1]} is established, where L is the total number of grayscale levels of the target grayscale image. S12: By using black hat transform and filtering techniques, the dark details of the target are extracted from the original grayscale image and background clutter is suppressed to obtain an enhanced grayscale image; S13: Traverse the space described in S11, perform binarization and connected component analysis on the grayscale images under each grayscale threshold, and extract the morphological topological and geometric feature sequences (including quantitative feature sequences and area feature sequences) that change with the threshold.

3. The wall crack detection method according to claim 1, characterized in that: S2 includes the following specific steps: S21: For the quantitative feature sequence obtained in S13, retrieve the global maximum value from it, and determine the threshold corresponding to the maximum value as the background noise peak point; extract the sub-interval from the background noise peak point to the end of the interval as the effective threshold search space, thereby filtering out invalid low threshold noise interference; S22: The area feature sequences obtained in S13 are uniformly smoothed using a logarithmic function for nonlinear dimensionality reduction. The characteristics of the logarithmic curve are used to suppress the weight of large color blocks while amplifying the differences in small cracks. Finally, the smoothed area feature sequences and quantity feature sequences are normalized separately to obtain the normalized quantity index (N). norm ) and normalized area index (A norm ).

4. The wall crack detection method according to claim 1, characterized in that: S3 includes the following specific steps: S31: Construct a bi-objective fitness evaluation function, the value of which is determined by the normalized area index (A). norm ) and the number of connected components after polarity reversal (1-N) norm The product of ) constitutes; S32: Calculate the fitness score for each gray level within the effective search space. The point with the highest score represents the optimal balance between maximizing the backbone size and minimizing the number of connected components. Extract the gray level corresponding to the highest score as the optimal segmentation threshold.

5. The wall crack detection method according to claim 1, characterized in that: S4 includes the following specific steps: S41: Extract the optimal segmentation threshold from S32 and use it to binarize the enhanced grayscale image, outputting a binarized image of the wall crack; S42: Perform morphological processing on the binarized image to remove isolated noise points with relatively small areas and connect the fracture cracks to obtain the final crack binarized image.