Storage tank body defect detection method and system based on image processing

By employing pixel gradient values and iterative threshold segmentation, the method enhances the accuracy of defect detection in storage tanks by accurately distinguishing defect regions from normal regions, reducing noise interference and improving precision.

CN120318257APending Publication Date: 2025-07-15GUANGZHOU GRANDA NEW ENERGY TECH CO LTD +1

Patent Information

Application Number
CN202510780288.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-06-12
Publication Date
2025-07-15

AI Technical Summary

Technical Problem

In the prior art, in the detection of tank defects, the defect area and normal area cannot be effectively distinguished during threshold division, resulting in inaccurate division results.

Method used

By calculating the gradient values of pixel points in the grayscale image, filter the defect suspected area, use the DBSCAN clustering algorithm to remove noise, fit the defect edge, iteratively adjust the size of the defect area, and perform iterative threshold segmentation to dynamically determine the optimal segmentation threshold.

Benefits of technology

It improves the accuracy of defect detection, reduces noise interference and false alarms, enhances the robustness of the algorithm, and adapts to defect detection of different shapes and sizes.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120318257A_ABST
    Figure CN120318257A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of image processing, in particular to a storage tank body defect detection method and system based on image processing, and the method comprises the steps: collecting a storage tank body surface image, and preprocessing the surface image to obtain a grey-scale map; dividing the grey-scale map into a plurality of defect suspected areas according to the gradient value of each pixel point in the grey-scale map, calculating the defect expression degree of each defect suspected area, and taking the defect suspected area of which the defect expression degree is greater than a preset threshold value as a defect area; iteratively adjusting the size of the defect region to obtain a to-be-segmented region corresponding to the defect region; and performing iterative threshold segmentation on each to-be-segmented region, and marking the position of the defect in the storage tank body according to the result of the iterative threshold segmentation. According to the invention, the segmentation areas are adaptively adjusted, so that defects of different sizes and shapes can be flexibly adapted, and the efficiency and accuracy of surface defect detection of the storage tank body are improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of image processing, and more specifically, to a method and system for detecting defects of a storage tank body based on image processing. Background Art

[0002] Storage tanks play a vital role in the energy sector, especially in the storage and transportation of energy. During the manufacturing process of storage tanks, bubbles or voids may form inside or on the surface of the tank due to various factors such as material handling, processing technology, welding, etc. These bubbles or voids may come from inclusions in the material, gas residues during welding, or improper operations during processing. The presence of bubbles or voids will destroy the overall structural continuity of the tank, resulting in uneven surface of the tank. This unevenness not only affects the aesthetics of the tank, but more importantly, it may affect the sealing and stability of the tank. Especially in situations where high-precision sealing is required, such as chemical storage tanks, liquefied gas storage tanks, etc., the unevenness of the tank may lead to an increased risk of leakage.

[0003] Prior art, such as a patent application document with publication number CN114235758A, discloses a defect detection method, apparatus, device and storage medium. The defect detection method includes: first, obtaining a grayscale image of the surface of the object to be detected, then determining a mask size, and determining the neighborhood pixels within the mask area of each pixel according to the size, and adjusting the grayscale value of the pixel according to the maximum grayscale difference between the neighborhood pixels within the mask area. Finally, threshold segmentation is performed on the adjusted grayscale image, and the defect detection result of the object to be detected is determined according to the segmentation result.

[0004] However, when performing threshold segmentation, the above operation does not take into account that the grayscale value of the defective area is different from that of the normal area. Some defective areas have lower grayscale values than normal areas, while some defective areas have higher grayscale values than normal areas. Therefore, when the grayscale value of the defective area overlaps with the grayscale value of the normal area, the segmentation result of the threshold segmentation is inaccurate. Summary of the invention

[0005] In order to solve the technical problem that the above-mentioned threshold segmentation has limitations and leads to inaccurate segmentation results, the present invention provides solutions in the following aspects.

