A method for image processing of cracks in building insulation exterior walls
By improving the weighted leadership optimization algorithm and the fuzzy C-mean algorithm, combined with FCM and histogram equalization algorithm, the problems of inaccurate identification and slow processing in crack detection of building insulation exterior walls are solved, and more efficient crack recognition and image processing are achieved .
Patent Information
- Application Number
- CN202411237378.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-05
- Publication Date
- 2024-11-22
- Estimated Expiration
- 2044-09-05
AI Technical Summary
The existing image processing technology is not accurate enough in the detection of cracks in building insulation exterior walls, adapting to complex environments and slow processing speed.
By improving the weighted leadership optimization algorithm (HWLS), the clustering center and fuzzy coefficient of the fuzzy C-mean algorithm are optimized, combined with the FCM algorithm for image segmentation, and image enhancement is used to improve the accuracy and processing speed of crack recognition. .
It effectively improves the segmentation and enhancement effect of crack images of building insulation exterior walls, improves recognition accuracy and processing speed, and enhances the adaptability and efficiency of the algorithm.
Smart Images

Figure CN118761914B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of image processing, and in particular to a method for processing images of cracks in a building thermal insulation exterior wall. Background Art
[0002] Insulated exterior walls are an important component of modern buildings. Their main function is to improve the thermal efficiency of buildings and reduce energy consumption. However, the appearance of cracks in the exterior walls not only affects the appearance of the building, but may also weaken its thermal insulation performance and increase building maintenance costs. As the age of buildings increases, the problem of exterior wall cracks becomes increasingly serious. Traditional crack detection mostly relies on manual visual inspection, which is time-consuming and labor-intensive, and the detection efficiency and accuracy are limited by the experience and conditions of the inspectors.
[0003] With the development of artificial intelligence and machine learning technologies, image processing methods have evolved from simple image enhancement and feature extraction to more complex deep learning algorithm applications, which can improve the automation and intelligence level of crack detection. Although the existing image processing technology has made certain progress in crack detection, there are still some shortcomings, such as inaccurate identification of crack types, poor adaptability to complex environments, and slow processing speed.
[0004] The Weighted-Leader Search (WLS) algorithm is a new type of meta-heuristic algorithm. The WLS algorithm evolves the population by introducing a weighted mechanism of multiple leader solutions to avoid premature convergence, and adopts a simple local search mechanism to enhance the global exploration and local development capabilities of the algorithm. The most important point of the weighted mechanism is the set of top leaders. The set capacity of the top leaders changes linearly with the number of iterations. This method is simply based on iterative changes and cannot adapt well to the changes of the weighted leader optimization algorithm in the image processing of cracks in the exterior wall of building insulation, which is specifically reflected in the speed and accuracy of the image processing of cracks in the exterior wall of building insulation. Summary of the invention
[0005] The present invention aims at the problems of inaccurate recognition of crack types, poor adaptability to complex environments and slow processing speed when using machine learning technology to identify building insulation exterior walls. A method for processing crack images of building insulation exterior walls is provided. By improving a weighted leader optimization algorithm (WLS), the improved weighted leader optimization algorithm (HWLS) is used to optimize the clustering center c and fuzzy coefficient m of a fuzzy C-means algorithm, and the enhanced FCM algorithm is used to segment the image of the building insulation exterior wall to obtain a first enhanced image. Finally, the first enhanced image is further enhanced by a histogram equalization algorithm to obtain a second enhanced image, thereby completing the optimization of the enhancement of the building insulation exterior wall image and improving the recognition accuracy of the building insulation exterior wall cracks.
[0006] In order to achieve the above-mentioned purpose, the technical solution adopted by the present invention is as follows: a method for processing an image of cracks in a building insulation exterior wall, the specific steps of which include segmenting the image of the building insulation exterior wall, separating the crack defect parts of the image of the building insulation exterior wall by utilizing the characteristics of the preprocessed image and enhancing the image of the building insulation exterior wall.
[0007] S1. Preprocessing the image data of the building thermal insulation exterior wall to obtain image features of the crack defect portion, wherein the building thermal insulation exterior wall image includes a crack defect portion and a non-defect portion.
[0008] S2, converting the pre-processed building insulation exterior wall image data into two-dimensional array image data processed by fuzzy C-means algorithm, clustering the two-dimensional array image data by HWLS-FCM method, and obtaining a first enhanced image after segmentation;
[0009] Among them, the HWLS-FCM method is obtained by adjusting the clustering center c and fuzzy coefficient m of the fuzzy C-means algorithm through the improved weighted leadership optimization algorithm;
[0010] The improved weighted leadership optimization algorithm adaptively adjusts the scale of the leadership solution set of the weighted leadership optimization algorithm by establishing an adaptive dynamic scaling factor γ.
[0011] S3. Count the grayscale histogram of the first enhanced image, use the histogram equalization algorithm to perform resolution enhancement on the first enhanced image, obtain the second enhanced image, and complete the precise processing of the building insulation exterior wall crack image.
[0012] Preferably, the fuzzy C-means algorithm groups pixels in the image of the building thermal insulation exterior wall into different clusters, each cluster representing a region in the image, and separates different structures and regions in the image.
[0013] Preferably, in step S1, the image data of the building insulation exterior wall is preprocessed. First, the image of the building insulation exterior wall is grayed. Second, crack features in the image are extracted based on the local binary pattern. The specific steps of the second step are:
[0014] step1, compare the qth pixel value of the building insulation exterior wall image with the surrounding q-1 pixel values. If the surrounding pixel value is greater than the qth pixel value, the qth pixel value is set to 1, otherwise it is set to 0 to obtain a binary number. The Q pixels of the building insulation exterior wall image are executed in sequence to obtain Q binary numbers, where Q is the total number of pixels of the building insulation exterior wall image;
[0015] step2, converting the Q binary numbers into decimal numbers, i.e., local binary pattern values, calculating the local binary pattern for the entire building insulation exterior wall image, and generating a local binary pattern image;
[0016] Step 3, the calculated local binary pattern image is used as the feature vector of the crack defect part in the building insulation exterior wall image;
[0017] Step 4, using the feature vector to calculate and count the texture features of the local area of the cracks in the building insulation exterior wall image to form the image features of the crack defect part of the building insulation exterior wall image.
[0018] Preferably, an adaptive dynamic scaling factor γ is designed and used in the mathematical model of the highest leader solution set. The scale of the highest leader solution set is adjusted according to the change of individual fitness value in the optimization process of the weighted leader search algorithm. The individual fitness value determines the quality of the candidate solution, that is, the individual fitness value determines whether the candidate solution is more suitable for the image processing of cracks in the building insulation exterior wall.
[0019] Preferably, a dynamic scaling factor is designed , specifically:
[0020] S21. Calculate the minimum fitness value of the leader of the population at the tth iteration The minimum fitness value of individuals in the population at the t-1th iteration The difference , introducing the improvement of the individual's optimal fitness in the scaling factor Get the dynamic scaling factor ;
[0021] (1);
[0022] In formula (1), is the initial value of the dynamic scaling factor, is the improvement of the individual's optimal fitness;
[0023] S22, calculate the fitness value of the i-th individual With the minimum fitness value The relative gap between the two is designed, and the scaling adjustment factor α based on fitness is designed. The scaling adjustment factor α is used to improve the dynamic scaling factor Get the adaptive dynamic scaling factor ;
[0024] (2);
[0025] In formula (2), is the adaptive dynamic scaling factor value of the tth iteration, is a control parameter, which takes a random value between 0 and 1. The mathematical model of the scaling adjustment factor α is:
[0026] (3);
[0027] In formula (3), is the maximum fitness value of the population individuals in the tth iteration;
[0028] S23. Using adaptive dynamic scaling factors Adjust the highest leadership solution set to obtain the improved highest leadership solution set NL, and the mathematical model is:
[0029] (4);
[0030] In formula (4), N is the maximum population size, is the adaptive dynamic scaling factor value of the tth iteration, k is a control parameter with a value of 5, which determines the size of the initial highest leadership solution set.
[0031] Preferably, when the individual fitness of the weighted leader search algorithm is close to the minimum, Approaching 0, the adaptive dynamic scaling factor value of the tth iteration is close to the dynamic scaling factor ; When the individual fitness is large, Approaches 1, and the adaptive dynamic scaling factor value of the tth iteration approaches the dynamic scaling factor The maximum value is obtained, which is beneficial for the weighted leader search algorithm to explore more search space and improve the richness of candidate solutions.
[0032] Preferably, an adaptive dynamic scaling factor is used to adjust the size of the highest leader solution set of the weighted leader search algorithm, thereby affecting the search behavior of the weighted leader search algorithm at different iteration stages. Specifically, the weighted leader search algorithm guides the position update of individuals in the weighted leader search algorithm population by selecting multiple leader solutions. In the process of adjusting the clustering center c and the fuzzy coefficient m of the fuzzy C-means algorithm using the weighted leader search algorithm, the position update of the individuals in the population is the update of the clustering center c and the fuzzy coefficient m of the fuzzy C-means algorithm; the highest leader solution set is a set of individual positions corresponding to the first n minimum objective function values in the population, wherein the minimum objective function value is the minimum fitness value.
[0033] Preferably, the improved top leader solution set NL, in the early stage of the weighted leader search algorithm, can make the top leader solution set contain more high-quality solutions through a larger adaptive dynamic scaling factor value, thereby enhancing the exploration ability of the weighted leader search algorithm, covering a larger search space, and avoiding falling into local optimal solutions; in the later stage of the weighted leader search algorithm, through a smaller adaptive dynamic scaling factor value, the top leader solution set can be concentrated on a few excellent solutions, thereby enhancing the development ability of the weighted leader search algorithm, refining the search for local optimal solutions, and improving the accuracy of the solutions.
[0034] Preferably, the cluster center c and the fuzzy coefficient m of the fuzzy C-means algorithm are adjusted using an improved weighted leader search algorithm to obtain the HWLS-FCM method, and the specific steps are as follows:
[0035] P1. Initialize the parameters of the improved weighted leadership optimization algorithm, including: population size N, problem dimension D, search space upper bound UB 、 The search space lower bound LB and the maximum number of iterations T max and the initial value of the dynamic scaling factor;
[0036] P2, encoding the cluster center c and fuzzy coefficient m of the fuzzy C-means algorithm into N groups of two-dimensional space vectors, and mapping the space vectors to the individual positions of the improved weighted leadership optimization algorithm, wherein the upper and lower bounds of the search space are the value ranges of the two-dimensional space vectors;
[0037] P3, select the first n highest leadership solutions of the improved weighted leadership optimization algorithm, and use the weighted average of the highest leadership solutions to update the base point position of the improved weighted leadership optimization algorithm population ; The mathematical model is:
[0038] (5);
[0039] In formula (5), is the base point position of the t-th iteration, NL is the improved top leader solution set, that is, the improved top leader solution scale, w is the weight coefficient of the y-th top leader solution, is the position of the yth highest leader solution at the tth iteration;
[0040] P4. Determine whether the current number of iterations t is equal to the maximum number of iterations T max If yes, then output the leader individual position corresponding to the minimum fitness value and resolve it into the fuzzy C-means algorithm cluster center c and fuzzy coefficient m parameter solution; otherwise, execute P5;
[0041] P5. Establishing an individual position updating mathematical model of an improved weighted leadership optimization algorithm, including a global search phase and a local development phase, and using the individual position updating mathematical model to update the leadership individual position;
[0042] P6. Calculate the fitness value of each leader individual position, and record the leader individual position corresponding to the minimum fitness value up to the current iteration as ;
[0043] P7. Execute t=t+1 for the current iteration number t and return to execute step P3.
[0044] Preferably, an improved weighted leadership search algorithm optimization mathematical model is established, including a global search phase and a local development phase, and the specific steps are:
[0045] P51, in the global search phase, if the adaptive dynamic scaling factor Less than random value , then execute step P52; otherwise, execute step P53;
[0046] P52, using the boundary information and the base point position of the tth iteration to enhance the population diversity of the improved weighted leader search algorithm, a mathematical model is established according to formula (6);
[0047] (6);
[0048] In formula (6), is the individual position of the t+1th iteration, is the individual position of the tth iteration, , , is a random value between 0 and 1, UB and LB are the upper and lower bounds of the search space of the improved weighted leader search algorithm;
[0049] P53, introduce Lévy distribution to generate random step size, and establish a mathematical model according to formula (7) to update the position of individuals in the population of the improved weighted leader search algorithm;
[0050] (7);
[0051] In formula (7), is the step size control parameter, is the Lévy distribution function, where D is the problem dimension;
[0052] P54, in the local development stage, if the random value If it is less than 0.5, go to step 6; otherwise go to step 7;
[0053] P55, introduce an adaptive dynamic scaling factor, use the difference between randomly selected solutions for local development, and establish a mathematical model for updating the position of individuals in the population according to formula (6);
[0054] (8);
[0055] In formula (8), is the adaptive dynamic scaling factor value of the tth iteration, is a random value between 0 and 1. and Two randomly selected solutions at iteration t;
[0056] P57, update the step size control parameter, generate new candidate solutions according to the decreasing direction of the objective function value, and establish a mathematical model for updating the position of individuals in the population according to formula (9);
[0057] (9);
[0058] In formula (9), v is the unit search vector along the decreasing direction of the objective function value, and abs is the function that updates the step size control parameter using the position of the i-th individual and the base point position.
[0059] Preferably, in step P6, the algorithm is guided to optimize by a fitness function, wherein the fitness function The partition entropy function is designed. The closer the partition entropy is to 0, the better the optimization effect of the algorithm is. The specific implementation is:
[0060] (10);
[0061] In formula (10), Q is the total number of pixels of the building insulation exterior wall, K is the number of clusters, is the membership function.
[0062] Preferably, the two-dimensional array image of the building insulation exterior wall is clustered using the HWLS-FCM method to obtain a first enhanced image after segmentation, including:
[0063] S31, randomly initialize the membership matrix U of each building insulation exterior wall image data point belonging to each cluster, each cluster represents a specific area, the specific area is the crack defect part of the building insulation exterior wall, and the maximum number of clusters is V;
[0064] S32, using the improved weighted leadership optimization algorithm to adjust the best cluster center c value and fuzzy coefficient m of each cluster to update the membership matrix u, the mathematical model is:
[0065] (11);
[0066] In formula (11), v is the vth cluster, is the qth pixel value of the building insulation exterior wall image, For the The best cluster centers, is the vth best cluster center, m is the best fuzzy coefficient;
[0067] S33, repeat step S31 and step S32 until the maximum number of iterations T is reached max Output the first enhanced image after segmenting the crack defect part of the building insulation exterior wall image.
[0068] In summary, compared with the prior art, due to the adoption of the above-mentioned technical scheme, the beneficial effects of the present invention are: by optimizing the clustering center and fuzzy coefficient of the fuzzy C-means algorithm through the improved weighted leader optimization algorithm (HWLS), the segmentation and enhancement effects of the crack images of the building insulation exterior wall can be effectively improved. The present invention pre-processes the building insulation exterior wall image data and applies the HWLS-FCM method for efficient image clustering segmentation, and then uses the histogram equalization algorithm to further enhance the image, thereby improving the accuracy of crack identification and the processing speed. By designing a dynamic scaling factor and an adaptive leader solution set adjustment strategy, the method can flexibly respond to different image environments and crack characteristics, thereby enhancing the adaptability and efficiency of the algorithm. BRIEF DESCRIPTION OF THE DRAWINGS
[0069] Figure 1 This is a step-by-step diagram for image enhancement of cracks in building insulation exterior walls using the HWLS-FCM method.
[0070] Figure 2 It is the local binary pattern histogram of the crack image of the building insulation exterior wall.
[0071] Figure 3 A flow chart for adjusting the clustering center c and fuzzy coefficient m of the fuzzy C-means algorithm using the improved weighted leadership optimization algorithm.
[0072] Figure 4 This is a comparison chart of the fitness values of the standard weighted leadership optimization algorithm and the improved weighted leadership optimization algorithm.
[0073] Figure 5 The result diagram of adjusting the clustering center c and fuzzy coefficient m of the fuzzy C-means algorithm to improve the weighted leadership optimization algorithm.
[0074] Figure 6 This is the first enhanced image of the building insulation exterior wall.
[0075] Figure 7 This is the second enhanced image of the building insulation exterior wall. DETAILED DESCRIPTION
[0076] The technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, rather than all the embodiments; based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present invention.
[0077] See also Figure 1-Figure 7The present invention provides a technical solution: a method for processing crack images of building thermal insulation exterior walls, a fuzzy C-means algorithm groups pixels in the image of the building thermal insulation exterior wall into different clusters, each cluster represents an area in the image, and separates different structures and areas in the image. The specific steps are as follows Figure 1 shown.
[0078] S1. Preprocessing the image data of the building thermal insulation exterior wall to obtain image features of the crack defect portion, wherein the building thermal insulation exterior wall image includes a crack defect portion and a non-defect portion.
[0079] Furthermore, the image data of the building insulation exterior wall is preprocessed. First, the image of the building insulation exterior wall is grayed. Second, the crack features in the image are extracted based on the local binary pattern. The specific steps of the second step are:
[0080] step1, compare the qth pixel value of the building insulation exterior wall image with the surrounding q-1 pixel values. If the surrounding pixel value is greater than the qth pixel value, the qth pixel value is set to 1, otherwise it is set to 0 to obtain a binary number. The Q pixels of the building insulation exterior wall image are executed in sequence to obtain Q binary numbers, where Q is the total number of pixels of the building insulation exterior wall image;
[0081] step2, converting the Q binary numbers into decimal numbers, i.e., local binary pattern values, calculating the local binary pattern for the entire building insulation exterior wall image, and generating a local binary pattern image;
[0082] Step 3, the calculated local binary pattern image is used as the feature vector of the crack defect part in the building insulation exterior wall image;
[0083] Step 4, using the feature vector to calculate and count the texture features of the local area of the cracks in the building insulation exterior wall image to form the image features of the crack defect part of the building insulation exterior wall image.
[0084] S2. Convert the pre-processed building insulation exterior wall image data into two-dimensional array image data processed by fuzzy C-means algorithm, cluster the two-dimensional array image data by HWLS-FCM method, and obtain the first enhanced image after segmentation.
[0085] Furthermore, the specific steps of obtaining the first enhanced image after segmentation are as follows:
[0086] S31, randomly initialize the membership matrix U of each building insulation exterior wall image data point belonging to each cluster, each cluster represents a specific area, the specific area is the crack defect part of the building insulation exterior wall, and the maximum number of clusters is V;
[0087] S32, using the improved weighted leadership optimization algorithm to adjust the best cluster center c value and fuzzy coefficient m of each cluster to update the membership matrix u, the mathematical model is:
[0088] (11);
[0089] In formula (11), v is the vth cluster, is the qth pixel value of the building insulation exterior wall image, For the The best cluster centers, is the vth best cluster center, m is the best fuzzy coefficient;
[0090] S33, repeat step S31 and step S32 until the maximum number of iterations T is reached max Output the first enhanced image after segmenting the crack defect part of the building insulation exterior wall image.
[0091] Furthermore, the HWLS-FCM method is obtained by adjusting the clustering center c and fuzzy coefficient m of the fuzzy C-means algorithm through the improved weighted leadership optimization algorithm, as shown in Figure 3 As shown, the specific steps are:
[0092] P1. Initialize the parameters of the improved weighted leadership optimization algorithm, including: population size N, problem dimension D, search space upper bound UB 、 The search space lower bound LB and the maximum number of iterations T max and the initial value of the dynamic scaling factor;
[0093] P2, encoding the cluster center c and fuzzy coefficient m of the fuzzy C-means algorithm into N groups of two-dimensional space vectors, and mapping the space vectors to the individual positions of the improved weighted leadership optimization algorithm, wherein the upper and lower bounds of the search space are the value ranges of the two-dimensional space vectors;
[0094] P3, select the first n highest leadership solutions of the improved weighted leadership optimization algorithm, and use the weighted average of the highest leadership solutions to update the base point position of the improved weighted leadership optimization algorithm population ; The mathematical model is:
[0095] (5);
[0096] In formula (5), is the base point position of the t-th iteration, NL is the improved top leader solution set, that is, the improved top leader solution scale, w is the weight coefficient of the y-th top leader solution, is the position of the yth highest leader solution at the tth iteration;
[0097] P4. Determine whether the current number of iterations t is equal to the maximum number of iterations Tmax If yes, then output the leader individual position corresponding to the minimum fitness value and resolve it into the fuzzy C-means algorithm cluster center c and fuzzy coefficient m parameter solution; otherwise, execute P5;
[0098] P5. Establishing an individual position updating mathematical model of an improved weighted leadership optimization algorithm, including a global search phase and a local development phase, and using the individual position updating mathematical model to update the leadership individual position;
[0099] P6. Calculate the fitness value of each leader individual position, and record the leader individual position corresponding to the minimum fitness value up to the current iteration as ;
[0100] P7. Execute t=t+1 for the current iteration number t and return to execute step P3.
[0101] Furthermore, the improved weighted leadership optimization algorithm is implemented by designing an adaptive dynamic scaling factor γ to adaptively adjust the scale of the leadership solution set of the weighted leadership optimization algorithm, wherein the dynamic scaling factor is designed ... , specifically:
[0102] S21. Calculate the minimum fitness value of the leader of the population at the tth iteration The minimum fitness value of individuals in the population at the t-1th iteration The difference , introducing the improvement of the individual's optimal fitness in the scaling factor Get the dynamic scaling factor ;
[0103] (1);
[0104] In formula (1), is the initial value of the dynamic scaling factor, is the improvement of the individual's optimal fitness;
[0105] S22, calculate the fitness value of the i-th individual With the minimum fitness value The relative gap between the two is designed, and the scaling adjustment factor α based on fitness is designed. The scaling adjustment factor α is used to improve the dynamic scaling factor Get the adaptive dynamic scaling factor ;
[0106] (2);
[0107] In formula (2), is the adaptive dynamic scaling factor value of the tth iteration, is a control parameter, which takes a random value between 0 and 1. The mathematical model of the scaling adjustment factor α is:
[0108] (3);
[0109] In formula (3), is the maximum fitness value of the population individuals in the tth iteration;
[0110] S23. Using adaptive dynamic scaling factors Adjust the leadership solution set to obtain the improved leadership solution set NL, and the mathematical model is:
[0111] (4);
[0112] In formula (4), N is the maximum population size, is the adaptive dynamic scaling factor value of the tth iteration, k is a control parameter with a value of 5, which determines the size of the initial leading solution set.
[0113] Furthermore, an improved mathematical model for optimizing the weighted leader search algorithm is established, including a global search phase and a local development phase. The specific steps are as follows:
[0114] P51, in the global search phase, if the adaptive dynamic scaling factor Less than random value , then execute step P52; otherwise, execute step P53;
[0115] P52, using the boundary information and the base point position of the tth iteration to enhance the population diversity of the improved weighted leader search algorithm, a mathematical model is established according to formula (6);
[0116] (6);
[0117] In formula (6), is the individual position of the t+1th iteration, is the individual position of the tth iteration, , , is a random value between 0 and 1, UB and LB are the upper and lower bounds of the search space of the improved weighted leader search algorithm;
[0118] P53, introduce Lévy distribution to generate random step size, and establish a mathematical model according to formula (7) to update the position of individuals in the population of the improved weighted leader search algorithm;
[0119] (7);
[0120] In formula (7), is the step size control parameter, is the Lévy distribution function, where D is the problem dimension;
[0121] P54, in the local development stage, if the random value If it is less than 0.5, go to step 6; otherwise go to step 7;
[0122] P55, introduce an adaptive dynamic scaling factor, use the difference between randomly selected solutions for local development, and establish a mathematical model for updating the position of individuals in the population according to formula (6);
[0123] (8);
[0124] In formula (8), is the adaptive dynamic scaling factor value of the tth iteration, is a random value between 0 and 1. and Two randomly selected solutions at iteration t;
[0125] P57, update the step size control parameter, generate new candidate solutions according to the decreasing direction of the objective function value, and establish a mathematical model for updating the position of individuals in the population according to formula (9);
[0126] (9);
[0127] In formula (9), v is the unit search vector along the decreasing direction of the objective function value, and abs is the function that updates the step size control parameter using the position of the i-th individual and the base point position.
[0128] Furthermore, the algorithm is guided to optimize by the fitness function, and the fitness function The partition entropy function is designed. The closer the partition entropy is to 0, the better the optimization effect of the algorithm is. The specific implementation is:
[0129] (10);
[0130] In formula (10), Q is the total number of pixels of the building insulation exterior wall, K is the number of clusters, is the membership function.
[0131] S3. Count the grayscale histogram of the first enhanced image, use the histogram equalization algorithm to perform resolution enhancement on the first enhanced image, obtain the second enhanced image, and complete the precise processing of the building insulation exterior wall crack image.
[0132] Further, for each gray value of the first enhanced image after the crack defect portion of the building insulation exterior wall image is segmented, the number of pixels having the gray value in the image is calculated by scanning each pixel in the image and accumulating the corresponding gray value, and the statistically obtained gray value distribution is plotted into a chart, such as Figure 2 As shown, the horizontal axis represents the gray value, and the vertical axis represents the number of pixels with the gray value. Figure 2 The distribution of brightness and contrast in the image can be intuitively seen; further, the cumulative distribution function is calculated from the grayscale histogram, and the grayscale values in the original image are mapped to new grayscale values according to the cumulative distribution function. The equalized grayscale values are applied to the original building insulation exterior wall image to generate an enhanced second enhanced image.
[0133] Furthermore, experimental verification was carried out in Matlab, and the code was written using M files to complete the improved weighted leadership optimization algorithm (HWLS) code. In order to further verify the advanced nature of the method of the present invention, the standard weighted leadership optimization algorithm (WLS) was introduced for comparison, and the maximum number of iterations T was set. max is 50, the maximum population size N is 50, the problem dimension D is 5, and the upper bound of the search space UB=[20,1.1] 、 The lower bound of the search space LB=[0,0] and the initial value of the dynamic scaling factor are 1; the improved weighted leadership optimization algorithm (HWLS) is run to adjust the clustering center c and fuzzy coefficient m of the fuzzy C-means algorithm.
[0134] Furthermore, the fitness function It reflects the algorithm's tuning process of the cluster center c and fuzzy coefficient m of the fuzzy C-means algorithm. The smaller the fitness value, the better the algorithm performance and the better the subsequent segmentation effect. Figure 4 As shown in the figure, the minimum fitness value of the standard weighted leadership optimization algorithm (WLS) is: 398.9602, and the minimum fitness value of the improved weighted leadership optimization algorithm (HWLS) is: 0.666, which means that the improved weighted leadership optimization algorithm (HWLS) has higher optimization accuracy than the standard weighted leadership optimization algorithm (WLS). It further shows that the improved weighted leadership optimization algorithm (HWLS) has higher setting accuracy for the clustering center c and fuzzy coefficient m of the fuzzy C-means algorithm, thereby improving the segmentation accuracy of the building exterior insulation exterior wall image.
[0135] Furthermore, if Figure 5 As shown in the figure, the improved weighted leadership optimization algorithm (HWLS) adjusts the clustering center c and fuzzy coefficient m of the fuzzy C-means algorithm, and the optimal center clustering points are 3, which are: 2.35, 8.54, and 15.33 respectively; the optimal fuzzy coefficient m is 0.86.
[0136] Furthermore, the HWLS-FCM method program is completed. First, the image of the building's external thermal insulation wall is read. Then, the image of the building's external thermal insulation wall is converted into a grayscale image. The grayscale image of the building's external thermal insulation wall is converted into a double precision type. Fuzzy C-means clustering is run. According to the segmentation result, post-processing is performed to remove noise and fill holes. The segmentation result is obtained, and the segmentation result map is displayed. The first enhanced map of the building's external thermal insulation wall image is obtained, such as Figure 6 As shown, the resolution of the first image is enhanced by using the histogram equalization algorithm to obtain a second enhanced image of the building exterior insulation wall image, as shown in Figure 7 shown.
Claims
1. A method for processing images of cracks in building thermal insulation exterior walls, characterized in that: The specific steps are: S1. Preprocessing the image data of the building thermal insulation exterior wall to obtain image features of the crack defect part, wherein the building thermal insulation exterior wall image includes the crack defect part and the non-defect part; S2, converting the pre-processed building insulation exterior wall image data into two-dimensional array image data processed by fuzzy C-means algorithm, clustering the two-dimensional array image data by HWLS-FCM method, and obtaining a first enhanced image after segmentation; Among them, the HWLS-FCM method is obtained by adjusting the clustering center c and fuzzy coefficient m of the fuzzy C-means algorithm through the improved weighted leadership optimization algorithm; The improved weighted leadership optimization algorithm is specifically implemented by: designing an adaptive dynamic scaling factor γ to adaptively adjust the scale of the highest leadership solution set of the weighted leadership optimization algorithm; S3, counting the grayscale histogram of the first enhanced image, using a histogram equalization algorithm to perform resolution enhancement on the first enhanced image, obtaining a second enhanced image, and completing accurate processing of the image of cracks in the building insulation exterior wall; Among them, in S1, the image data of the building insulation exterior wall is preprocessed, and the preprocessing is to extract crack features in the image based on the local binary pattern, and the specific steps are: step1, compare the qth pixel value of the building insulation exterior wall image with the surrounding q-1 pixel values. If the surrounding pixel value is greater than the qth pixel value, the qth pixel value is set to 1, otherwise it is set to 0 to obtain a binary number. The Q pixels of the building insulation exterior wall image are executed in sequence to obtain Q binary numbers, where Q is the total number of pixels of the building insulation exterior wall image; step2, converting the Q binary numbers into decimal numbers, i.e., local binary pattern values, calculating the local binary pattern for the entire building insulation exterior wall image, and generating a local binary pattern image; Step 3, the calculated local binary pattern image is used as the feature vector of the crack defect part in the building insulation exterior wall image; Step 4, using the feature vector to calculate and count the texture features of the crack local area of the building insulation exterior wall image to form the image features of the crack defect part of the building insulation exterior wall image; Among them, the HWLS-FCM method is used to cluster the two-dimensional array image of the building insulation exterior wall to obtain the first enhanced image after segmentation, including: S31, randomly initialize the membership matrix U of each building insulation exterior wall image data point belonging to each cluster, each cluster represents a specific area, the specific area is the crack defect part of the building insulation exterior wall, and the maximum number of clusters is V; S32, using the improved weighted leadership optimization algorithm to adjust the best cluster center c value and fuzzy coefficient m of each cluster to update the membership matrix u, the mathematical model is: In formula (11), v is the vth cluster, x q is the qth pixel value of the building insulation exterior wall image, c l is the lth best cluster center, c v is the vth best cluster center, m is the best fuzzy coefficient; S33, repeat step S31 and step S32 until the maximum number of iterations T is reached max Outputting a first enhanced image after segmenting the crack defect portion of the building insulation exterior wall image; The improved weighted leadership optimization algorithm in S2 adjusts the cluster center c and the fuzzy coefficient m of the fuzzy C-means algorithm, and the specific steps are: P1. Initialize the parameters of the improved weighted leadership optimization algorithm, including: population size N, problem dimension D, search space upper bound UB, search space lower bound LB, and maximum number of iterations T max and the initial value of the dynamic scaling factor; P2, encoding the cluster center c and fuzzy coefficient m of the fuzzy C-means algorithm into N groups of two-dimensional space vectors, and mapping the space vectors to the individual positions of the improved weighted leadership optimization algorithm, wherein the upper and lower bounds of the search space are the value ranges of the two-dimensional space vectors; P3, select the first n highest leadership solutions of the improved weighted leadership optimization algorithm, and use the weighted average of the highest leadership solutions to update the base point position X of the improved weighted leadership optimization algorithm population base (t); the mathematical model is: In formula (5), X base (t) is the base point position of the t-th iteration, NL is the set of improved top leader solutions, that is, the scale of improved top leader solutions, w is the weight coefficient of the y-th top leader solution, X Ly (t) is the position of the yth highest leader solution at the tth iteration; P4. Determine whether the current number of iterations t is equal to the maximum number of iterations T max If yes, then output the leader individual position corresponding to the minimum fitness value and resolve it into the fuzzy C-means algorithm cluster center c and fuzzy coefficient m parameter solution; otherwise, execute P5; P5. Establishing an individual position updating mathematical model of an improved weighted leadership optimization algorithm, including a global search phase and a local development phase, and using the individual position updating mathematical model to update the leadership individual position; P6. Calculate the fitness value of each leader individual position, and record the leader individual position corresponding to the minimum fitness value up to the current iteration as X best (t); P7. Execute t=t+1 for the current iteration number t, and return to execute step P3.
2. A method for processing images of cracks in building thermal insulation exterior walls according to claim 1, characterized in that: Design an adaptive dynamic scaling factor γ, and use the scaling factor γ in the mathematical model of the highest leadership solution set to realize the weighted leadership search algorithm in the optimization process according to the individual fitness value The size of the highest leader solution set is adjusted by changing, and the individual fitness value determines whether the candidate solution is more suitable for the image processing of cracks in the building insulation exterior wall. The specific steps are: S21. Calculate the minimum fitness value f of the leader of the population at the tth iteration best (t) and the minimum fitness value f of individuals in the population at the t-1th iteration best The difference Δf of (t-1) best , introducing the improvement of individual optimal fitness Δf in the scaling factor best Get the dynamic scaling factor γ1(t); In formula (1), γ0 is the initial value of the dynamic scaling factor, Δf best is the improvement of the individual's optimal fitness; S22, calculate the fitness value of the i-th individual With the minimum fitness value f best (t), design a scaling adjustment factor α based on fitness, and use the scaling adjustment factor α to improve the dynamic scaling factor γ1(t) to obtain an adaptive dynamic scaling factor γ; γ(t)=γ1(t)·(1-α p ) (2) In formula (2), γ(t) is the adaptive dynamic scaling factor value of the t-th iteration, p is the control parameter, which takes a random value between 0 and 1, and the mathematical model of the scaling adjustment factor α is: In formula (3), f worst (t) is the maximum fitness value of the population individuals in the tth iteration; S23, using the adaptive dynamic scaling factor γ to adjust the highest leadership solution set, to obtain an improved highest leadership solution set NL, the mathematical model is: In formula (4), N is the maximum population size, γ(t) is the adaptive dynamic scaling factor value of the tth iteration, and k is a control parameter with a value of 5, which determines the size of the initial highest leadership solution set.
