Image processing-based method for detecting quality of building welded steel structure
By using adaptive threshold segmentation technology, the threshold is adjusted according to the edge roughness and pixel gray value variance of the welded steel structure image, which solves the problem of low detection accuracy of welded steel structures in the existing technology and achieves higher detection accuracy and efficiency.
Patent Information
- Application Number
- CN202511134230.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-08-14
- Publication Date
- 2025-11-18
- Estimated Expiration
- 2045-08-14
AI Technical Summary
In existing methods, a single threshold cannot effectively segment all welding cracks in welded steel structure images, resulting in low accuracy of quality detection, which is affected by factors such as lighting and surface texture of welding cracks.
By performing threshold segmentation on the welded steel structure image, the threshold adjustment requirement of each connected component is determined based on the edge roughness and pixel gray value variance. Adaptive threshold adjustment is then performed on the connected components that need adjustment to achieve adaptive threshold segmentation and preserve the welded crack portion.
It improves the accuracy of welded steel structure quality inspection, enabling more accurate identification of weld cracks, reducing the subjectivity of manual inspection, and improving inspection efficiency and accuracy.
Smart Images

Figure CN120655640B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of image processing, and particularly relates to a building welded steel structure quality detection method based on image processing. BACKGROUND
[0002] As an important part of modern building engineering, the quality of welded steel structure is directly related to the structural safety and reliability of the entire building. Therefore, rigorous and comprehensive quality detection of welded steel structure is not only the key step to ensure the quality of building engineering, but also the necessary measure to prevent potential safety hazards and protect people's life and property safety.
[0003] In the existing method, image analysis is performed by machine vision, edge detection and threshold segmentation are performed on the welded steel structure image, so as to realize the quality detection of the welded steel structure.
[0004] However, due to the influence of multiple factors such as light and surface texture of welding cracks, the single threshold value in the existing method cannot segment all the welding cracks in the welded steel structure image, thereby resulting in low accuracy of quality detection. SUMMARY
[0005] The building welded steel structure quality detection method based on image processing provided by the embodiments of the present application can improve the quality detection accuracy of the welded steel structure.
[0006] In a first aspect, the building welded steel structure quality detection method based on image processing comprises:
[0007] obtaining a welded steel structure image of a target welded steel structure;
[0008] performing threshold segmentation on the welded steel structure image to obtain an initial binary image corresponding to the welded steel structure image;
[0009] determining threshold adjustment requirement degrees of each connected domain in the welded steel structure image according to the edge roughness and pixel gray value variance of the welded steel structure image;
[0010] performing threshold adjustment on each connected domain with a threshold adjustment requirement degree greater than a preset requirement degree threshold to obtain a final binary image corresponding to the welded steel structure image;
[0011] obtaining a quality detection result of the target welded steel structure according to the final binary image.
[0012] The method for detecting the quality of the building welded steel structure based on image processing provided by the embodiment of the present application comprises the following steps: firstly, carrying out threshold segmentation on the welded steel structure image of the target welded steel structure to obtain an initial binary image corresponding to the welded steel structure image; then, determining the threshold adjustment requirement degree of each connected domain in the welded steel structure image according to the edge roughness and the pixel gray value variance of the welded steel structure image; finally, carrying out threshold adjustment on the connected domain which needs to be adjusted according to the threshold adjustment requirement degree, so as to obtain a final binary image corresponding to the welded steel structure image. In this way, the connected domain which needs to be adjusted is determined according to the edge change in different connected domains, so that the adaptive threshold segmentation of different connected domains in the welded steel structure image is realized, the welded crack part can be reserved as much as possible, and the quality detection accuracy of the welded steel structure is improved. BRIEF DESCRIPTION OF DRAWINGS
[0013] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the prior art and the advantages thereof, the drawings needed to be used in the embodiments or the prior art description will be briefly introduced. Obviously, the drawings in the following description are only some embodiments of the present application, and other drawings can be obtained by those skilled in the art without creative effort on the basis of these drawings.
[0014] Figure 1 The flowchart of the first method for detecting the quality of the building welded steel structure based on image processing provided by an embodiment of the present application is shown in the figure.
[0015] Figure 2 The schematic diagram of the welded steel structure image provided by an embodiment of the present application is shown in the figure.
[0016] Figure 3 The schematic diagram of the final binary image corresponding to the welded steel structure image provided by an embodiment of the present application is shown in the figure.
[0017] Figure 4 The flowchart of the second method for detecting the quality of the building welded steel structure based on image processing provided by an embodiment of the present application is shown in the figure.
[0018] Figure 5 The flowchart of the third method for detecting the quality of the building welded steel structure based on image processing provided by an embodiment of the present application is shown in the figure. DETAILED DESCRIPTION
[0019] In order to further clarify the technical means and effects taken by the present application to achieve the predetermined object of the application, the specific implementation, structure, features and effects of the image processing-based building welded steel structure quality detection method according to the present application are described in detail below in combination with the drawings and preferred embodiments. In the following description, different "one embodiment" or "another embodiment" do not necessarily refer to the same embodiment. In addition, the specific features, structures or characteristics in one or more embodiments can be combined in any suitable form.
[0020] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which the present application belongs.
[0021] It should be noted that the acquisition, storage, use, processing, etc. of data in the technical solution of the present application comply with the relevant provisions of laws and regulations.
[0022] It should be noted that in the embodiments of the present application, some existing industry solutions such as software, components, models, etc. may be mentioned, which should be considered as exemplary, and the purpose is only to illustrate the feasibility in the implementation of the technical solution of the present application, but it does not mean that the applicant has or will necessarily use the solution.
[0023] In the existing method, image analysis is performed using machine vision, edge detection and threshold segmentation are performed on the welded steel structure image, so as to realize quality detection of the welded steel structure. However, due to the influence of multiple factors such as light and surface texture of the welding crack, the single threshold value in the existing method cannot segment all the welding cracks in the welded steel structure image, thereby resulting in low accuracy of quality detection.
[0024] The present application aims to provide an image processing-based building welded steel structure quality detection method. In the image processing-based building welded steel structure quality detection method provided in the embodiments of the present application, the threshold segmentation is first performed on the welded steel structure image of the target welded steel structure to obtain an initial binary image corresponding to the welded steel structure image. Then, the threshold adjustment requirement degree of each connected domain in the welded steel structure image is determined according to the edge roughness and pixel gray value variance of the welded steel structure image. Finally, threshold adjustment is performed on the connected domain requiring threshold adjustment according to the threshold adjustment requirement degree, so as to obtain a final binary image corresponding to the welded steel structure image. In this way, the present application determines the connected domain requiring threshold adjustment according to the edge change in different connected domains. Thus, adaptive threshold segmentation of different connected domains in the welded steel structure image is realized, which can retain the welding crack part as much as possible, thereby improving the quality detection accuracy of the welded steel structure.
[0025] The specific embodiments of the image processing-based building welded steel structure quality detection method provided in the embodiments of the present application are described below.
[0026] Figure 1 A flowchart of an image processing-based building welded steel structure quality detection method is provided. The image processing-based building welded steel structure quality detection method can be applied to a server. The image processing-based building welded steel structure quality detection method can include the following S101 to S105.
[0027] S101, a welded steel structure image of a target welded steel structure is acquired.
[0028] In this embodiment, the welded steel structure image is acquired by an image acquisition device. For example, the image acquisition device can be a high-resolution camera or a camera.
[0029] As an example, a high-resolution camera is installed at an upper position of the welded steel structure. The server uses the high-resolution camera to take a picture of the welded steel structure to obtain a captured image. Then, the captured image is subjected to grayscale processing to obtain the welded steel structure image of the target welded steel structure. As shown in Figure 2 , a schematic diagram of a welded steel structure image is provided.
[0030] S102, threshold segmentation is performed on the welded steel structure image to obtain an initial binary image corresponding to the welded steel structure image.
[0031] In this embodiment, threshold segmentation is used to represent a method of dividing an image into multiple regions according to the pixel grayscale amplitude of the image.
[0032] As an example, the server uses a threshold segmentation algorithm (for example, an OTSU threshold segmentation algorithm) to obtain a suitable global threshold. Then, the welded steel structure image is converted into a binary image containing only black and white colors according to the global threshold. The white region of the binary image represents the welding position, and the black region of the binary image represents the background region.
[0033] S103, the threshold adjustment requirement degree of each connected domain in the welded steel structure image is determined according to the edge roughness and the pixel grayscale value variance of the welded steel structure image.
[0034] In this embodiment, a connected domain refers to an image region composed of pixel points with the same pixel value and adjacent positions in the welded steel structure image. For example, an edge detection algorithm can be used to perform edge detection on the welded steel structure image, thereby dividing the welded steel structure image into multiple connected domains.
[0035] The threshold adjustment requirement degree is used to represent the degree of necessity of adjusting the threshold of the connected domain. The greater the threshold adjustment requirement degree, the more the threshold of the connected domain should be adjusted.
[0036] As an example, the server first uses a statistical function to count the edge roughness of each connected domain. The greater the edge roughness, the more uneven the connected domain, that is, the greater the possibility of the existence of welding cracks in the connected domain, and the greater the threshold adjustment requirement of the connected domain.
[0037] Then, the server uses a statistical function to count the variance of the pixel gray value in each connected domain. The greater the variance, the more texture the connected domain contains, and the lower the threshold adjustment requirement of the connected domain.
[0038] Finally, the server assigns a threshold adjustment requirement value to each connected domain according to the edge roughness and the variance of the pixel gray value corresponding to each connected domain.
[0039] S104, threshold adjustment is performed on each connected domain with a threshold adjustment requirement greater than a preset requirement threshold to obtain a final binary image corresponding to the welded steel structure image.
[0040] In this embodiment, the server first sets a preset requirement threshold, for example, 0.7. Then, for the connected domain with a threshold adjustment requirement greater than 0.7, a local adaptive threshold method (for example, a local OTSU threshold method) is used to perform threshold adjustment to more accurately segment the welding part, thereby obtaining a final binary image corresponding to the welded steel structure image. As shown in FIG. 8, a final binary image corresponding to the welded steel structure image is provided. Figure 3
[0041] S105, a quality detection result of the target welded steel structure is obtained according to the final binary image.
[0042] In this embodiment, the server counts the area and shape of the welding part according to the final binary image. Then, the area and shape of the welding part are compared with the preset quality standard to obtain the quality detection result (for example, quality qualified or quality unqualified).
[0043] In the building welded steel structure quality detection method based on image processing provided in this embodiment, the welded steel structure image of the target welded steel structure is first threshold segmented to obtain an initial binary image corresponding to the welded steel structure image. Then, the threshold adjustment requirement of each connected domain in the welded steel structure image is determined according to the edge roughness and the pixel gray value variance of the welded steel structure image. Finally, the threshold of the connected domain requiring threshold adjustment is adjusted to obtain a final binary image corresponding to the welded steel structure image. In this way, the present application determines the connected domain requiring threshold adjustment according to the edge change in different connected domains. Thus, adaptive threshold segmentation of different connected domains in the welded steel structure image is realized, which can retain the welding crack part as much as possible, thereby improving the quality detection accuracy of the welded steel structure.
[0044] As an optional embodiment, as shown in Figure 4 S102 can specifically include the following S401-S403:
[0045] S401, obtaining a gray histogram of the welded steel structure image;
[0046] S402, determining an image threshold of the welded steel structure image according to the gray histogram;
[0047] S403, marking the welded steel structure image according to the image threshold to obtain an initial binary image corresponding to the welded steel structure image.
[0048] In this embodiment, the gray histogram is used to represent the number of pixels with various gray levels in the welded steel structure image, reflecting the appearance frequency of various gray levels in the welded steel structure image.
[0049] As an example, the server uses an image processing library (for example, OpenCV) to read and process the welded steel structure image, and then uses the gray histogram algorithm in OpenCV (for example, the cv2.calcHist() function or the numpy.histogram() function) to calculate the gray histogram of the welded steel structure image.
[0050] Then, the gray histogram is analyzed to find possible bimodal. If the gray histogram presents bimodal distribution, the minimum value between the two peaks is determined as the image threshold of the welded steel structure image; if the gray histogram does not present bimodal distribution, the threshold segmentation algorithm (for example, OTSU threshold segmentation algorithm) is used to determine the image threshold of the welded steel structure image.
[0051] Finally, the welded steel structure image is processed according to the image threshold of the welded steel structure image. The pixel points with a gray value greater than or equal to the image threshold are marked as white (or foreground), and the pixel points with a gray value less than the image threshold are marked as black (or background), so as to obtain the initial binary image corresponding to the welded steel structure image.
[0052] Through this embodiment, the gray histogram of the welded steel structure image is obtained, and the image threshold is determined according to the gray histogram, and then the welded steel structure image is marked to obtain the initial binary image. It can provide important guarantee for the subsequent accurate identification of the welding position and the quality detection of the welded steel structure, and improve the quality detection accuracy of the welded steel structure.
[0053] As an optional embodiment, S402 can specifically include:
[0054] normalizing the gray histogram to obtain the pixel probability of each gray level in the gray histogram;
[0055] According to the pixel probability of each gray level, the intra-class variance and the inter-class variance of each possible threshold are calculated, the intra-class variance is used to measure the degree of gray variation within the same class, and the inter-class variance is used to measure the gray difference between different classes;
[0056] The possible threshold with the minimum intra-class variance and the maximum inter-class variance is determined as the image threshold of the welded steel structure image.
[0057] In this embodiment, the possible threshold is a plurality of thresholds randomly selected within a preset threshold range. For example, the preset threshold range can be 0 to 255, and the possible threshold can be 10, 20, 30, 40, 50, and 60.
[0058] As an example, after the server obtains the gray histogram, the number of pixels of each gray level is counted according to the gray histogram, and then the number of pixels of each gray level is divided by the total number of pixels, that is, the pixel probability of each gray level after normalization can be obtained.
[0059] Then, all possible thresholds are traversed, and for each threshold T, the intra-class variance of the foreground and the intra-class variance of the background are calculated. Specifically, the intra-class variance can be obtained by calculating the variance of the gray values in each class; then the inter-class variance between the foreground and the background is calculated. Specifically, the inter-class variance can be obtained by calculating the square of the difference between the mean gray values of the two classes and the product of the corresponding class pixel probability.
[0060] Then, all possible thresholds are traversed, and the threshold that makes the intra-class variance minimum and the inter-class variance maximum is found, which is used as the best image threshold. Thus, the original gray image is binarized and segmented using the determined best image threshold to obtain the binary image of the foreground and the background.
[0061] Through this embodiment, according to the gray histogram of the welded steel structure image, the best image threshold of the welded steel structure image can be accurately determined, which provides an accurate basis for subsequent image segmentation and analysis. It has higher accuracy and robustness, and can be applied to different types of welded steel structure images.
[0062] As an optional embodiment, S403 can specifically include:
[0063] The pixel region in the welded steel structure image that is greater than or equal to the image threshold is marked as the foreground region of the initial binarized image;
[0064] The pixel region in the welded steel structure image that is less than the image threshold is marked as the background region of the initial binarized image;
[0065] According to the foreground region and the background region, the initial binarized image corresponding to the welded steel structure image is obtained.
[0066] In this embodiment, the server first marks the pixel regions in the welded steel structure image that are greater than or equal to the image threshold as foreground regions of the initial binary image. These pixels usually correspond to target objects or regions of interest in the welded steel structure image, such as welds, weld points, etc.
[0067] Then, the server marks the pixel regions in the welded steel structure image that are less than the image threshold as background regions of the initial binary image. These pixels usually correspond to background parts in the welded steel structure image, such as steel plates, surrounding environment, etc.
[0068] Finally, after completing the initial binary processing, the generated initial binary image is output and stored to a designated location.
[0069] Through this embodiment, the initial binary image of the welded steel structure image can be quickly generated, providing an accurate basis for subsequent image analysis. Compared with traditional manual segmentation methods, it has higher automation degree and accuracy, thereby significantly improving the image processing efficiency.
[0070] As an optional embodiment, as shown in Figure 5 S103 can specifically include the following S501-S504:
[0071] S501, edge detection is performed on the welded steel structure image to obtain a plurality of connected domains corresponding to the welded steel structure image;
[0072] S502, for each edge curve in the connected domain, an edge chain code corresponding to the edge curve is constructed;
[0073] S503, according to the edge chain code corresponding to each edge curve, the edge roughness of each connected domain is determined;
[0074] S504, according to the edge roughness of each connected domain and the pixel gray value variance of the corresponding connected domain, the threshold adjustment requirement degree of each connected domain is determined.
[0075] In this embodiment, the edge chain code is used to represent the order of boundary pixels in the image through a digital sequence.
[0076] As an example, the server first reads the welded steel structure image and uses an edge detection algorithm (such as Canny operator, Sobel operator or Prewitt operator, etc.) to perform edge detection on the image. Through edge detection, the edge pixels in the image are identified, and the image is divided into multiple connected domains according to the connectivity of the edge pixels.
[0077] Then, for each edge curve in the connected domain, a chain code representation of the edge curve is constructed using Freeman chain code or other edge chain code representation methods. The edge chain code can accurately describe the shape and direction of the edge curve, providing a basis for subsequent edge roughness calculation.
[0078] Further, the edge chain code of each connected domain is analyzed to calculate the curvature variation and length of the edge curve and other characteristic parameters. Based on the characteristic parameters, a statistical-based method or a machine learning-based method is used to calculate the edge roughness of each connected domain. At the same time, for each connected domain, the variance of the pixel gray value is calculated to reflect the dispersion degree of the pixel gray value in the connected domain.
[0079] Finally, the edge roughness and the pixel gray value variance are combined to calculate the threshold adjustment requirement degree of each connected domain using weighted summation.
[0080] Through this embodiment, the edge chain code is first constructed, and then the edge roughness and the pixel gray value variance are calculated based on the edge chain code, which realizes effective processing of the welded steel structure image. Thus, the threshold adjustment requirement degree of each connected domain in the welded steel structure image can be accurately calculated, which helps to adjust the welded steel structure image based on the threshold adjustment requirement degree of each connected domain, thereby realizing adaptive threshold segmentation of different connected domains in the welded steel structure image, retaining the welded crack part as much as possible, and improving the quality detection accuracy of the welded steel structure.
[0081] As an optional embodiment, S502 can specifically include:
[0082] Taking any one edge point in the target edge curve as a starting point, each edge point in the target edge curve is sequentially traversed to form an edge point sequence;
[0083] According to the relative position relationship between each edge point in the edge point sequence and the corresponding adjacent edge point, the direction code corresponding to each edge point is determined;
[0084] According to the direction code corresponding to each edge point, the edge chain code corresponding to the target edge curve is constructed.
[0085] In this embodiment, the server selects any one edge point in the target edge curve as a starting point, sequentially traverses each edge point in the target edge curve, and forms an edge point sequence in order from the traversed edge points. For example, the edge point sequence can be [P1, P2, P3, P4, P5].
[0086] Then, for each edge point in the edge point sequence, the relative positional relationship between the edge point and the next adjacent edge point is calculated. According to the relative positional relationship, a direction code is assigned to each edge point. The direction code can specifically be an eight-direction code or a four-direction code. In the case of selecting the eight-direction code, 0 represents the east direction, 1 represents the northeast direction, 2 represents the north direction, 3 represents the northwest direction, 4 represents the west direction, 5 represents the southwest direction, 6 represents the south direction, and 7 represents the southeast direction.
[0087] For example, it is assumed that the direction code of P1 to P2 is 2, the direction code of P2 to P3 is 5, the direction code of P3 to P4 is 7, and the direction code of P4 to P5 is 1.
[0088] Finally, the direction codes of each edge point in the edge point sequence are arranged in order to form an edge chain code. For example, the edge chain code corresponding to the edge point sequence [P1, P2, P3, P4, P5] is [2, 5, 7, 1]. The edge chain code is represented in the form of a string, and each element corresponds to the direction code of an edge point.
[0089] Through the embodiment, the edge point sequence is accurately extracted from the target edge curve, and the direction code is determined according to the relative positional relationship between the edge points, and finally the edge chain code is constructed. This helps to determine the edge roughness of the connected domain according to the edge chain code corresponding to the edge curve in the subsequent process. Then, the threshold adjustment requirement degree of each connected domain in the welded steel structure image can be accurately calculated according to the edge roughness of the connected domain, and the quality detection accuracy of the welded steel structure is improved.
[0090] As an optional embodiment, S503 can specifically include:
[0091] obtaining the edge chain code corresponding to each edge curve in the target connected domain;
[0092] determining the mean value of the direction code of each edge chain code according to the difference between each adjacent direction code in the edge chain code;
[0093] performing mean value calculation on the mean value of each direction code to obtain the edge roughness of the target connected domain.
[0094] In the embodiment, the edge roughness of the connected domain can be specifically determined by the following formula 1:
[0095] Formula 1
[0096] In the formula, denotes the edge roughness of the i th connected domain, denotes the direction code of the a th edge chain code of the i th connected domain, denotes the direction code of the a-th edge chain code in the i-th connected domain denotes the direction code of the a-th edge chain code in the i-th connected domain
[0097] denotes the direction code of the a-th edge chain code in the i-th connected domain denotes the direction code of the a-th edge chain code in the i-th connected domain denotes the difference between the direction code of the a-th edge chain code in the i-th connected domain and the direction code of the a+1-th edge chain code in the i-th connected domain denotes the difference between the direction code of the a-th edge chain code in the i-th connected domain and the direction code of the a+1-th edge chain code in the i-th connected domain denotes the average of the differences between the direction codes of the adjacent edge chain codes in the i-th connected domain denotes the average of the differences between the direction codes of the adjacent edge chain codes in the i-th connected domain denotes the average of the differences between the direction codes of the adjacent edge chain codes in the i-th connected domain denotes the average of the differences between the direction codes of the adjacent edge chain codes in the i-th connected domain denotes the average of the differences between the direction codes of the adjacent edge chain codes in the i-th connected domain
[0098] The greater the difference between the direction codes of the adjacent edge chain codes in the connected domain, the more rough the edge of the connected domain.
[0099] According to the differences between the adjacent direction codes in each edge chain code in the target connected domain, the edge roughness of the target connected domain can be accurately calculated. Thus, the threshold adjustment requirement degree of each connected domain in the welded steel structure image can be accurately calculated according to the edge roughness of the connected domain, and the quality detection accuracy of the welded steel structure is improved.
[0100] As an optional embodiment, S504 can specifically include:
[0101] performing an exponential function operation on the reciprocal of the pixel gray value variance of the target connected domain to obtain an exponential operation result;
[0102] multiply the exponential operation result by the edge roughness of the target connected domain to obtain the threshold adjustment requirement degree of the target connected domain.
[0103] In this embodiment, the threshold adjustment requirement degree of the connected domain can be determined by the following formula 2:
[0104] Formula 2
[0105] In the formula, denotes the threshold adjustment requirement degree of the i-th connected domain, exp denotes an exponential function operation, denotes the pixel gray value variance of the i-th connected domain, denotes the edge roughness of the i-th connected domain.
[0106] In the formula, The greater the value is, the more unsmooth the ith connected domain is, that is, the greater the possibility of the existence of the welding crack in the ith connected domain is, and the greater the threshold adjustment requirement of the connected domain is; The greater the value is, the more textures the ith connected domain contains, and the lower the threshold adjustment requirement of the connected domain is.
[0107] According to the edge roughness of the connected domain and the pixel gray value variance of the corresponding connected domain, the threshold adjustment requirement of the connected domain can be accurately determined in this embodiment. Thus, adaptive threshold segmentation of different connected domains in the welded steel structure image can be realized, the welded crack part is preserved as much as possible, and the quality detection accuracy of the welded steel structure can be improved.
[0108] As an optional embodiment, S104 can specifically include:
[0109] The threshold of the to-be-adjusted connected domain is adjusted according to the threshold adjustment requirement, to obtain a modified threshold of the to-be-adjusted connected domain;
[0110] The foreground region and the background region of the to-be-adjusted connected domain are re-labeled according to the modified threshold, to obtain a region labeling result;
[0111] The size relationship between the welding crack gray value of the to-be-adjusted connected domain and the modified threshold is judged, to obtain a gray value judgment result;
[0112] In a case where the gray value judgment result indicates that the welding crack gray value is greater than or equal to the modified threshold, the region labeling result is determined as a binarization result of the to-be-adjusted connected domain;
[0113] In a case where the gray value judgment result indicates that the welding crack gray value is less than the modified threshold, the foreground region and the background region of the region labeling result are reversed, to obtain a binarization result of the to-be-adjusted connected domain;
[0114] According to the binarization result corresponding to each to-be-adjusted connected domain, the initial binarization image is updated, to obtain a final binarization image corresponding to the welded steel structure image.
[0115] In this embodiment, the welding crack gray value is used to represent the gray value of the position where the welding crack is located in the to-be-adjusted connected domain. The welding crack gray value is obviously different from the gray values of other positions in the to-be-adjusted connected domain. Therefore, a gray threshold can be set in advance, and then the gray values of each position in the to-be-adjusted connected domain are obtained and compared. In a case where the difference between the gray value of a position and the gray values of surrounding positions is greater than the preset gray threshold, the position is determined as the position where the welding crack is located, and the gray value of the position is the welding crack gray value.
[0116] As an example, the server calculates the threshold adjustment requirement degree of each connected domain in the welded steel structure image, compares the threshold adjustment requirement degree with a preset requirement degree threshold, and determines each connected domain greater than the preset requirement degree threshold as a connected domain to be adjusted. The threshold of the connected domain to be adjusted is adjusted, and a local adaptive threshold method (such as a local OTSU threshold method) is used to determine the corresponding correction threshold.
[0117] Then, the server re-labels the foreground region and the background region of the connected domain to be adjusted according to the correction threshold to obtain a region labeling result. The server determines the size relationship between the welded crack gray value and the correction threshold of the connected domain to be adjusted.
[0118] According to the gray value determination result, two cases are processed: if the welded crack gray value is greater than or equal to the correction threshold, the region labeling result is determined as the binarization result of the connected domain to be adjusted; if the welded crack gray value is less than the correction threshold, the foreground region and the background region of the region labeling result are reversed to obtain the binarization result of the connected domain to be adjusted.
[0119] Finally, according to the binarization result corresponding to each connected domain to be adjusted, the initial binarization image is updated to obtain the final binarization image corresponding to the welded steel structure image.
[0120] Through this embodiment, the threshold of each connected domain with a threshold adjustment requirement degree greater than a preset requirement degree threshold is adjusted to obtain the final binarization image corresponding to the welded steel structure image. Thus, adaptive threshold segmentation of different connected domains in the welded steel structure image is realized, the welded crack part can be preserved as much as possible, and thus the quality detection accuracy of the welded steel structure can be improved.
[0121] As an optional embodiment, S105 can specifically include:
[0122] According to the final binarization image, a first connected domain with a welded crack and a second connected domain without a welded crack in the final binarization image are determined;
[0123] According to the first connected domain and the second connected domain, a quality detection result of a target welded steel structure is determined.
[0124] In this embodiment, the first connected domain is a connected domain with texture and crack information inside the connected domain, that is, the foreground region labeled after the threshold segmentation. The second connected domain is a connected domain without texture and crack information inside the connected domain, that is, the background region labeled after the threshold segmentation.
[0125] As an example, the server can determine the binary image of each connected domain according to the final binary image. For a normal connected domain, the texture inside the connected domain and the background are divided into the same value, and the inside of the connected domain with cracks and the background are divided into two values.
[0126] Therefore, the server traverses all the connected domains, and then marks the connected domain without texture and crack information inside the connected domain as a second connected domain, and marks the connected domain with texture and crack information inside the connected domain as a first connected domain. Finally, the number and size of the first connected domain and the second connected domain are compared, so as to evaluate the severity of the welding crack. And according to the evaluation result, a quality detection report of the welded steel structure is generated, including the position and size of the welding crack and other information.
[0127] Through the embodiment, according to the first connected domain with welding cracks and the second connected domain without welding cracks in the final binary image. The welding crack can be more accurately identified, and the subjectivity of manual visual inspection is avoided, so as to improve the quality detection accuracy of the welded steel structure.
[0128] It should be noted that the present application is not limited to the specific configurations and processes described above and shown in the drawings. For the sake of brevity, detailed descriptions of well-known methods are omitted here. In the above embodiments, several specific steps are described and shown as examples. However, the method process of the present application is not limited to the specific steps described and shown, and those skilled in the art can make various changes, modifications and additions, or change the order between steps, after understanding the spirit of the present application.
[0129] It should also be noted that the exemplary embodiments mentioned in the present application describe some methods or systems based on a series of steps or devices. However, the present application is not limited to the order of the above steps, that is, the steps can be performed in the order mentioned in the embodiments, or in an order different from the embodiments, or several steps can be performed simultaneously.
[0130] The above is only a specific implementation of the present application, and those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working process of the system, module and unit described above can refer to the corresponding process in the foregoing method embodiments, which will not be described here. It should be understood that the protection scope of the present application is not limited thereto, and any person skilled in the art can easily think of various equivalent modifications or replacements within the technical range disclosed by the present application, and these modifications or replacements should be covered within the protection scope of the present application.
Claims
1. A method for quality inspection of welded steel structures in buildings based on image processing, characterized in that, The method includes: Obtain images of the welded steel structure of the target welded steel structure; The welded steel structure image is subjected to threshold segmentation to obtain the initial binarized image corresponding to the welded steel structure image; Based on the edge roughness and pixel gray value variance of the welded steel structure image, the threshold adjustment requirement of each connected component in the welded steel structure image is determined. For each connected component whose threshold adjustment requirement is greater than the preset threshold, threshold adjustment is performed to obtain the final binarized image corresponding to the welded steel structure image. Based on the final binarized image, the quality inspection result of the target welded steel structure is obtained; The step of determining the threshold adjustment requirement for each connected component in the welded steel structure image based on the edge roughness and pixel grayscale variance includes: Edge detection is performed on the welded steel structure image to obtain multiple connected components corresponding to the welded steel structure image; For each edge curve in the connected domain, construct the edge chain code corresponding to the edge curve; The edge roughness of each connected domain is determined based on the edge chain code corresponding to each edge curve. Based on the edge roughness of each connected region and the variance of the corresponding pixel grayscale value of the connected region, the threshold adjustment requirement of each connected region is determined respectively. The step of determining the threshold adjustment requirement for each connected component based on the edge roughness of each connected component and the variance of the corresponding pixel grayscale values of the connected component includes: The exponential function operation is performed on the negative of the variance of the pixel gray values of the target connected component to obtain the exponential operation result; Multiplying the result of the exponential operation by the edge roughness of the target connected region yields the threshold adjustment requirement of the target connected region.
2. The image processing-based method for inspecting the quality of welded steel structures in buildings according to claim 1, characterized in that, The step of performing threshold segmentation on the welded steel structure image to obtain the initial binarized image corresponding to the welded steel structure image includes: Obtain the grayscale histogram of the welded steel structure image; Based on the grayscale histogram, determine the image threshold of the welded steel structure image; The welded steel structure image is labeled according to the image threshold to obtain the initial binarized image corresponding to the welded steel structure image.
3. The image processing-based method for inspecting the quality of welded steel structures in buildings according to claim 2, characterized in that, Determining the image threshold of the welded steel structure image based on the grayscale histogram includes: The grayscale histogram is normalized to obtain the pixel probability of each grayscale level in the grayscale histogram; Based on the pixel probability of each gray level, calculate the intra-class variance and inter-class variance for each possible threshold. The intra-class variance is used to measure the degree of gray level variation within the same category, and the inter-class variance is used to measure the gray level difference between different categories. The possible threshold with the smallest intra-class variance and the largest inter-class variance is determined as the image threshold of the welded steel structure image.
4. The image processing-based method for inspecting the quality of welded steel structures in buildings according to claim 2, characterized in that, The step of marking the welded steel structure image according to the image threshold to obtain the initial binarized image corresponding to the welded steel structure image includes: The pixel regions in the welded steel structure image that are greater than or equal to the image threshold are marked as the foreground regions of the initial binarized image; The pixel regions in the welded steel structure image smaller than the image threshold are marked as the background regions of the initial binarized image; Based on the foreground region and the background region, an initial binarized image corresponding to the welded steel structure image is obtained.
5. The image processing-based method for inspecting the quality of welded steel structures in buildings according to claim 1, characterized in that, The step of constructing edge chain codes corresponding to the edge curves in each of the connected components includes: Starting from any edge point in the target edge curve, traverse each edge point in the target edge curve in turn to form an edge point sequence; Based on the relative positional relationship between each edge point and its corresponding adjacent edge point in the edge point sequence, the direction code corresponding to each edge point is determined; Based on the direction encoding corresponding to each edge point, the edge chain code corresponding to the target edge curve is constructed.
6. The image processing-based method for inspecting the quality of welded steel structures in buildings according to claim 1, characterized in that, The step of determining the edge roughness of each connected region based on the edge chain code corresponding to each edge curve includes: Obtain the edge chain code corresponding to each edge curve in the target connected component; The mean value of the directional encoding of each edge chain code is determined based on the difference between each adjacent directional encoding in each edge chain code. The edge roughness of the target connected domain is obtained by averaging the mean values of each direction encoding.
7. The image processing-based method for inspecting the quality of welded steel structures in buildings according to claim 1, characterized in that, The step of adjusting the threshold of each connected component whose threshold adjustment requirement is greater than a preset threshold to obtain the final binarized image corresponding to the welded steel structure image includes: For connected components whose threshold adjustment demand is greater than a preset demand threshold, threshold adjustment is performed to obtain the corrected threshold of the connected components to be adjusted. Based on the correction threshold, the foreground and background regions of the connected component to be adjusted are re-labeled to obtain the region labeling result; Determine the relationship between the grayscale value of the weld crack in the connected region to be adjusted and the correction threshold to obtain the grayscale value judgment result; If the grayscale value judgment result indicates that the grayscale value of the weld crack is greater than or equal to the correction threshold, the region marking result is determined as the binarization result of the connected domain to be adjusted; If the grayscale value judgment result indicates that the grayscale value of the welding crack is less than the correction threshold, the foreground region and the background region of the region marking result are inverted to obtain the binarization result of the connected component to be adjusted. Based on the binarization results corresponding to each of the connected components to be adjusted, the initial binarized image is updated to obtain the final binarized image corresponding to the welded steel structure image.
8. The image processing-based method for inspecting the quality of welded steel structures in buildings according to claim 1, characterized in that, The process of obtaining the quality inspection result of the target welded steel structure based on the final binarized image includes: Based on the final binarized image, determine the first connected region in the final binarized image where there is a welding crack and the second connected region where there is no welding crack; Based on the first connected component and the second connected component, the quality inspection result of the target welded steel structure is determined.
Citation Information
Patent Citations
Method for detecting welding seam quality of steel structure
CN115880280A
Welding defect detection method
CN117351019A