[0006] In a first aspect, a method for detecting defects in a storage tank body based on image processing comprises: Collect the surface image of the storage tank, and pre-process the surface image to obtain a grayscale image; Divide the grayscale image into a plurality of suspected defect areas according to the gradient value of each pixel point in the grayscale image, calculate the defect manifestation degree of each suspected defect area, and take the suspected defect area whose defect manifestation degree is greater than a preset threshold as the defect area; Iteratively adjust the size of the defect area to obtain the area to be segmented corresponding to the defect area; Perform iterative threshold segmentation on each area to be segmented, and mark the positions of the defects in the storage tank body according to the results of the iterative threshold segmentation.

[0007] By using the gradient values of pixel points to divide the defect suspected areas and calculating the defect manifestation degree, the present invention can accurately identify the true defect areas. Further, by iteratively adjusting the size of the defect areas to obtain the areas to be segmented, and adopting the iterative threshold segmentation technology, the optimal segmentation threshold is dynamically determined according to the specific conditions of each area to be segmented, so as to more accurately separate the defect areas and reduce the noise interference in the segmentation process.

[0008] Preferably, dividing the grayscale image into multiple defect suspected areas according to the gradient values of pixel points in the grayscale image includes: Calculate the gradient values of pixel points in the grayscale image; Classify the pixel points with non-zero gradient values into defect suspected areas, and cluster the pixel points in the defect suspected areas to obtain multiple clusters; Eliminate the clusters with the number of pixel points within the cluster less than the preset number threshold, and use the minimum circumscribed rectangle of the remaining clusters after elimination as the defect suspected area.

[0009] Clustering the pixel points in the defect suspected areas can obtain multiple clusters. By eliminating the clusters with the number of pixel points within the cluster less than the preset number threshold, false alarms caused by noise or minor changes can be removed. At the same time, the remaining clusters represent the true defect areas, thus reducing the possibility of missed alarms.

[0010] Preferably, the DBSCAN clustering algorithm is selected for the clustering, where the clustering radius is the Euclidean distance between two pixel points.

[0011] Preferably, the process of obtaining the defect manifestation degree includes: Take the length and width of the defect suspected area as the major axis and minor axis respectively to construct an initial ellipse of the defect suspected area; start iterating from the initial ellipse, and in each iteration, calculate the preference degree of the current ellipse as the defect edge. When the iteration stop condition is met, take the ellipse with the maximum preference degree as the edge of the defect suspected area; Calculate the average gray value corresponding to the inner and outer sides of the edge of the defect suspected area respectively, and take the absolute value of the difference between the average gray value inside the edge of the defect suspected area and the average gray value outside the edge of the defect suspected area as the defect manifestation degree of the defect suspected area.

[0012] The iterative process ensures that the selected elliptical edge is as close as possible to the true defect boundary, reducing the error caused by inaccurate boundaries. Calculating the difference in the average gray values inside and outside the edge can intuitively reflect the gray change between the defect area and the surrounding normal area, thereby quantifying the obviousness of the defect.

[0013] Preferably, the preference degree satisfies the relational expression: ; In the formula, is the preference degree of the ellipse generated in the th iteration, is the total number of pixels in the th defect suspected area, is the minimum Euclidean distance from the th pixel to the ellipse, is the gradient value of the th pixel, is the exponential function.

[0014] By calculating the minimum Euclidean distance from each pixel to the ellipse and considering the gradient value of the pixel, this relational expression can more accurately evaluate the matching degree between the ellipse and the true defect edge; incorporating the gradient value into the calculation of the preference degree helps to more accurately identify the edge of the defect.

[0015] Preferably, the method of iteratively adjusting the size of the defect area to obtain the area to be segmented corresponding to the defect area includes: According to the preset iterative conditions, iteratively expand the defect area. Calculate the maximum between-class variance of the current defect area during each iteration. When the between-class variances of two consecutive iterations both decrease, stop the iteration, and take the area before the decrease of the maximum between-class variance as the area to be segmented of the defect area.

