A method and system for detecting defects in underground pipelines based on image processing and ultrasonic detection.
By combining image processing and ultrasonic detection technologies, efficient and accurate detection of defects in underground pipelines can be achieved, solving the problems of low efficiency and poor adaptability in traditional methods, improving the comprehensiveness and accuracy of detection, and extending the service life of pipelines.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- NANJING UNIV OF SCI & TECH
- Filing Date
- 2024-12-30
- Publication Date
- 2026-06-30
AI Technical Summary
Traditional pipeline inspection methods are inefficient, poorly adaptable to complex pipeline structures and materials, and unable to accurately locate defects. Existing ultrasonic testing methods are insufficient to meet all inspection needs.
By combining image processing and ultrasonic detection technologies, the ultrasonic probe emits signals to obtain echo signals, and an image acquisition module acquires internal image data of the pipeline. By comprehensively analyzing the ultrasonic and image signals, defects in underground pipelines can be detected.
It improves the accuracy and comprehensiveness of defect detection, is applicable to various complex environments, reduces missed detections and false diagnoses, extends pipeline service life, and reduces maintenance costs.
Smart Images

Figure CN122306951A_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of pipeline inspection, specifically relating to a method and system for detecting defects in underground pipelines based on image processing and ultrasonic detection. Background Technology
[0002] With the acceleration of urbanization, underground pipelines play a vital role in urban infrastructure. However, as they age, these pipelines develop defects such as corrosion, cracks, deformation, and blockages, significantly impacting their safe operation and potentially leading to major accidents. Traditional pipeline inspection methods, such as manual inspection and magnetic flux leakage testing, suffer from low efficiency, poor adaptability to complex pipeline structures and materials, and an inability to accurately locate defects. Therefore, there is an urgent need for a more efficient, accurate pipeline defect detection method applicable to various complex environments.
[0003] Ultrasonic testing, as a mature non-destructive testing technology, boasts advantages such as strong penetration, high sensitivity, and accuracy. It can perform detailed inspections of the inner and outer surfaces of pipes, especially for common defects such as cracks, corrosion, and internal wall damage, and has been widely applied in defect detection of materials such as metals and concrete. However, ultrasonic testing alone is insufficient to meet all inspection needs. Image processing, on the other hand, can acquire real-time images of the pipe wall's interior, visually displaying the shape, size, and location of defects, reducing the influence of human factors, and saving images and data from the inspection process. Therefore, pipeline defect detection technology integrating image processing and ultrasonic testing is gaining increasing popularity. Summary of the Invention
[0004] To address the aforementioned problems, the present invention aims to provide a method and system for detecting defects in underground pipelines based on image processing and ultrasonic detection.
[0005] The specific technical solution for achieving the objective of this invention is as follows:
[0006] A method for detecting defects in underground pipelines based on image processing and ultrasonic detection includes the following steps:
[0007] Step 1: Employ an ultrasonic probe to emit ultrasonic signals inside the underground pipeline and acquire the echo signals;
[0008] Step 2: Process and analyze the ultrasonic echo signal to obtain the internal structural characteristics of the underground pipeline;
[0009] Step 3: Obtain image data of the interior of the underground pipeline;
[0010] Step 4: Process and analyze the image data to obtain the surface features of the underground pipeline;
[0011] Step 5: Combine the image and ultrasonic signal analysis results to obtain the final underground pipeline defect detection results.
[0012] The present invention also provides an underground pipeline defect detection system based on image processing and ultrasonic detection that performs the above-described method, including a metal mount, a three-arm mechanical centering structure, multiple rollers, an image acquisition module, an ultrasonic detection module, and a signal processing module;
[0013] The image acquisition module, ultrasonic detection module, and signal processing module are mounted on a metal vehicle. The front and rear sections of the metal vehicle are equipped with a three-arm mechanical centering structure, and the three-arm mechanical centering structure is equipped with rollers to ensure that the system is centered in the underground pipeline to be inspected.
[0014] The image acquisition module includes a camera and a lighting lamp, and the ultrasonic detection module includes an ultrasonic driving circuit, an ultrasonic receiving circuit, and a transceiver probe.
[0015] The signal processing module is used to analyze and process the data collected by the image acquisition module and the ultrasonic detection module to obtain the defect detection results of the underground pipeline.
[0016] Compared with the prior art, the beneficial effects of the present invention are as follows:
[0017] Compared to traditional magnetic flux leakage inspection or manual measurement methods, this solution integrates image processing and ultrasonic detection technologies for pipeline defect detection, which can complement each other's detection capabilities, reduce missed detections and false judgments, and improve the accuracy and comprehensiveness of defect detection.
[0018] This testing technology is not limited by the pipe material and has good adaptability to complex environments; it can perform comprehensive testing on pipes without damaging the pipe structure, thereby extending the service life of pipes and avoiding unnecessary maintenance or replacement costs.
[0019] The present invention will be further described below with reference to specific embodiments. Attached Figure Description
[0020] Figure 1 This is a schematic diagram of the underground pipeline defect detection device based on image processing and ultrasonic detection in an embodiment of the present invention.
[0021] Figure 2 This is a structural diagram of the ultrasonic detection module in an embodiment of the present invention.
[0022] Figure 3 This is a schematic diagram of the process of the underground pipeline defect detection method based on image processing and ultrasonic detection of the present invention.
[0023] Figure 4 This is a schematic diagram of the ultrasonic detection principle in an embodiment of the present invention.
[0024] Figure 5 This is a block diagram illustrating the principle of image processing in an embodiment of the present invention.
[0025] Figure 6 This is a schematic diagram of grayscale transformation in image processing according to an embodiment of the present invention.
[0026] Figure 7 This is a schematic diagram of image denoising in an embodiment of the present invention.
[0027] Figure 8 This is a diagram illustrating the enhanced effect of CLAHE in an embodiment of the present invention.
[0028] Figure 9 This is a schematic diagram of a contrast-enhanced image with gamma correction in an embodiment of the present invention.
[0029] Figure 10 This is a schematic diagram of image sharpening in the image processing of this invention.
[0030] Figure 11 This is a schematic diagram of image segmentation for the image processing of this invention.
[0031] Figure 12 This is a schematic diagram of the image morphology operation of the image processing of the present invention.
[0032] Figure 13 This is a schematic diagram of connected component filtering in the image processing of the present invention.
[0033] Figure 14 This is a schematic diagram of the crack connection in the image processing of this invention. Detailed Implementation
[0034] Example
[0035] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. The described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0036] As indicated in this application and claims, unless the context clearly indicates otherwise, the words "a," "an," "an," and / or "the" do not specifically refer to the singular and may also include the plural. Generally speaking, the terms "comprising" and "including" only indicate the inclusion of explicitly identified steps and elements, which do not constitute an exclusive list, and the method or apparatus may also include other steps or elements.
[0037] Unless otherwise specifically stated, the relative arrangement, numerical expressions, and values of the components and steps described in these embodiments do not limit the scope of this application. It should also be understood that, for ease of description, the dimensions of the various parts shown in the drawings are not drawn to actual scale. Techniques, methods, and devices known to those skilled in the art may not be discussed in detail, but where appropriate, such techniques, methods, and devices should be considered part of the specification. In all examples shown and discussed herein, any specific values should be interpreted as merely exemplary and not as limitations. Therefore, other examples of exemplary embodiments may have different values. It should be noted that similar reference numerals and letters in the following drawings denote similar items; therefore, once an item is defined in one drawing, it need not be further discussed in subsequent drawings.
[0038] Among the many characteristics of image sensors, pixel size and number undoubtedly play a crucial role in defining image resolution. A camera's resolution determines the level of detail in the image it can capture; the smaller the pixel size and the greater the number, the richer the detail in the image, and the higher the resolution. In addition, the dynamic range of the photosensitive element determines the contrast between the brightest and darkest areas the sensor can simultaneously capture, also affecting image sharpness and detail.
[0039] Given the relatively narrow field of view of the pipe interior environment targeted in this embodiment, after comprehensive consideration and selection, an image sensor with high pixel count was ultimately chosen. Each pixel is approximately 1 micrometer in size, with an effective pixel count of 2592×1944, and it supports multiple image output formats.
[0040] Ultrasonic probes perform measurements and imaging by emitting and receiving ultrasonic signals. Their main principle is based on the piezoelectric effect, which converts electrical signals into mechanical waves (ultrasonic waves). These waves are reflected when they encounter different media, and the reflected waves are then received by a receiver and converted back into electrical signals for analysis.
[0041] Ultrasonic waves typically use high-frequency (above 20kHz) sound waves, which are easily absorbed when propagating in air, but propagate better in media such as water or oil. Higher frequencies offer higher resolution, but relatively weaker penetration. Considering the pipe materials, this invention selects a 40kHz ultrasonic probe.
[0042] A schematic diagram of the underground pipeline defect detection system in this embodiment is shown below. Figure 1 As shown, it includes a metal chassis, a three-arm mechanical centering structure, multiple rollers, an image acquisition module, an ultrasonic detection module, and a signal processing module.
[0043] The image acquisition module, ultrasonic detection module, and signal processing module are mounted on a metal chassis. Both the front and rear sections of the metal chassis are equipped with three-arm mechanical centering structures. Rollers are mounted on the three arms of the mechanical centering structure; when pulled, the device moves forward within the pipeline using the rollers. This ensures the system remains centered within the underground pipeline to be inspected.
[0044] Combination Figure 2 The image acquisition module includes a camera and a lighting lamp, and the ultrasonic detection module includes an ultrasonic driving circuit, an ultrasonic receiving circuit, and a transceiver probe.
[0045] The signal processing module is used to analyze and process the data collected by the image acquisition module and the ultrasonic detection module to obtain the defect detection results of the underground pipeline.
[0046] Based on the above system, a method for detecting defects in underground pipelines based on image processing and ultrasonic detection includes the following steps:
[0047] Step 1: Employ an ultrasonic probe to emit ultrasonic signals inside the underground pipeline and acquire the echo signals;
[0048] Once the device is powered, the control module controls the ultrasonic generator to produce ultrasonic waves and simultaneously starts timing. As the ultrasonic signal passes successively through the inner and outer surfaces of the pipe, the change in medium causes discontinuities in the acoustic impedance, resulting in two reflected waves. The signal processing module collects and stores these reflected waves. After the previous ultrasonic signal is emitted and collected, the control module shuts down the ultrasonic generator for a period of time, waiting for other excess reflected waves to disappear, and then begins to emit the next set of ultrasonic signals for data acquisition. After the echo is acquired, the signal is transmitted to the signal processing module.
[0049] After the signal processing module receives the signal, it first performs AD acquisition to convert the analog signal into a digital signal and stores it in the FPGA's DDR3. Then, it uses SPI to transmit the data to the host computer.
[0050] Step 2: Process and analyze the ultrasonic echo signals to obtain the internal structural characteristics of the underground pipeline:
[0051] Let i, r, and t represent the incident wave, reflected wave, and refracted wave, respectively. When ultrasound is incident perpendicularly on a heterogeneous interface, two conditions must be met: the total sound pressure on both sides of the interface is equal, and the velocity amplitude of particles on both sides of the interface is equal.
[0052] P i +P r =P t
[0053] V i +Vr =V t
[0054] Among them, P i =ρ1C1V i =Z1V i P t =ρ2C2V t =Z2V t P r =-ρ1C1V r =-Z1V r ρ is the density of the medium, C is the speed of sound, V is the particle velocity, and Z is the acoustic impedance;
[0055] When ultrasound waves are transmitted from medium 1 into medium 2, an energy change occurs. The energy distribution of ultrasound waves at the heterogeneous interface is typically represented using acoustic intensity reflectivity R and acoustic intensity transmittance T, and acoustic pressure reflectivity r and acoustic pressure transmittance t, respectively, as defined below:
[0056]
[0057] Where I represents sound intensity, P represents sound pressure, Z represents acoustic impedance, and subscripts 1 and 2 represent medium 1 and medium 2;
[0058] This embodiment uses the pulse echo method, which determines the propagation speed of ultrasonic waves in the pipe wall of the underground pipeline under test based on the ultrasonic echo transmission time and the time difference between the initial wave and the echoes of the inner and outer walls, thereby determining the internal structure of the pipe wall.
[0059] Sound pressure reflectivity, sound intensity reflectivity, sound pressure refractive index, and sound intensity refractive index are all directly related to the acoustic impedance of the two media. In actual ultrasonic testing, Z1 < Z2. Part of the sound wave is reflected on the inner wall of the pipe, while the other part passes through the inner wall to the outer wall and is reflected again. After the sensor collects these two echoes, subsequent data analysis can be performed. The echo transmission time, the time difference between the initial wave and the echoes from the inner and outer walls are all recorded. Combined with the propagation speed of ultrasound in the tested pipe wall, the pipe wall thickness can be accurately described. The principle diagram of ultrasonic detection is shown below. Figure 4 As shown in Figure a, d1 and d2 are twice the pipe radius and twice the pipe wall thickness, respectively.
[0060] When there is a collapse or rupture in the pipe wall, the change in ultrasonic wave propagation time and the discontinuity of acoustic impedance cause changes in both the time of receiving the reflected wave and the magnitude of the reflected wave. The schematic diagram of ultrasonic detection is shown below. Figure 4 As shown in b.
[0061] Step 3: Obtain image data of the interior of the underground pipeline;
[0062] Step 4: Process and analyze the image data to obtain the surface features of the underground pipeline, such as... Figure 5 As shown:
[0063] Step 4-1: Convert the image to grayscale:
[0064] α = 0.299R + 0.587G + 0.114B
[0065] Where R, G, and B represent the red, green, and blue channel component values of a pixel at a point in the image, respectively. A grayscale transformed image is shown below. Figure 6 As shown.
[0066] Step 4-2: When acquiring images using image acquisition equipment, a large amount of noise will exist in the image. Therefore, adaptive median filtering is used to denoise the image. The basic idea of traditional median filtering is to sort the gray values of all pixels within the filtering window in ascending order and replace the pixel value of the center point of the window with the pixel in the middle position. The adaptive median filtering algorithm not only retains the function of traditional median filtering, but also can dynamically adjust the size of the filter window, preserving the details of the original image while removing noise.
[0067] For a structuring element with a predefined size of M×N, let the grayscale value at position (x,y) in the image be Z. xy In Sxy, the maximum window size is Smax, and the maximum grayscale value is represented by Z. max The minimum grayscale value is represented by Z. min The median of grayscale is represented by Z. med :
[0068] First, determine the execution process A:
[0069] A1 = Z med -Z min
[0070] A2 = Z med -Z max
[0071] If A1 > 0 and A2 < 0, then proceed to process B; otherwise, increase the window size. If the window size ≤ S max If the result is positive, repeat process A; otherwise, output Z. med ;
[0072] Process B:
[0073] B1 = Z xy -Z min
[0074] B2 = Z xy -Z max
[0075] If B1 > 0 and B2 < 0, then output Z. xy Otherwise, output Z. med .
[0076] The filter window is set to 3x3, and the filtered and denoised image is as follows. Figure 7 As shown.
[0077] Step 4-3: Enhance the filtered image based on the CLAHE algorithm and gamma correction:
[0078] Step 4-3-1: CLAHE is an improved version of the traditional histogram equalization (HE) algorithm. By dividing the image into multiple small regions (called "tiles" or "blocks") and performing histogram equalization within each small region, while limiting excessive contrast enhancement, the image is first divided into multiple non-overlapping tiles.
[0079] Step 4-3-2: Within each tile, calculate its grayscale histogram and perform equalization processing on the histogram of each tile. This makes the pixel grayscale distribution within each tile more uniform, thereby enhancing local contrast.
[0080]
[0081] Where, n k The number of pixels for each gray level, N is the total number of pixels in the tile area, h(k) is the frequency of each gray value, L is the number of gray levels, CDF(k) is the cumulative distribution function, and y(k) is the new gray level mapping range.
[0082] Step 4-3-3, Contrast Limitation: This is a crucial step in the CLAHE algorithm. During histogram equalization, without limitation, the number of pixels at certain gray levels may increase excessively, leading to over-enhanced contrast and amplified noise. To avoid this, the CLAHE algorithm introduces a contrast limiting mechanism. Specifically, a limiting coefficient is set; when the number of pixels at a certain gray level exceeds a certain value, the excess pixels are redistributed to other gray levels.
[0083]
[0084] Where K is the restriction coefficient, T is the grayscale value restriction threshold, Δn is the number of pixels in the histogram that are greater than the grayscale value restriction threshold, and N... a The grayscale value assigned to each point after grayscale value is assigned;
[0085] Step 4-3-4: After processing each tile, since pixels at the tile boundaries may be discontinuous (because each tile undergoes histogram equalization independently), the CLAHE algorithm typically employs bilinear interpolation to make the overall image smoother. Bilinear interpolation is a two-dimensional interpolation method that calculates the pixel values at the boundaries based on the pixel values of the surrounding four tiles, thereby eliminating boundary effects between tiles and making the image appear more natural.
[0086] The boundary effect of tiles is eliminated by processing pixels at the tile boundaries using bilinear interpolation.
[0087] P x (y)=(1-(xi))P ij +(xi)P (i+1)j
[0088] P x (y)=(1-(xi))P i(j+1) +(xi)P (i+1)(j+1)
[0089] P(x,y)=(1-(yj))P x (j)+(yj)P x (j+1)
[0090] Where (i,j), (i+1,j), (i,j+1), and (i+1,j+1) are the coordinates of four adjacent tiles, and the corresponding pixel values are P. ij P (i+1)j P i(j+1) P (i+1)(j+1) ;
[0091] The CLAHE enhancement effect diagram in this embodiment is shown below. Figure 8 As shown;
[0092] Step 4-3-5: Image enhancement based on gamma correction. Gamma transform is a non-linear transformation technique used to adjust image brightness and contrast. It achieves its function by applying a power-law function to the image, transforming a narrow grayscale input range to a wider grayscale range.
[0093] G = c × r γ
[0094] Where c is a coefficient, r represents the pixel value of the input image, and γ is the gamma value.
[0095] Contrast enhancement images based on gamma correction, such as Figure 9 As shown.
[0096] Step 4-4: Sharpen the image based on the unsharpened mask;
[0097] The basic principle of Unsharpened Mask (USM) is as follows: First, a low-pass filter is used to filter the image, resulting in a blurred image; then, the original image is subtracted from the blurred image to obtain a high-frequency residual image; finally, the high-frequency residual image is superimposed on the original image at a certain ratio to obtain the sharpened image. Image sharpening is as follows: Figure 10 As shown.
[0098] Steps 4-5: Use adaptive thresholding to segment the crack contour in the image, obtaining a binary image of the crack on the inner surface of the pipe. Adaptive thresholding is an image segmentation technique that dynamically determines the threshold based on local image characteristics, adjusting the threshold according to the brightness of local areas.
[0099] Step 4-5-1: Divide the image into multiple windows (or local regions), usually square or rectangular areas;
[0100] Step 4-5-2: Within each window, determine the mean or Gaussian weighted mean of the region as a local threshold;
[0101] Step 4-5-3: Apply a local threshold to the pixel at the center of the window. If the value of the pixel is higher than the local threshold, classify it as the target; otherwise, classify it as the background.
[0102] Step 4-5-4: Move the window to the next position in the image. Repeat steps 4-5-2 and 4-5-3 until the entire image has been traversed.
[0103] Steps 4-5-5: Merge all local segmentation results to form the final binary image.
[0104] In this embodiment, the window size is selected as 3x3, and the threshold segmentation image is as follows. Figure 11 As shown.
[0105] Steps 4-6: After preprocessing and threshold segmentation, the inner surface image of the pipe is used to obtain a binary image of the crack on the inner surface of the pipe. Inevitably, some isolated noise points exist in the binary image. In this embodiment, morphological operations are used to remove isolated noise points from the background of the crack binary image:
[0106] First, a dilation operation is used to fill noise points in the cracks and connect potentially broken crack areas. Then, an erosion operation is used to remove noise points from the image. The image after morphological operations in this embodiment is shown below. Figure 12 As shown.
[0107] Steps 4-7: Connected components refer to sets of adjacent pixels in an image that have the same pixel value. The area of a connected component is the number of pixels contained in this set, and it is an important feature describing the size of a target object in the image. Considering that the area of the noise region is much smaller than the area of the crack region, a threshold T is set. s Remove connected components with smaller areas.
[0108] For the image after morphological operations, obtain the feature components of all connected components in the image, and remove connected components that do not meet the threshold conditions by using the area, circularity, and rectangularity of the connected components:
[0109]
[0110] Among them, R c Circularity is a common feature in shape analysis, representing the degree of similarity between the current target region and a circle. The more complex the shape of the target region, the smaller the circularity. r Rectangularity is a shape feature quantity used to measure how similar an object's shape is to a rectangle. The closer the target region's shape is to a rectangle, the greater the rectangularity. S is the area of the target region, and L is the perimeter of the region. r It represents the area of the smallest bounding rectangle of the target region. Cracks are generally elongated structures with relatively small rectangularity. The crack image after connected component filtering is shown below. Figure 13 As shown.
[0111] Steps 4-8: After preprocessing, thresholding, and morphological operations, the cracks in the image have been successfully extracted. However, the extracted cracks often exhibit breakage. Therefore, a crack connection method based on contour analysis is used to connect the broken cracks.
[0112] Step 4-8-1: Connected Component Contour Acquisition. After reading the binary image, the findContours function in the OpenCV image library is used to mark connected components and acquire the contour of each connected component. Marking connected components can distinguish different targets in the image (such as different parts of a fracture crack). Acquiring the contour can further analyze the shape, position and other features of the connected components, and provide data for calculating the distance between contours.
[0113] Step 4-8-2: Calculate the minimum distance between two contours. First, initialize the minimum distance to a large value. Use nested loops to traverse each point on one contour and each point on the other contour. Use the Euclidean distance formula to calculate the distance between the two points and compare it with the minimum distance. If the current distance is smaller, update the minimum distance.
[0114] Step 4-8-4: When the distance is less than a certain threshold, connect the corresponding points with straight lines. When the minimum distance between two contours is less than the set threshold, they are considered to be broken parts, and they are restored to a complete crack by connecting them with straight lines. The crack connection image in this embodiment is as follows. Figure 14 As shown.
[0115] Step 5: By combining the image and ultrasonic signal analysis results, the final underground pipeline defect detection results are obtained:
[0116] In practice, ultrasonic sensors and image sensors are configured to ensure that they can collect data from the same target area, acquire ultrasonic echo data and image data from the same location, and combine the internal structural features detected by ultrasonic waves with the surface features in the image to provide a more comprehensive description of the internal conditions of the pipe.
[0117] The embodiments described above are merely illustrative of several implementation methods of this application, and while the descriptions are relatively specific and detailed, they should not be construed as limiting the scope of the invention patent. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the protection scope of this application. Therefore, the protection scope of this patent application should be determined by the appended claims.
Claims
1. A method for detecting defects in underground pipelines based on image processing and ultrasonic detection, characterized in that, Includes the following steps: Step 1: Employ an ultrasonic probe to emit ultrasonic signals inside the underground pipeline and acquire the echo signals; Step 2: Process and analyze the ultrasonic echo signal to obtain the internal structural characteristics of the underground pipeline; Step 3: Obtain image data of the interior of the underground pipeline; Step 4: Process and analyze the image data to obtain the surface features of the underground pipeline; Step 5: Combine the image and ultrasonic signal analysis results to obtain the final underground pipeline defect detection results.
2. The method for detecting defects in underground pipelines based on image processing and ultrasonic detection according to claim 1, characterized in that, The processing and analysis of the ultrasonic echo signal in step 2 specifically includes: The pulse-echo method is used to determine the propagation speed of ultrasonic waves in the pipe wall of the underground pipeline under test based on the ultrasonic echo propagation time and the time difference between the initial wave and the echoes of the inner and outer walls, thereby determining the internal structure of the pipe wall.
3. The method for detecting defects in underground pipelines based on image processing and ultrasonic detection according to claim 1, characterized in that, The image data in step 4 is processed and analyzed, including: Step 4-1: Convert the image to grayscale: α = 0.299R + 0.587G + 0.114B Where R, G, and B represent the red, green, and blue channel component values of a pixel at a point in the image, respectively; Step 4-2: Denoise the image using adaptive median filtering; Step 4-3: Enhance the filtered image based on the CLAHE algorithm and gamma correction; Step 4-4: Sharpen the image based on the unsharpened mask; Steps 4-5: Use adaptive thresholding to segment the crack contour of the image to obtain a binary image of the crack on the inner surface of the pipe. Steps 4-6: Use morphological operations to remove isolated noise points from the background of the binary image with cracks. First, use the dilation operation to fill the noise points in the cracks and connect the crack areas that may be broken. Then, use the erosion operation to remove the noise points in the image. Steps 4-7: For the image after morphological operations, obtain the feature components of all connected components in the image, and remove connected components that do not meet the threshold conditions by analyzing the area, circularity, and rectangularity of the connected components. Steps 4-8: The crack connection method based on contour analysis connects the fractured cracks.
4. The method for detecting defects in underground pipelines based on image processing and ultrasonic detection according to claim 3, characterized in that, The image denoising process in step 4-2 specifically involves: For a preset structuring element size of M x N, let the gray value at image position (x, y) be Z xy , the maximum window size in Sxy be Smax, the maximum gray value be represented as Z max , the minimum gray value be represented as Z min , and the median value of the gray value be represented as Z med : First, determine the execution process A: A1=Z med -Z min A2=Z med -Z max If A1 > 0 and A2 < 0, then proceed to process B; otherwise, increase the window size. If the window size ≤ S max If the result is positive, repeat process A; otherwise, output Z. med ; Process B: B1=Z xy -WITH min B2=Z xy -Z max If B1 > 0 and B2 < 0, then output Z. xy Otherwise, output Z. med .
5. The method for detecting defects in underground pipelines based on image processing and ultrasonic detection according to claim 3, characterized in that, The image denoising process in step 4-3 specifically involves: Step 4-3-1: Divide the image into multiple non-overlapping tiles; Step 4-3-2: Within each tile, calculate its grayscale histogram and perform histogram equalization on each tile. Where, n k The number of pixels for each gray level, N is the total number of pixels in the tile area, h(k) is the frequency of each gray value, L is the number of gray levels, CDF(k) is the cumulative distribution function, and y(k) is the new gray level mapping range. Step 4-3-3: Set a limit factor. When the number of pixels at a certain gray level exceeds a certain value, the excess pixels will be redistributed to other gray levels. Where K is the restriction coefficient, T is the grayscale value restriction threshold, Δn is the number of pixels in the histogram that are greater than the grayscale value restriction threshold, and N... a The grayscale value assigned to each point after grayscale value is assigned; Step 4-3-4: Process the pixels at the tile boundaries using bilinear interpolation to eliminate tile boundary effects. P x (y)=(1-(x-i))P ij +(x-i)P (i+1)j P x (y)=(1-(x-i))P i(j+1 )+(x-i)P (i+1)(j+1) P(x,y)=(1-(y-j))P x (j)+(y-j)P x (j+1) Where (i,j), (i+1,j), (i,j+1), and (i+1,j+1) are the coordinates of four adjacent tiles, and the corresponding pixel values are P. ij P (i+1)j P i(j+1) P (i+1)(j+1) ; Step 4-3-5: Enhance the image based on gamma correction: G=c×r γ Where c is a coefficient, r represents the pixel value of the input image, and γ is the gamma value.
6. The method for detecting defects in underground pipelines based on image processing and ultrasonic detection according to claim 3, characterized in that, The crack contour segmentation in steps 4-5 specifically involves: Step 4-5-1: Divide the image into multiple windows; Step 4-5-2: Within each window, determine the mean or Gaussian weighted mean of the region as a local threshold; Step 4-5-3: Apply a local threshold to the pixel at the center of the window. If the value of the pixel is higher than the local threshold, classify it as the target; otherwise, classify it as the background. Step 4-5-4: Move the window to the next position in the image. Repeat steps 4-5-2 and 4-5-3 until the entire image has been traversed. Steps 4-5-5: Merge all local segmentation results to form the final binary image.
7. The method for detecting defects in underground pipelines based on image processing and ultrasonic detection according to claim 3, characterized in that, The removal of connected components that do not meet the conditions in steps 4-7 specifically involves: For the image after morphological operations, obtain the feature components of all connected components in the image, and remove connected components that do not meet the threshold conditions by using the area, circularity, and rectangularity of the connected components: Among them, R c R represents roundness. r Represents the rectangularity, where S is the area of the target region and L is the perimeter of the region. r It is the area of the smallest bounding rectangle of the target region.
8. The method for detecting defects in underground pipelines based on image processing and ultrasonic detection according to claim 3, characterized in that, Connecting the fractured cracks in steps 4-8 specifically involves: Step 4-8-1: Connected component contour acquisition. After reading the binary image, use the findContours function to mark connected components and obtain the contour of each connected component. Step 4-8-2: Calculate the minimum distance between two contours. First, initialize the minimum distance to a large value. Use nested loops to traverse each point on one contour and each point on the other contour. Use the Euclidean distance formula to calculate the distance between the two points and compare it with the minimum distance. If the current distance is smaller, update the minimum distance. Step 4-8-4: When the distance is less than a certain threshold, connect the corresponding points with straight lines. When the minimum distance between two contours is less than the set threshold, they are considered to be broken parts, and they are restored to a complete crack by connecting them with straight lines.
9. A defect detection system for underground pipelines based on image processing and ultrasonic detection, used to perform the method of claim 1, characterized in that, It includes a metal chassis, a three-arm mechanical centering structure, multiple rollers, an image acquisition module, an ultrasonic detection module, and a signal processing module; The image acquisition module, ultrasonic detection module, and signal processing module are mounted on a metal vehicle. The front and rear sections of the metal vehicle are equipped with a three-arm mechanical centering structure, and the three-arm mechanical centering structure is equipped with rollers to ensure that the system is centered in the underground pipeline to be inspected. The image acquisition module includes a camera and a lighting lamp, and the ultrasonic detection module includes an ultrasonic driving circuit, an ultrasonic receiving circuit, and a transceiver probe. The signal processing module is used to analyze and process the data collected by the image acquisition module and the ultrasonic detection module to obtain the defect detection results of the underground pipeline.