A method and system for detecting building construction quality
By performing initial threshold correction on the wall image in building construction quality inspection, the detection deviation problem caused by the difference in light and shadow and pit depth in the prior art is solved, and higher detection accuracy is achieved.
Patent Information
- Application Number
- CN202411555537.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-04
- Publication Date
- 2025-02-25
- Estimated Expiration
- 2044-11-04
AI Technical Summary
The existing building construction quality testing methods are difficult to accurately identify all defective areas on the wall when the lighting conditions are different and the depth of pits in different wall areas are large, resulting in low detection results deviation and accuracy.
By acquiring the wall image, different initial thresholds are used for segmentation, the degree of each pixel point in the dark area and the direction consistency between the center of the dark pixel point and the center of the bright pixel point, and the initial threshold is corrected to obtain the correct segmentation of each pixel point Threshold, thereby performing more accurate image segmentation and quality detection.
It improves the accuracy of building construction quality inspection, can more effectively identify defect areas on the wall, and reduces the impact of light and shadow on the detection results.
Smart Images

Figure CN119067969B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of image data processing, and in particular to a method and system for detecting building construction quality. Background Art
[0002] At present, in order to realize the construction quality inspection in the construction industry, wall images are collected, image segmentation is performed on the wall images, and then feature extraction is performed to analyze the results and provide feedback. The main function of image segmentation is to segment the areas with defects on the wall in the image. Image segmentation is usually performed using global threshold segmentation. However, due to different lighting conditions during image acquisition and the large differences in the depth of pits in different wall areas, under the same lighting conditions, they may appear as different light and dark areas, that is, different light and shadow areas. If global threshold segmentation is used, it is easily affected by the brightness of light and shadow, resulting in the inability to identify all defective areas on the wall, which in turn leads to deviations in wall quality inspection and low accuracy. Summary of the invention
[0003] In order to solve the above technical problems, the purpose of the present invention is to provide a construction quality detection method and system, and the technical solutions adopted are as follows:
[0004] In a first aspect, an embodiment of the present application provides a method for detecting building construction quality, comprising:
[0005] Acquire a wall image, and segment the wall image using different initial thresholds to obtain corresponding different segmented images;
[0006] Determining, according to the different segmented images, the extent to which each pixel point is in the dark area and determining the consistency of the direction from the center of the dark pixel point to the center of the bright pixel point shown by each pixel point in the different segmented images;
[0007] According to the degree and the consistency of each pixel point, the different initial thresholds are corrected to obtain a corrected segmentation threshold value for each pixel point;
[0008] The wall surface image is segmented according to the modified segmentation threshold to obtain a modified segmented image, and quality detection is performed on the modified segmented image to obtain a detection result of the building construction quality.
[0009] In one embodiment, determining the extent to which each pixel point is in the dark area according to different segmented images includes:
[0010] Determine a first position and a first pixel at the first position from each of the segmented images, and determine the number of times the first pixel is segmented into a dark area;
[0011] Generate a sliding window with the first pixel as the center, determine a second pixel from the first pixel, determine the total number of window pixels in the sliding window of the second pixel and the number of target pixels added in the sliding window of the second pixel as the initial threshold increases;
[0012] Determine, according to the grayscale value of the second pixel, the number of times, the total number of pixels in the window, and the number of target pixels, the degree of the first pixel in the dark area, wherein the degree represents the possibility that the first pixel appears in the dark area;
[0013] Return to the step of determining the first position and the first pixel point at the first position from each of the segmented images until the degree of each pixel point in the dark area is obtained.
[0014] In one implementation, determining the extent to which the first pixel is in the dark area according to the grayscale value of the second pixel, the number of times, the total number of pixels in the window, and the number of target pixels includes:
[0015] Determine a first product of the number of times and the number of target pixels;
[0016] Determine a second product of the grayscale value of the second pixel, the number of the segmented images, and the total number of pixels in the window;
[0017] The degree to which the first pixel point is in the dark area is obtained according to the ratio of the first product to the second product.
[0018] In one embodiment, determining the consistency of the direction from the center of the dark pixel to the center of the bright pixel of each pixel in the different segmented images according to the different segmented images includes:
[0019] Performing threshold segmentation on the pixels in the sliding window based on different segmentation thresholds to obtain bright pixels and dark pixels in each sliding window;
[0020] Determine a grayscale difference parameter corresponding to each sliding window according to the bright pixel point and the dark pixel point;
[0021] Determine a third pixel point in the sliding window segmented by the minimum segmentation threshold from the first pixel points, and determine, according to the grayscale difference parameter, the degree of directional expression of the pixel points in the bright and dark areas of the sliding window where the third pixel point is located under the minimum segmentation threshold;
[0022] A segmentation threshold that is greater than the minimum segmentation threshold and adjacent to the minimum segmentation threshold is used as a new minimum segmentation threshold, and the step of determining the third pixel point in the sliding window segmented by the minimum segmentation threshold from the first pixel point is returned until the degree of directional expression of the pixel point in the bright and dark areas of the sliding window where the pixel point is located is determined under the corresponding segmentation threshold for each pixel point;
[0023] According to the degree of expression of each direction, the consistency of the direction from the center of the dark pixel to the center of the bright pixel expressed by each pixel in different segmented images is determined.
[0024] In one implementation, determining the grayscale difference parameter corresponding to each sliding window according to the bright pixel and the dark pixel includes:
[0025] Determine a first grayscale difference according to different bright pixel points of the sliding window;
[0026] Determining a second grayscale difference according to different dark pixel points of the sliding windows respectively;
[0027] determining third grayscale differences corresponding to different sliding windows according to absolute values of differences between the first grayscale difference and the second grayscale difference;
[0028] The grayscale difference parameters include the first grayscale difference, the second grayscale difference and the third grayscale difference.
[0029] In one implementation, the directional expression degree of the pixel points in the bright and dark areas of the sliding window where the third pixel point is located under the minimum segmentation threshold value determined according to the grayscale difference parameter includes:
[0030] Determine the sum of the reciprocal of the first grayscale difference and the reciprocal of the second grayscale difference in the sliding window corresponding to the minimum segmentation threshold;
[0031] According to the third product of the sum and the third grayscale difference corresponding to the sliding window of the minimum segmentation threshold, the directional expression degree of the pixel points in the bright and dark areas of the sliding window where the third pixel point is located under the minimum segmentation threshold is obtained.
[0032] In one embodiment, determining the consistency of the direction from the center of the dark pixel to the center of the bright pixel of each pixel in different segmented images according to the degree of expression of each direction includes:
[0033] The minimum segmentation threshold is used as the first threshold, and a segmentation threshold that is greater than the minimum segmentation threshold and adjacent to the minimum segmentation threshold is determined as the second threshold, and when determining the third pixel point, a fourth pixel point located in the sliding window segmented by the second threshold is determined from the first pixel points;
[0034] Determine a first direction vector from a bright point center of a bright pixel point corresponding to a third pixel point to a dark point center of a dark pixel point under a first threshold, and determine a second direction vector from a bright point center of a bright pixel point corresponding to a fourth pixel point to a dark point center of a dark pixel point under a second threshold, and calculate a direction change of the first direction vector and the second direction vector;
[0035] According to the directional expression degree of the third pixel point, the directional expression degree of the fourth pixel point and the directional change, the consistency of the direction from the center of the dark pixel point to the center of the bright pixel point expressed by each pixel point in different segmented images is determined.
[0036] In one embodiment, determining the consistency of the direction from the center of the dark pixel to the center of the bright pixel of each pixel in different segmented images according to the directional expression degree of the third pixel, the directional expression degree of the fourth pixel, and the directional change includes:
[0037] Using the second threshold as a new first threshold, returning to the step of determining a segmentation threshold that is greater than the minimum segmentation threshold and adjacent to the minimum segmentation threshold as the second threshold, until all the preset number of direction changes are determined;
[0038] Determine the reciprocal value of the sum of each directional change and the preset value, and calculate a fourth product of each reciprocal value and the directional expression degree of the fourth pixel point corresponding to each directional change;
[0039] Determine a sum according to the fourth product and the preset number, and determine an average value according to a ratio of the sum to the preset number;
[0040] Obtaining consistency of directions from the center of a dark pixel to the center of a bright pixel expressed by the third pixel in different segmented images according to a fifth product of the average value and the degree of directional expression of the third pixel;
[0041] The smallest segmentation threshold is re-determined from each segmentation threshold as the first threshold, the segmentation threshold that is greater than the first threshold and adjacent to the first threshold is used as the second threshold, the second threshold is used as the new first threshold to determine a new second threshold and a new third pixel point, and when determining the third pixel point, the fourth pixel point located in the sliding window segmented by the second threshold is determined from the first pixel points until the consistency of the direction from the center of the dark pixel point to the center of the bright pixel point shown by each pixel point in different segmented images is determined.
[0042] In one embodiment, the different initial thresholds are corrected according to the degree and the consistency of each pixel to obtain a corrected segmentation threshold for each pixel, including:
[0043] Obtaining a value of the degree of influence of the image background brightness on each pixel point according to the ratio of the consistency of each pixel point to the degree of each pixel point;
[0044] respectively determining the sixth product of the value of the degree of influence of the image background brightness on each pixel and each different initial threshold value;
[0045] The sixth product and the sum of the initial thresholds corresponding to the sixth product are calculated respectively to obtain a modified segmentation threshold for each pixel in different segmented images.
[0046] In one embodiment, segmenting the wall surface image according to the modified segmentation threshold to obtain a modified segmented image, and performing quality detection on the modified segmented image to obtain a detection result of the building construction quality includes:
[0047] By correcting the segmentation threshold of each pixel point in different segmented images, threshold segmentation is performed on the pixel points corresponding to different segmented images to obtain the segmentation results of each pixel point in different segmented images;
[0048] The segmentation results of each pixel in different segmentation images are superimposed to obtain a corrected segmentation image;
[0049] Determining the defect region area in the corrected segmented image and the image area of the corrected segmented image;
[0050] The inspection result of the building construction quality is determined according to the ratio of the defect region area to the image area.
[0051] In a second aspect, a construction quality inspection system is provided, the system comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of any of the aforementioned construction quality inspection methods when executing the computer program.
[0052] The present invention has the following beneficial effects:
[0053] By acquiring a wall image and segmenting the wall image through different initial thresholds, different corresponding segmented images are obtained. According to different segmented images, the degree of each pixel in the dark area and the consistency of the direction from the center of the dark pixel to the center of the bright pixel shown by each pixel in different segmented images are determined. According to the degree and consistency of each pixel, different initial thresholds are corrected to obtain a corrected segmentation threshold for each pixel. According to the corrected segmentation threshold, the wall image is segmented to obtain a corrected segmented image. The corrected segmentation threshold is determined by considering the influence of different light and shadow brightness levels, so that the segmented corrected segmented image is more accurate. Quality inspection is performed on the corrected segmented image to obtain the inspection result of the building construction quality, thereby improving the accuracy of the building construction quality inspection. BRIEF DESCRIPTION OF THE DRAWINGS
[0054] In order to more clearly illustrate the technical solutions and advantages in the embodiments of the present invention or the prior art, the drawings required for use in the embodiments or the prior art descriptions are briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0055] Figure 1 A schematic diagram of the steps of a construction quality inspection method provided by an embodiment of the present invention;
[0056] Figure 2 A schematic diagram of an original wall image provided by an embodiment of the present invention;
[0057] Figure 3 A schematic diagram of different segmented images provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0058] In order to further explain the technical means and effects adopted by the present invention to achieve the predetermined invention purpose, the following is a detailed description of a construction quality detection method and system proposed according to the present invention, its specific implementation method, structure, features and effects, in combination with the accompanying drawings and preferred embodiments. In the following description, different "one embodiment" or "another embodiment" does not necessarily refer to the same embodiment. In addition, specific features, structures or characteristics in one or more embodiments may be combined in any suitable form.
[0059] Unless defined otherwise, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this invention belongs.
[0060] It should be noted that the term “exemplary” in the embodiments of the present application refers to examples listed for the convenience of explanation, and other embodiments are not limited to the examples listed.
[0061] In the related art, in building construction, due to the poor quality, unevenness or unsuitability of specific types of coatings of the wall substrate (such as gypsum board, brick wall, etc.), the humidity of the wall environment, the use of coatings that are not suitable for wall materials or environmental conditions, and the lack of adhesion caused by the use of coatings that are not suitable for wall materials or environmental conditions, and the failure to properly prepare the wall surface during construction, the paint, gypsum or other coatings on the wall surface have different degrees of shedding, cracking, and peeling. When using global threshold segmentation to identify these defective areas, due to the large difference in the depth of pits in different wall areas, under the same lighting conditions, they may appear as different bright and dark areas, which may lead to the inability to identify all defective areas on the wall, and thus cause deviations in wall quality detection. Therefore, the embodiment of the present application provides a method for determining an adaptive threshold, that is, determining a modified segmentation threshold for each pixel point, to achieve image segmentation, to achieve recognition and extraction of wall defect areas, to prevent incomplete extraction of defective areas caused by global threshold segmentation, and to improve the efficiency of wall quality detection.
[0062] A specific scheme of a construction quality detection method provided by the present invention is described in detail below with reference to the accompanying drawings.
[0063] See also Figure 1 , which shows a flow chart of a construction quality detection method provided by an embodiment of the present invention. The construction quality detection method may at least include steps S100-S400:
[0064] S100, acquiring a wall image, and segmenting the wall image using different initial thresholds to obtain corresponding different segmented images.
[0065] like Figure 2 As shown in the figure, the wall image is obtained by the camera in the embodiment of the present application. In the embodiment of the present application, the wall image is segmented by setting different initial thresholds, so as to obtain the segmented image obtained after each initial threshold segmentation, so that several corresponding different segmented images can be obtained. Among them, after obtaining the wall image, pre-processing can be performed, such as graying, filtering and denoising, image enhancement, etc.; different initial threshold sizes and the number of initial thresholds can be adjusted based on actual conditions and are not specifically limited. Figure 3 As shown, for example, taking the initial thresholds 102, 119, 127, 130, 135, 140, 150, and 153 as examples, the corresponding different segmented images are Figure 3 (a), (b), (c), (d), (e), (f), (g), (h).
[0066] It should be noted that when detecting wall defects, due to the inconsistent depth of local defect areas, the use of global threshold segmentation may not be able to extract the complete wall defect area. Therefore, the threshold of the local defect area needs to be fine-tuned. In order to determine the threshold value for which the segmentation effect is optimal, it is necessary to analyze the changing characteristics of the segmentation results under different thresholds and calculate the optimal threshold for each pixel, that is, to correct the segmentation threshold.
[0067] S200, determining the extent of each pixel in the dark area and the consistency of the direction from the center of the dark pixel to the center of the bright pixel of each pixel in different segmented images according to different segmented images.
[0068] S300 , correcting different initial thresholds according to the degree and consistency of each pixel point to obtain a corrected segmentation threshold value for each pixel point.
[0069] S400, segmenting the wall surface image according to the modified segmentation threshold value to obtain a modified segmented image, and performing quality detection on the modified segmented image to obtain a detection result of the building construction quality.
[0070] The technical solution of the embodiment of the present application obtains a wall image and segments the wall image through different initial thresholds to obtain corresponding different segmented images, determines the degree of each pixel in the dark area and determines the consistency of the direction from the center of the dark pixel to the center of the bright pixel of each pixel in different segmented images according to the different segmented images, corrects the different initial thresholds according to the degree and consistency of each pixel to obtain a corrected segmentation threshold for each pixel, segments the wall image according to the corrected segmentation threshold to obtain a corrected segmented image, determines the corrected segmentation threshold by considering the influence of different light and shadow brightness levels, and makes the segmented corrected segmented image more accurate; performs quality inspection on the corrected segmented image to obtain the inspection result of the building construction quality, and improves the accuracy of the building construction quality inspection.
[0071] It should be noted that, according to the segmentation of the wall image under different initial thresholds, it is not difficult to see that it is difficult to accurately segment the target area we need with a single initial threshold. In addition, by comparing the segmented images segmented under different initial thresholds with the collected original images, it can be seen that the selection of the initial threshold for segmentation of each pixel in the image is greatly affected by the degree of light and shadow. When the gray value of a certain pixel is smaller, that is, the darker the pixel, and the grayscale difference between the defect area and the surrounding area is relatively large, the approximate location of the defect can be determined accordingly; when the gray value of the area where a certain pixel is located is larger, that is, the brighter the pixel, and the grayscale difference between the defect area and the surrounding area is smaller, the threshold selection is also larger. Therefore, by comparing the segmentation under each initial threshold, the number of times a pixel is located in the target area is also affected by the degree of light and shadow. When the gray value of the pixel is small and the light and shadow of the area around the pixel is brighter, the pixel always appears in the target area when the threshold segmentation is performed. Exemplarily, the dark area is used as the target area in the embodiment of the present application for explanation.
[0072] In one embodiment, the step S200 determines the degree of each pixel in the dark area according to different segmented images, including steps S201-S204:
[0073] S201 : determining a first position and a first pixel at the first position from each segmented image, and determining the number of times the first pixel is segmented into a dark area.
[0074] Optionally, the first position and the first pixel at the first position may be determined arbitrarily in each segmented image, for example, the first position with coordinates (X1, Y1) may be determined, thereby determining the first position and the first pixel at the first position in each segmented image. Since there are only two types of areas, dark areas and bright areas, the number of times these first pixels are segmented into dark areas is determined. For example, if there are 10 segmented images, 6 of the first pixels at the first position are segmented as dark areas, then is 6.
[0075] S202, generating a sliding window with the first pixel as the center, determining a second pixel from the first pixel, determining the total number of window pixels in the sliding window of the second pixel, and the number of target pixels added in the sliding window of the second pixel as the initial threshold increases.
[0076] It should be noted that the size of the sliding window is not specifically limited, and the length and width are For example, one pixel is then selected from each of the first pixels as the second pixel, for example, the first pixel in the segmented image segmented by the minimum initial threshold is used as the second pixel, and then the total number of window pixels in the sliding window of the second pixel is determined (denoted as Indicates that, for example, there are 10 sliding windows, the total number of window pixels is the sum of the number of pixels in the 10 sliding windows) and the number of target pixels added in the sliding window of the second pixel as the initial threshold increases For example, the initial thresholds are 119, 127, and 130, and the number of pixels in the sliding window in the segmented image corresponding to 119, 127, and 130 are 8, 11, and 19, respectively. The increased number of target pixels is 3+8=11. Based on this principle, we can calculate the increase in the number of pixels based on all segmented images as the initial threshold increases, and thus obtain the target pixel number. .
[0077] S203: Determine the extent to which the first pixel is in the dark area according to the grayscale value of the second pixel, the number of times, the total number of pixel points in the window, and the number of target pixel points.
[0078] It should be noted that the degree represents the possibility that the first pixel point appears in the dark area, and determining the degree of the first pixel point in the dark area may include the following steps:
[0079] First, determine the number of The number of target pixels The first product of .
[0080] Secondly, determine the gray value of the second pixel , the number of segmented images And the total number of window pixels The second product of .
[0081] Furthermore, according to the ratio of the first product to the second product, the degree of the first pixel point in the dark area is obtained. The specific formula is:
[0082]
[0083] in, For the The probability that a pixel appears in the dark area, assuming that When it is 1, it corresponds to the first pixel. For the The number of times a pixel is segmented into dark areas, The number of times the wall image is segmented, that is, the number of segmented images. The default setting is , For the The number of pixels selected as dark areas in the sliding window of pixels increases with the increase of the initial threshold, that is, the number of target pixels. Indicates The grayscale value of a pixel, in some implementations, Can be , used to prevent the denominator from being 0.
[0084] S204 , returning to the step of determining the first position and the first pixel point at the first position from each segmented image, until the extent of each pixel point in the dark area is obtained.
[0085] It should be noted that the step of determining the first position and the first pixel point at the first position from each segmented image is returned, that is, returning to step S201, until the degree of each pixel point in the dark area is obtained, that is, When taking different values, Represents the degree to which each pixel is in the dark area.
[0086] It should be noted that the embodiment of the present application segments (clusters) the pixel points in the sliding window corresponding to a pixel point, determines the centers of the light and dark areas respectively, thereby obtaining the directional relationship from the center of the bright area to the center of the dark area, and determines the degree of directional expression of the pixel points in the light and dark areas of the sliding window corresponding to a certain pixel point; then, under multiple segmentation thresholds, the greater the degree of directional expression of the pixel points in the light and dark areas, the more consistent the directions of the points, and the higher the consistency of the direction of the pixel point changes under multiple segmentation thresholds, the greater the possibility.
[0087] In one embodiment, in step S200, according to different segmented images, determining the consistency of the direction from the center of the dark pixel to the center of the bright pixel of each pixel in different segmented images includes steps S205-S209:
[0088] S205 , performing threshold segmentation on the pixels in the sliding window based on different segmentation thresholds to obtain bright pixels and dark pixels in each sliding window.
[0089] Optionally, set different segmentation thresholds to , , , …, , …, , , is an integer, Based on the number of sliding windows, It is set based on the need, exemplarily 5; therefore, Perform threshold segmentation on the sliding window of the first segmented image, Threshold segmentation is performed on the sliding window of the second segmented image, and so on, to obtain the segmentation result in each sliding window, which includes bright pixels and dark pixels.
[0090] S206: Determine a grayscale difference parameter corresponding to each sliding window according to the bright pixel points and the dark pixel points.
[0091] In one implementation, the grayscale difference parameter includes a first grayscale difference, a second grayscale difference, and a third grayscale difference, and the specific determination steps are:
[0092] First, determine the first grayscale difference according to the bright pixels of different sliding windows. , which represents the segmentation threshold The grayscale difference is calculated by averaging the grayscale differences between the bright pixels to obtain the first grayscale difference. .
[0093] Secondly, the second grayscale difference is determined according to the dark pixels of different sliding windows. , which represents the segmentation threshold Similarly, calculate the grayscale difference between each dark pixel, and then take the average value to get the second grayscale difference .
[0094] Furthermore, the third grayscale difference (also called inter-class grayscale difference) corresponding to different sliding windows is determined according to the absolute value of the difference between the first grayscale difference and the second grayscale difference, that is, the segmentation threshold is determined as The third grayscale difference corresponding to .
[0095] S207, determining a third pixel point located in the sliding window segmented by the minimum segmentation threshold from the first pixel point; and determining, according to the grayscale difference parameter, the degree of directional expression of the pixel points in the bright and dark areas of the sliding window where the third pixel point is located under the minimum segmentation threshold.
[0096] Optionally, a third pixel point of the sliding window segmented by the minimum segmentation threshold is determined from the first pixel point, that is, the segmentation threshold is (at this time =0) as the first pixel point in the sliding window as the third pixel point. Then, perform the following steps:
[0097] First, determine the inverse of the first grayscale difference in the sliding window of the minimum segmentation threshold The reciprocal of the corresponding second grayscale difference The sum of ;
[0098] Then, according to the sum The third grayscale difference corresponding to the sliding window of the minimum segmentation threshold The third product of , gets the degree of directional expression of the pixels in the bright and dark areas of the sliding window where the third pixel is located under the minimum segmentation threshold. , the formula is:
[0099]
[0100] in, The segmentation threshold is Time The degree of direction expression of the pixels in the bright and dark areas of the sliding window where the pixels are located. When it is 0, it represents the degree of directional expression corresponding to the third pixel point at this time; it should be noted that, in some embodiments, in order to prevent the denominator from being 0, +0.01 can be added to each denominator of the above formula.
[0101] S208. Use a segmentation threshold that is greater than the minimum segmentation threshold and adjacent to the minimum segmentation threshold as a new minimum segmentation threshold, and return to the step of determining the third pixel point in the sliding window segmented by the minimum segmentation threshold from the first pixel point, until the degree of directional expression of the pixel points in the bright and dark areas of the sliding window where the pixel point is located is determined under the corresponding segmentation threshold.
[0102] Optionally, a segmentation threshold that is greater than the minimum segmentation threshold and adjacent to the minimum segmentation threshold is used as the new minimum segmentation threshold, that is, =0 becomes =1, then the new minimum segmentation threshold is ( =1), then return to the step of determining the third pixel point in the sliding window segmented by the minimum segmentation threshold from the first pixel point, select a new third pixel point and repeat the above steps, so that the degree of directional performance of the pixel point in the bright and dark area of the sliding window where the pixel point is located can be finally determined under the corresponding segmentation threshold. , that is, when , Different values represent the degree of direction expression corresponding to different pixel points.
[0103] S209: Determine the consistency of the direction from the center of the dark pixel to the center of the bright pixel expressed by each pixel in different segmented images according to the expression degree in each direction.
[0104] First, the minimum segmentation threshold is used as the first threshold, that is, ( = 0), and determine the segmentation threshold that is greater than the minimum segmentation threshold and adjacent to the minimum segmentation threshold as the second threshold, i.e. ( =1), and when determining the third pixel point, determine a fourth pixel point located in the sliding window segmented by the second threshold from the first pixel point.
[0105] Secondly, determine the first direction vector from the bright point center of the bright pixel point corresponding to the third pixel point to the dark point center of the dark pixel point under the first threshold value , and determining the second direction vector from the bright point center of the bright pixel point corresponding to the fourth pixel point to the dark point center of the dark pixel point under the second threshold , and calculate the direction change of the first direction vector and the second direction vector .
[0106] Furthermore, according to the directional expression degree of the third pixel point, the directional expression degree of the fourth pixel point and the directional change, the consistency of the direction from the dark pixel center to the bright pixel center of each pixel point in different segmented images is determined.
[0107] Specifically, the steps include:
[0108] 1. Take the second threshold as the new first threshold, return to the step of determining the segmentation threshold that is greater than the minimum segmentation threshold and adjacent to the minimum segmentation threshold as the second threshold, that is, ( =1) as a new ( =1), then the new first threshold and the new second threshold are ( =1)、 ( =2), and continue to obtain new direction changes based on the above principle until all preset number of direction changes are obtained, illustratively taking the preset number of 10 as an example.
[0109] 2. For example, the preset value is 1, and the change in each direction is determined separately. The reciprocal value of the sum of the preset value (at this time , Different values are possible. for +1), and calculate the fourth product of each reciprocal value and the directional expression degree of the fourth pixel point corresponding to each directional change .
[0110] 3. Determine the sum based on the fourth product and the preset number , and determine the average value based on the ratio of the sum to the preset number .
[0111] 4. According to the fifth product of the average value and the degree of directional expression of the third pixel, the consistency of the direction from the center of the dark pixel to the center of the bright pixel expressed by the third pixel in different segmented images is obtained. The formula is:
[0112]
[0113] in, For the The consistency of the direction from the center of the dark pixel to the center of the bright pixel in the segmentation result of the corresponding segmentation threshold can also indirectly represent the first The consistency of the direction from the center of the dark pixel to the center of the bright pixel in different segmented images. When it is 1, it indicates the consistency of the correspondence of the third pixel.
[0114] 5. Re-determine the smallest segmentation threshold from each segmentation threshold as the first threshold, and use the segmentation threshold that is greater than the first threshold and adjacent to the first threshold as the second threshold. Use the second threshold as the new first threshold to determine the new second threshold and the new third pixel point. Return to the fourth pixel point located in the sliding window segmented by the second threshold from the first pixel point when determining the third pixel point. That is, determine the consistency corresponding to the new third pixel point based on the above principle until the consistency of the direction from the center of the dark pixel point to the center of the bright pixel point shown by each pixel point in different segmented images is determined, that is, When the values are different, the consistency of the direction from the center of the dark pixel to the center of the bright pixel shown by different pixels in different segmented images .
[0115] From the above analysis, we can know that the threshold selection for segmentation of a certain pixel point in the image is inversely proportional to the degree to which the pixel point appears in the dark area, that is, the deeper the pixel point is in the dark area, the smaller the threshold; the threshold selection is consistent with the change in the direction from the bright spot center to the dark spot center of the sliding window where a certain pixel point of the image is located, that is, the higher the consistency of the direction from the bright spot center to the dark spot center of the window where the pixel point is located, the smaller the threshold selection.
[0116] It should be noted that when detecting wall defects, due to the inconsistent depth of local defect areas, the use of global threshold segmentation may not be able to extract the complete wall defect area. Therefore, the threshold of the local defect area needs to be fine-tuned. In order to determine the threshold value for which the segmentation effect is optimal, it is necessary to analyze the changing characteristics of the threshold segmentation results under different thresholds and calculate the optimal corrected segmentation threshold for each pixel.
[0117] In one implementation, step S300 includes steps S301-S303:
[0118] S301. Obtain the value of the degree of influence of the image background brightness on each pixel point according to the ratio of the consistency of each pixel point to the degree of each pixel point.
[0119] Optionally, based on the consistency of each pixel The degree of each pixel The ratio of the image background brightness to obtain the influence of each pixel (No. The degree to which each pixel is affected by the brightness of the image background) .
[0120] S302: Determine the sixth product of the value of the degree of influence of the image background brightness on each pixel and each different initial threshold value.
[0121] S303 , respectively calculating the sixth product and the sum of the initial thresholds corresponding to the sixth product, to obtain a modified segmentation threshold for each pixel in different segmented images.
[0122] Optionally, determine the degree to which each pixel is affected by the brightness of the image background. With different initial thresholds The sixth product of , respectively calculate the sixth product and the sum of the initial thresholds corresponding to the sixth product, and obtain the modified segmentation threshold for each pixel in different segmented images. The formula is:
[0123]
[0124] in, For the The initial threshold corresponding to the segmented image where the pixel point is located, For the The corrected segmentation threshold of each pixel point is obtained in the end.
[0125] It should be noted that based on the characteristics that the deeper the pixel in the image is in the dark area, the smaller the threshold used for segmentation, and the higher the consistency of the direction from the bright spot center to the dark spot center of the sliding window where the pixel is located, the smaller the threshold is selected, the optimal corrected segmentation threshold of the pixel is corrected, avoiding the disadvantage of incomplete extraction of wall defect areas due to global threshold segmentation, and improving the accuracy of identifying wall defects.
[0126] In one implementation, step S400 includes steps S401-S404:
[0127] S401 , performing threshold segmentation on the pixels corresponding to different segmented images by correcting the segmentation threshold of each pixel in different segmented images, and obtaining the segmentation results of each pixel in different segmented images.
[0128] S402 , superimposing the segmentation results of each pixel point in different segmented images to obtain a modified segmented image.
[0129] Optionally, a modified segmentation threshold value for each pixel in the segmented image is used. , threshold segmentation is performed on the pixel points corresponding to different segmented images to obtain the segmentation results of each pixel point in different segmented images, and then the segmentation results of each pixel point in different segmented images are superimposed to obtain the final corrected segmented image.
[0130] S403: Determine the defect region area in the corrected segmented image and the image area of the corrected segmented image.
[0131] Optionally, determine the defect area in the corrected segmented image And correct the image area of the segmented image Among them, the method of determining the area is an existing method and will not be repeated here.
[0132] S404: Determine the inspection result of the building construction quality according to the ratio of the defect area to the image area.
[0133] Optionally, the test results of the building construction quality The formula is:
[0134]
[0135] In the formula, Indicates the proportion of defective areas. The larger the proportion, the worse the wall quality, and vice versa. is a natural exponential function.
[0136] The method of the embodiment of the present application can perform threshold adaptation on each pixel point according to the degree to which each pixel point in the wall image is affected by light and shadow, and determine a targeted modified segmentation threshold value by utilizing the fact that the grayscale value change of each pixel point is affected by the different depths of the defective area, as well as the law of changes in the pixels around each pixel point in the segmentation result as the segmentation threshold changes, thereby achieving accurate extraction of the defective area on the wall, identifying the defective areas of different depths of the wall and their details as accurately as possible, and the detection effect of the defective area on the wall is better than that of the related technology using global threshold segmentation, which improves the shortcoming that the global threshold extraction cannot completely extract the defective area, and is beneficial to providing a reference for the acceptance and maintenance of the building construction situation.
[0137] The present invention also provides a construction quality inspection system, which includes a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, the steps of the aforementioned construction quality inspection method are implemented.
[0138] It should be noted that the sequence of the above embodiments of the present invention is only for description and does not represent the advantages and disadvantages of the embodiments. The processes depicted in the accompanying drawings do not necessarily require the specific order or continuous order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.
[0139] The various embodiments in this specification are described in a progressive manner, and the same or similar parts between the various embodiments can be referenced to each other, and each embodiment focuses on the differences from other embodiments.
Claims
1. A method for detecting construction quality, characterized in that: The method comprises: Acquire a wall image, and segment the wall image using different initial thresholds to obtain corresponding different segmented images; Determining, according to the different segmented images, the extent to which each pixel point is in the dark area and determining the consistency of the direction from the center of the dark pixel point to the center of the bright pixel point shown by each pixel point in the different segmented images; According to the degree and the consistency of each pixel point, the different initial thresholds are corrected to obtain a corrected segmentation threshold value for each pixel point; Segmenting the wall surface image according to the modified segmentation threshold to obtain a modified segmented image, and performing quality detection on the modified segmented image to obtain a detection result of the building construction quality; The step of segmenting the wall surface image according to the modified segmentation threshold to obtain a modified segmented image, and performing quality detection on the modified segmented image to obtain a detection result of the building construction quality includes: By correcting the segmentation threshold of each pixel point in different segmented images, threshold segmentation is performed on the pixel points corresponding to different segmented images to obtain the segmentation results of each pixel point in different segmented images; The segmentation results of each pixel in different segmentation images are superimposed to obtain a corrected segmentation image; Determining the defect region area in the corrected segmented image and the image area of the corrected segmented image; The inspection result of the building construction quality is determined according to the ratio of the defect region area to the image area.
2. The construction quality detection method according to claim 1, characterized in that: Determining the extent of each pixel in the dark area according to different segmented images includes: Determine a first position and a first pixel at the first position from each of the segmented images, and determine the number of times the first pixel is segmented into a dark area; Generate a sliding window with the first pixel as the center, determine a second pixel from the first pixel, determine the total number of window pixels in the sliding window of the second pixel and the number of target pixels added in the sliding window of the second pixel as the initial threshold increases; Determine, according to the grayscale value of the second pixel, the number of times, the total number of pixels in the window, and the number of target pixels, the degree of the first pixel in the dark area, wherein the degree represents the possibility that the first pixel appears in the dark area; Return to the step of determining the first position and the first pixel point at the first position from each of the segmented images until the degree of each pixel point in the dark area is obtained.
3. The construction quality detection method according to claim 2 is characterized in that: The determining, according to the gray value of the second pixel, the number of times, the total number of pixels in the window, and the number of target pixels, the degree to which the first pixel is in the dark area comprises: Determine a first product of the number of times and the number of target pixels; Determine a second product of the grayscale value of the second pixel, the number of the segmented images, and the total number of pixels in the window; The degree to which the first pixel point is in the dark area is obtained according to the ratio of the first product to the second product.
4. The construction quality detection method according to any one of claims 2-3, characterized in that: Determining the consistency of the direction from the center of the dark pixel to the center of the bright pixel of each pixel in the different segmented images according to the different segmented images includes: Performing threshold segmentation on the pixels in the sliding window based on different segmentation thresholds to obtain bright pixels and dark pixels in each sliding window; Determine a grayscale difference parameter corresponding to each sliding window according to the bright pixel point and the dark pixel point; Determine a third pixel point in the sliding window segmented by the minimum segmentation threshold from the first pixel points, and determine, according to the grayscale difference parameter, the degree of directional expression of the pixel points in the bright and dark areas of the sliding window where the third pixel point is located under the minimum segmentation threshold; A segmentation threshold that is greater than the minimum segmentation threshold and adjacent to the minimum segmentation threshold is used as a new minimum segmentation threshold, and the step of determining the third pixel point in the sliding window segmented by the minimum segmentation threshold from the first pixel point is returned until the degree of directional expression of the pixel point in the bright and dark areas of the sliding window where the pixel point is located is determined under the corresponding segmentation threshold for each pixel point; According to the degree of expression of each direction, the consistency of the direction from the center of the dark pixel to the center of the bright pixel expressed by each pixel in different segmented images is determined.
5. The construction quality detection method according to claim 4 is characterized in that: The determining, according to the bright pixel points and the dark pixel points, a grayscale difference parameter corresponding to each sliding window comprises: Determine a first grayscale difference according to different bright pixel points of the sliding window; Determining a second grayscale difference according to different dark pixel points of the sliding windows respectively; determining third grayscale differences corresponding to different sliding windows according to absolute values of differences between the first grayscale difference and the second grayscale difference; The grayscale difference parameters include the first grayscale difference, the second grayscale difference and the third grayscale difference.
6. The construction quality detection method according to claim 5 is characterized in that: The degree of directional expression of the pixel points in the bright and dark areas of the sliding window where the third pixel point is located under the minimum segmentation threshold determined according to the grayscale difference parameter includes: Determine the sum of the reciprocal of the first grayscale difference and the reciprocal of the second grayscale difference in the sliding window corresponding to the minimum segmentation threshold; According to the third product of the sum and the third grayscale difference corresponding to the sliding window of the minimum segmentation threshold, the directional expression degree of the pixel points in the bright and dark areas of the sliding window where the third pixel point is located under the minimum segmentation threshold is obtained.
7. The construction quality detection method according to claim 4 is characterized in that: Determining the consistency of the direction from the center of the dark pixel to the center of the bright pixel of each pixel in different segmented images according to the degree of expression of each direction includes: The minimum segmentation threshold is used as the first threshold, and a segmentation threshold that is greater than the minimum segmentation threshold and adjacent to the minimum segmentation threshold is determined as the second threshold, and when determining the third pixel point, a fourth pixel point located in the sliding window segmented by the second threshold is determined from the first pixel points; Determine a first direction vector from a bright point center of a bright pixel point corresponding to a third pixel point to a dark point center of a dark pixel point under a first threshold, and determine a second direction vector from a bright point center of a bright pixel point corresponding to a fourth pixel point to a dark point center of a dark pixel point under a second threshold, and calculate a direction change of the first direction vector and the second direction vector; According to the directional expression degree of the third pixel point, the directional expression degree of the fourth pixel point and the directional change, the consistency of the direction from the center of the dark pixel point to the center of the bright pixel point expressed by each pixel point in different segmented images is determined.
8. The construction quality detection method according to claim 7 is characterized by: Determining the consistency of the direction from the center of the dark pixel to the center of the bright pixel of each pixel in different segmented images according to the direction expression degree of the third pixel, the direction expression degree of the fourth pixel and the direction change includes: Using the second threshold as a new first threshold, returning to the step of determining a segmentation threshold that is greater than the minimum segmentation threshold and adjacent to the minimum segmentation threshold as the second threshold, until all the preset number of direction changes are determined; Determine the reciprocal value of the sum of each directional change and the preset value, and calculate a fourth product of each reciprocal value and the directional expression degree of the fourth pixel point corresponding to each directional change; Determine a sum according to the fourth product and the preset number, and determine an average value according to a ratio of the sum to the preset number; Obtaining consistency of directions from the center of a dark pixel to the center of a bright pixel expressed by the third pixel in different segmented images according to a fifth product of the average value and the degree of directional expression of the third pixel; The smallest segmentation threshold is re-determined from each segmentation threshold as the first threshold, the segmentation threshold that is greater than the first threshold and adjacent to the first threshold is used as the second threshold, the second threshold is used as the new first threshold to determine a new second threshold and a new third pixel point, and when determining the third pixel point, the fourth pixel point located in the sliding window segmented by the second threshold is determined from the first pixel points until the consistency of the direction from the center of the dark pixel point to the center of the bright pixel point shown by each pixel point in different segmented images is determined.
9. The construction quality detection method according to claim 1, characterized in that: The modifying of different initial thresholds according to the degree and consistency of each pixel to obtain a modified segmentation threshold for each pixel includes: Obtaining a value of the degree of influence of the image background brightness on each pixel point according to the ratio of the consistency of each pixel point to the degree of each pixel point; respectively determining the sixth product of the value of the degree of influence of the image background brightness on each pixel and each different initial threshold value; The sixth product and the sum of the initial thresholds corresponding to the sixth product are calculated respectively to obtain a modified segmentation threshold for each pixel in different segmented images.
10. A construction quality inspection system, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 9 are implemented.
Citation Information
Patent Citations
Plastic product surface defect detection method
CN115311270A
Defect detection method for groove MOS (Metal Oxide Semiconductor) device
CN115578389A