[0016] By iteratively expanding the defect area and calculating the maximum between-class variance after each iteration, this method can more accurately define the range of the defect area. By iterative adjustment to adapt to defects of different shapes and sizes, the algorithm can be applied to various complex storage tank body surface defect detection scenarios, enhancing the robustness of the algorithm.

[0017] In the second aspect, a storage tank body defect detection system based on image processing includes: a processor and a memory. The memory stores computer program instructions, and when the computer program instructions are executed by the processor, the above-mentioned storage tank body defect detection method based on image processing is implemented.

[0018] The beneficial effects of the present invention are: The present invention first screens out suspected defect regions through the gradient values of pixel points, and then calculates the defect manifestation degree of each suspected defect region, iteratively adjusts the size of the defect region, obtains the regions to be segmented of the defect region, and performs adaptive iterative thresholding on each region to be segmented, thereby improving the accuracy of defect detection. BRIEF DESCRIPTION OF THE DRAWINGS

[0019] By referring to the accompanying drawings and reading the following detailed description, the above and other objects, features, and advantages of the exemplary embodiments of the present invention will become readily understandable. In the drawings, several embodiments of the present invention are shown in an exemplary rather than restrictive manner, and the same or corresponding reference numerals represent the same or corresponding parts, wherein: Figure 1 is a flowchart of the method from step S1 to step S4 in the method for detecting defects on a storage tank body based on image processing according to an embodiment of the present invention. DETAILED DESCRIPTION OF THE EMBODIMENTS

[0020] The following will clearly and completely describe the technical solutions in the embodiments of the present invention with reference to the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are some, but not all, of the embodiments of the present invention. All other embodiments obtained by those of ordinary skill in the art based on the embodiments of the present invention without creative efforts shall fall within the protection scope of the present invention.

[0021] The application scenario of the present invention is: using the iterative threshold segmentation method to perform threshold segmentation on the surface image of a storage tank body.

[0022] An embodiment of the present invention discloses a method for detecting defects on a storage tank body based on image processing. Referring to Figure 1 , it includes steps S1 to S4, specifically as follows: S1: Collect the surface image of the storage tank body and preprocess the surface image to obtain a grayscale image.

[0023] First, use an industrial camera or an image acquisition device to photograph the surface of the storage tank body to obtain the surface image of the storage tank body. Then, convert the collected color image into a grayscale image. Finally, the grayscale image can be denoised and image enhanced to obtain a clear grayscale image.

[0024] S2: Divide the grayscale image into multiple suspected defect regions according to the gradient values of the pixel points in the grayscale image, calculate the defect manifestation degree of each suspected defect region, and use the suspected defect region with a defect manifestation degree greater than a preset threshold as the defect region.

[0025] In the case of no defects, the image of the storage tank body surface should be uniform, that is, the brightness or color of each area should be consistent. Therefore, in the grayscale image, the gray values of the pixels in the normal area do not change much. The gradient value refers to the change rate of the gray value of the pixel in the image, and it can be used to measure the edge or the intensity of the change in the local area of the image. In an ideal situation, if there are no defects on the surface of the storage tank body, then its surface should be smooth, the gray value changes little, and thus the gradient value is close to 0. When there are defects such as bubbles and cavities on the surface of the storage tank body, the gray values of these areas will be different from those of the surrounding normal areas, resulting in a change in the gradient value, that is, the gradient value is no longer 0. By calculating the gradient value of each pixel in the image, the pixels with non-zero gradient values can be detected, and these points may be the locations of the defects. Separating the pixels with gradient values greater than 0 from the image means that these points may be the defective areas, which can reduce the computational complexity of subsequent processing because only these areas where defects may exist need to be concerned about.

[0026] Specifically, use the Sobel operator to calculate the gradient value of each pixel in the grayscale image, classify the pixels with a gradient value of 0 into the normal area, and classify the pixels with non-zero gradient values into the defect suspected area. Use the DBSCAN clustering algorithm to cluster the pixels in the defect suspected area to obtain multiple clusters; among them, the clustering radius is the Euclidean distance between two pixels.

[0027] In clustering analysis, noise may cause the formation of some clusters containing very few pixels. These clusters do not represent real defects but are caused by random noise or interference during the image acquisition process. By setting a threshold, these clusters caused by noise can be identified and removed. After removing the noise clusters, the remaining clusters are more likely to be caused by real defects or features of interest, which can improve the accuracy and reliability of the clustering results.

[0028] Specifically, in the clustering result, if the number of pixels in a certain cluster is less than 3, it is considered that this cluster is a change in pixel values caused by noise, and then this cluster is removed. After removing the clusters with less than 3 cluster pixels, for the remaining clusters, calculate their minimum bounding rectangles, and use this minimum bounding rectangle as the defect suspected area corresponding to this cluster.

[0029] By simplifying the cluster into a minimum bounding rectangle, the subsequent image processing and analysis steps can be simplified. For example, when further analyzing the defects, it can be directly carried out within these rectangular areas instead of on the entire image.

[0030] Bubble or hole defects usually appear as circular or oval shapes on the surface of the storage tank body, and this shape feature can be used to assist in identifying and analyzing the defects. To more accurately determine the gray value difference of the defects, the defect edges are fitted within the suspected defect area, that is, a circle or an ellipse is determined to approximate the boundary of the defect. By fitting the defect edges, the areas inside and outside the defects can be clearly distinguished, and further calculate the gray value difference between the areas inside and outside the defects, so as to quantify the performance degree of the defects.

[0031] Specifically, select any suspected defect area for analysis. Take the length and width of the suspected defect area as the major axis and minor axis respectively to construct the initial ellipse of the suspected defect area. Starting from the initial ellipse, the major axis and minor axis are iteratively reduced respectively, and the iteration step size is taken as 1. When the major axis or minor axis iterates to one-fourth of its initial value, the iteration is terminated.

[0032] Among them, in each iteration, calculate the preference degree of the current ellipse as the edge of the bubble or hole defect. After the iteration ends, select the ellipse with the maximum preference degree as the edge of the suspected defect area.

[0033] Among them, the calculation process of the above preference degree includes: For the ellipse generated in each iteration, calculate the minimum Euclidean distance from the pixel points in the suspected defect area to this ellipse. Since the edge of the bubble or hole defect usually has a large gradient value, the gradient value of each pixel point is used as the weight, multiply the distance from each pixel point to the ellipse by its weight, and sum to obtain the weighted average distance. Use the exponential function to calculate the negative exponential power of the weighted average distance to obtain the preference degree of the corresponding ellipse, that is, the relational expression is satisfied as:

[0034] In the formula, is the preference degree of the ellipse generated in the th iteration, is the total number of pixel points in the th suspected defect area, is the th minimum Euclidean distance from the pixel point to this ellipse, is the th gradient value of the pixel point, is the exponential function.

[0035] Another way to calculate the preference degree of the above ellipse is also provided, that is, the relational expression is satisfied as:

[0036] In the formula, is the preference degree of the ellipse generated in the th iteration, is the The total number of pixels within a defect suspected region, is the minimum Euclidean distance from the -th pixel to the ellipse, is the gradient value of the -th pixel,

[0037] After selecting the ellipse with the maximum preference degree as the edge of the defect suspected region, calculate the average gray value corresponding to the inner and outer sides of the edge of the defect suspected region respectively, and take the absolute value of the difference between the average gray value of the inner side of the edge of the defect suspected region and the average gray value of the outer side of the edge of the defect suspected region as the defect manifestation degree of the defect suspected region. Then the defect manifestation degree satisfies the following relationship:

[0038] In the formula, is the defect manifestation degree of the -th defect suspected region, is the average gray value of the inner side of the edge of the -th defect suspected region, is the average gray value of the outer side of the edge of the -th defect suspected region.

[0039] According to the above method for calculating the defect manifestation degree of the -th defect suspected region, the defect manifestation degrees of all other defect suspected regions can be calculated in the same way.

[0040] Furthermore, for each defect suspected region, if its defect manifestation degree is greater than the set threshold (set to 5 according to experience), then determine that the defect suspected region is a defect region.

[0041] S3: Iteratively adjust the size of the defect region to obtain the region to be segmented corresponding to the defect region.

[0042] If the iterative threshold segmentation method is directly applied to the defect region obtained in S2 above, since the pixel gray values of the defect region are relatively consistent and the contrast with the normal region may not be obvious enough, it may be difficult to accurately segment the defect location.

[0043] To improve the segmentation effect, expand the defect region to include part of the normal region to increase the gray difference between the defect region and the normal region, so that the subsequent iterative threshold segmentation can more easily identify the defect location.

[0044] To find the optimal size of the enlarged area, iterative enlargement is adopted. In each iteration, the length and width of the defective area are increased by at least 3 pixels. After each iteration, the maximum between-class variance within the area is calculated (when the between-class variance is large, it indicates a large difference between different gray levels in the image).

[0045] As the number of iterations increases, the between-class variance usually increases first (because the pixels in the normal area start to intervene, increasing the gray difference), and then decreases (because there are too many pixels in the normal area, resulting in a decrease in the gray difference). When the maximum between-class variance during the iteration process starts to show a downward trend (i.e., the maximum between-class variances of two consecutive iterations both decrease), the iteration is stopped, and the area before the decrease is taken as the area to be segmented for the defective area.

[0046] Through this method, each initially identified defective area is expanded to a more suitable area to be segmented, which contains sufficient defective pixels and a part of normal pixels to better identify the defective position in the subsequent iterative threshold segmentation.

[0047] S4: Perform iterative threshold segmentation on each area to be segmented, and mark the positions of the defects in the storage tank body according to the results of the iterative threshold segmentation.

[0048] Perform iterative threshold segmentation on each area to be segmented, and mark the positions of the defects on the original image according to the results of the iterative threshold segmentation.

[0049] Furthermore, conduct a detailed visual inspection on the marked defect positions to confirm the type, size, and shape of the defects. For each defect, formulate a detailed repair plan. After the repair is completed, conduct a quality inspection on the repaired area to ensure that the repair effect meets the expectations.

[0050] The embodiment of the present invention also discloses a storage tank body defect detection system based on image processing, including a processor and a memory. The memory stores computer program instructions, and when the computer program instructions are executed by the processor, the storage tank body defect detection method based on image processing according to the present invention is implemented.

[0051] The system also includes other components well-known to those skilled in the art such as a communication bus and a communication interface. Their settings and functions are known in the art, so they will not be elaborated here.

[0052] In the present invention, the foregoing memory may be any tangible medium that contains or stores a program that can be used by or in conjunction with an instruction execution system, apparatus, or device. For example, a computer-readable storage medium may be any suitable magnetic storage medium or magneto-optical storage medium, such as a resistive random access memory (RRAM), a dynamic random access memory (DRAM), a static random access memory (SRAM), an enhanced dynamic random access memory (EDRAM), a high-bandwidth memory (HBM), a hybrid memory cube (HMC), etc., or any other medium that can be used to store the required information and can be accessed by an application program, a module, or both. Any such computer storage medium may be part of the device or accessible or connectable to the device.

[0053] In the description of this specification, the meanings of "a plurality of" and "several" are at least two, for example, two, three, or more, etc., unless otherwise specifically defined.

[0054] Although this specification has shown and described multiple embodiments of the present invention, it will be apparent to those skilled in the art that such embodiments are provided by way of example only. Those skilled in the art will think of many changes, alterations, and alternative ways without departing from the spirit and scope of the present invention. It should be understood that various alternatives to the embodiments of the present invention described herein may be employed in practicing the present invention.

Claims

1. A method for detecting defects in a storage tank body based on image processing, characterized in that, Including: Collect the surface image of the storage tank body, and preprocess the surface image to obtain a grayscale image; Divide the grayscale image into multiple defect-suspected regions according to the gradient values of each pixel point in the grayscale image, calculate the defect manifestation degree of each defect-suspected region, and regard the defect-suspected region with the defect manifestation degree greater than the preset threshold as the defect region; Iteratively adjust the size of the defect region to obtain the region to be segmented corresponding to the defect region; Perform iterative threshold segmentation on each region to be segmented, and mark the position of the defect in the storage tank body according to the result of the iterative threshold segmentation.

2. The method for detecting defects of a storage tank body based on image processing according to claim 1, characterized in that, Dividing the grayscale image into multiple defect-suspected regions according to the gradient values of each pixel point in the grayscale image includes: Calculate the gradient value of each pixel point in the grayscale image; Classify the pixel points with non-zero gradient values into defect-suspected regions, and cluster the pixel points in the defect-suspected regions to obtain multiple clusters; Eliminate the clusters with the number of pixel points within the cluster less than the preset number threshold, and use the minimum bounding rectangle of the remaining clusters after elimination as the defect-suspected region.

3. The method for detecting defects of a storage tank body based on image processing according to claim 2, wherein The clustering selects the DBSCAN clustering algorithm, where the clustering radius is the Euclidean distance between two pixel points.

4. The method for detecting defects of a storage tank body based on image processing according to claim 3, characterized in that, The process of obtaining the defect manifestation degree includes: Use the length and width of the defect-suspected region as the major axis and minor axis respectively to construct an initial ellipse of the defect-suspected region; start iterating from the initial ellipse, and in each iteration, calculate the preference degree of the current ellipse as the defect edge. When the iteration stop condition is met, use the ellipse with the maximum preference degree as the edge of the defect-suspected region; Calculate the average grayscale values corresponding to the inner and outer sides of the edge of the defect-suspected region respectively, and use the absolute value of the difference between the average grayscale value inside the edge of the defect-suspected region and the average grayscale value outside the edge of the defect-suspected region as the defect manifestation degree of the defect-suspected region.

5. The method for detecting defects in a storage tank body based on image processing according to claim 4, wherein The preference degree satisfies the relation: ; where is the preference degree of the ellipse generated in the -th iteration, is the total number of pixel points in the -th defect suspected area, is the minimum Euclidean distance from the -th pixel point to the ellipse, is the gradient value of the -th pixel point, is an exponential function.

6. The method for detecting defects of a storage tank body based on image processing according to claim 5, wherein Iteratively adjusting the size of the defect region to obtain the region to be segmented corresponding to the defect region includes: According to the preset iteration condition, iteratively expand the defect region. In each iteration, calculate the maximum between-class variance of the current defect region. When the between-class variances of two consecutive iterations both decrease, stop the iteration, and take the region before the decrease of the maximum between-class variance as the region to be segmented of the defect region.

7. A storage tank body defect detection system based on image processing, characterized in that, Including: A processor and a memory, the memory stores computer program instructions, and when the computer program instructions are executed by the processor, the method for detecting defects in a storage tank body based on image processing according to any one of claims 1-6 is implemented.

Citation Information

Patent Citations

  • PCB production process online detection method based on edge detection

    CN115272346A

  • Automatic detection method for production quality of injection mold

    CN118505737A

  • Cover film surface defect detection method based on machine vision

    CN119273684A

  • Metal part surface quality detection method based on image processing

    CN119359713A

  • Defect detection method and device for an LCD screen

    US20230326006A1

Cited By

  • Oil pipe inner wall defect detection method based on machine vision

    CN120525895A