A method and system for detecting defects in drainage pipes based on image processing
By extracting the central skeleton line of the highlight on the surface of the drainage pipe, generating the cross-sectional line and performing Gaussian fitting, a flattening factor is constructed, which solves the problem of difficulty in quantifying the three-dimensional flattening deformation of flexible drainage pipes in the existing technology, and improves the reliability and accuracy of detection.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- SHAANXI RUNZE BROSE TECH CO LTD
- Filing Date
- 2026-03-23
- Publication Date
- 2026-05-26
AI Technical Summary
Existing technologies struggle to effectively decouple and quantify the three-dimensional flattening deformation of flexible drainage pipes from weak two-dimensional grayscale features, resulting in insufficient reliability and accuracy in defect detection.
By acquiring images of the drainage pipe surface, extracting the highlight center skeleton line, generating a cross-sectional line perpendicular to the skeleton line, using Gaussian function fitting to obtain the light band width and kurtosis coefficient, constructing a flattening factor, and combining a weighted summation method to identify defect points.
It significantly improves the robustness and accuracy of defect detection in black light-absorbing tubes, reduces the false positive rate, and achieves effective decoupling of three-dimensional deformation information.
Smart Images

Figure CN121883499B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of image processing technology. More specifically, this invention relates to a method and system for detecting defects in drainage pipes based on image processing. Background Technology
[0002] In modern production processes such as automobile manufacturing and home appliance assembly, rubber drain pipes are key components for fluid transmission, and their installation quality directly affects the performance and safety of the entire product. However, due to the softness, high elasticity, and small diameter of rubber pipes, they are prone to unexpected flattening deformation in certain areas during manual installation or automatic handling by robotic arms. This deformation can lead to uncontrolled external pressure or excessively sharp bending angles in the wiring. Such deformation not only reduces the effective cross-sectional area of the pipe, severely affecting fluid flow efficiency, but may also cause long-term stress concentration due to local morphological changes, potentially leading to serious quality accidents such as pipe wall rupture and leakage.
[0003] Currently, the detection of flattened defects in drainage pipes mainly relies on manual visual inspection at the end of the production line. However, the rubber pipe body is usually made of black light-absorbing material, and the small cross-sectional collapse or flattening features are not visually obvious and are often submerged in complex background noise, resulting in a high rate of missed detection by manual inspection, making it difficult to meet the quality control requirements of zero defects.
[0004] Since flattening defects are essentially geometric changes in the three-dimensional cross-section of a pipeline, evolving from a circle to a flat shape, in the monocular two-dimensional imaging systems commonly used in industrial settings, this collapse in the depth direction is only manifested as a slight difference in pixel grayscale values. Existing machine vision technology struggles to effectively capture and decouple the three-dimensional deformation information from these low-contrast two-dimensional image features, thus failing to accurately distinguish between normal pipelines and flattened pipelines, seriously affecting the reliability of defect detection. Summary of the Invention
[0005] To address the technical problem that existing monocular vision systems struggle to effectively decouple and quantify the three-dimensional flattening deformation of flexible pipelines from weak two-dimensional grayscale features, this invention provides solutions in the following aspects.
[0006] In a first aspect, the present invention provides a drainage pipe defect detection method based on image processing, comprising: acquiring a surface image of a drainage pipe and extracting a highlight center skeleton line of a highlight region in the image; selecting multiple sampling points along the skeleton line; generating a cross-sectional line perpendicular to the center skeleton line at each sampling point, and extracting multiple offsets relative to the sampling point at a fixed sampling interval on the cross-sectional line, determining the coordinates of each offset based on linear vector operations; extracting the gray values corresponding to the coordinates of all offsets to form cross-sectional data; performing Gaussian function model fitting based on the cross-sectional data of each sampling point to obtain the optimal standard deviation; calculating the light band width of each sampling point based on the optimal standard deviation; determining the kurtosis coefficient of each sampling point based on the distribution characteristics of the gray values of all offsets on the cross-sectional line of each sampling point; weighted summing the light band width and the kurtosis coefficient to obtain the flattening factor of each sampling point; and marking the sampling point as a drainage pipe defect point in response to the flattening factor of the sampling point being greater than a set threshold.
[0007] This invention ensures that the detection direction strictly corresponds to the direction of pipeline geometric deformation by extracting the highlight skeleton line and generating the cross-sectional line along the normal. It uses Gaussian fitting to obtain the light band width and quantitatively characterizes the degree of reflected light divergence caused by flattening. It introduces kurtosis coefficient to capture the sharp or flat-top features of the cross-sectional grayscale distribution, making up for the limitations of a single index in severe flattening. By constructing a flattening factor through weighted fusion, it effectively decouples three-dimensional deformation information from the low-contrast two-dimensional grayscale image, significantly improving the robustness and accuracy of black light-absorbing pipeline defect detection.
[0008] Preferably, the step of acquiring the surface image of the drain pipe and extracting the highlight center skeleton line of the highlight region in the image includes: performing grayscale processing on the surface image of the drain pipe to obtain a grayscale image; performing a high-hat transformation on the grayscale image using a 15×15 circular structuring element to obtain a preprocessed image; performing Otsu thresholding on the preprocessed image to obtain a binary image; and extracting the highlight center skeleton line in the binary image using the Zhang-Suen thinning algorithm.
[0009] Preferably, the plurality of sampling points are obtained by sampling along the central skeleton line at intervals of... Each pixel is obtained by selecting one sampling point, where This is the preset sampling step size.
[0010] Preferably, generating a cross-sectional line perpendicular to the central skeleton line at each sampling point includes:
[0011] Calculate the difference in coordinates of adjacent sampling points in each direction to obtain the tangent vector of each sampling point; rotate the tangent vector counterclockwise by 90 degrees and normalize it to obtain the unit normal vector; generate a length of [missing information] along the direction of the unit normal vector, centered on each sampling point. The cross-sectional line; where This is 1.2 times the average pixel diameter of the drain pipe. 1.5 times.
[0012] Preferably, the coordinates of each offset satisfy the expression: In the formula, , For the first The sampling point of the first sampling point The offset is in The coordinates in the axial direction and in Coordinates along the axis; , For the first Each sampling point is at The coordinates in the axial direction and in Coordinates along the axis; , For the first The unit normal vector at each sampling point is The value of the axis direction and in Values are taken in the axial direction; For the first The sampling point of the first sampling point One offset; The rounding up symbol.
[0013] This invention uses vector projection operations and rounding to accurately map the theoretical sampling position to the discrete pixel coordinates of the image, ensuring that the spatial position of the extracted cross-sectional grayscale data is strictly perpendicular to the skeleton line, thus guaranteeing the geometric accuracy of feature extraction.
[0014] Preferably, the step of fitting a Gaussian function model based on the cross-sectional data of each sampling point to obtain the optimal standard deviation includes: constructing a Gaussian function model: ,in, The theoretical grayscale value fitted for each offset; The value is set for the offset. High light intensity; , The center offset and standard deviation of the Gaussian distribution; The background is grayscale noise; all offsets of the sampling point are used as independent variables and the corresponding grayscale values are used as dependent variables; the Gaussian function model is fitted and solved using a nonlinear least squares algorithm to obtain the optimal standard deviation.
[0015] Preferably, the light band width of each sampling point satisfies the expression: In the formula, For the first The width of the light band at each sampling point; For the first The optimal standard deviation obtained by fitting the sample points.
[0016] This invention is based on the FWHM principle in physical optics, which transforms the standard deviation of Gaussian fitting into an intuitive light band width index, and can accurately quantify the degree of reflective area diffusion caused by pipe flattening.
[0017] Preferably, the kurtosis coefficient of each sampling point satisfies the expression: In the formula, For the first Kuness coefficient of each sampling point; For the first The sampling point of the first sampling point Each offset corresponds to a grayscale value; For the first The mean of the gray values corresponding to all offsets of each sampling point; , This represents the index value and number of the offset points.
[0018] This invention introduces kurtosis from statistics. By analyzing the higher-order moment characteristics of gray-scale distribution, it can sensitively capture the steepness of light intensity distribution and effectively identify the flat-top or bimodal waveform characteristics that appear when the image is severely compressed.
[0019] Preferably, the flattening factor of each sampling point satisfies the expression: In the formula, For the first The flattening factor of each sampling point; For the first The width of the light band at each sampling point; This represents the maximum value of the light band width across all sampling points; For the first Kuness coefficient of each sampling point; It is the maximum-minimum normalization function; These are the weighting coefficients.
[0020] This invention constructs a unified flattening factor by using a weighted summation method, which realizes the feature fusion of light band width and kurtosis coefficient, overcomes the limitations of a single index, and improves the robustness of detecting flattening defects of different degrees.
[0021] Secondly, the present invention provides a drainage pipe defect detection system based on image processing, including a processor and a memory, wherein the memory stores computer program instructions, and when the computer program instructions are executed by the processor, the above-mentioned drainage pipe defect detection method based on image processing is implemented.
[0022] By adopting the above technical solution, a computer program is generated from the above-mentioned image processing-based drainage pipe defect detection method and stored in the memory so that it can be loaded and executed by the processor. In this way, a terminal device can be made based on the memory and the processor for convenient use.
[0023] The beneficial effects of this invention are as follows:
[0024] (1) The present invention calculates the tangent vector and generates the normal cross-section line by using the central difference method, which not only suppresses the direction error caused by single pixel jitter, but also avoids the circle cutting effect caused by excessive span, ensuring that the cross-section analysis is strictly perpendicular to the pipeline axis, and improving the geometric accuracy of feature extraction.
[0025] (2) This invention utilizes the stable physical law that the reflection of round tubes is thin and sharp, while the reflection of flat tubes is wide and flat. By analyzing the cross-sectional light and shadow characteristics through Gaussian fitting, the subjective visual perception of flattening is transformed into objective data on light band width and kurtosis coefficient. A deformation-light and shadow mapping model is established, which greatly reduces the misjudgment rate. Attached Figure Description
[0026] Figure 1 This is a flowchart illustrating an image processing-based method for detecting defects in drainage pipes according to the present invention.
[0027] Figure 2 This is a schematic representation of the original grayscale image of the drain pipe;
[0028] Figure 3 This is a schematic diagram showing the trend of characteristic indicators extracted along the drainage pipe skeleton. Detailed Implementation
[0029] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of the present invention. 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.
[0030] The specific embodiments of the present invention will now be described in detail with reference to the accompanying drawings.
[0031] This invention discloses an image processing-based method for detecting defects in drainage pipes, referring to... Figure 1 This includes steps S1-S5:
[0032] S1. Obtain an image of the surface of the drain pipe and extract the highlight center skeleton line of the highlight area in the image.
[0033] It should be noted that, according to the Fresnel reflection principle, when a smooth cylindrical surface is illuminated by a light source, the area where its normal bisects the incident light and the line of sight will form a bright reflective band. This reflective band geometrically corresponds precisely to the highest ridge line of the pipe surface, i.e., the generatrix of the cylindrical surface. Therefore, it is necessary to first filter out the low-frequency interference in the background, retain only the high-frequency reflective features, and extract the center line of this reflective band to provide data for subsequent cross-sectional analysis.
[0034] Specifically, at the drainage pipe inspection station, an industrial camera and a uniform light source are set up to acquire images of the drainage pipe surface. The acquired images are then converted to grayscale to obtain grayscale images. A top-hat transform is used to preprocess the grayscale images to suppress uneven background illumination. Otsu thresholding is then applied to the preprocessed images to obtain binary images, which are used to extract reflective areas. The Zhang-Suen thinning algorithm is further used to iteratively erode the binary images until the texture is stripped down to a single-pixel-width central skeleton line, obtaining the highlight central skeleton line and all pixels on the skeleton. Simultaneously, the positions of the pixels on the skeleton need to be obtained. Specifically, the position of each pixel on the skeleton is determined by using the pixel at the bottom left corner of the image as the origin, and defining the horizontal direction to the right from the origin as... The positive direction of the axis is defined by taking the vertically upward direction from the origin as... The positive direction of the axis is used to construct a Cartesian coordinate system; the position of each pixel on the skeleton is obtained in the Cartesian coordinate system, including... Coordinates in the axial direction and Coordinates along the axis.
[0035] It should be added that the top hat transformation, Otsu threshold segmentation, and Zhang-Suen refinement algorithm are well-known technologies and will not be described in detail here. In this embodiment of the invention, the structural element of the top hat transformation is a 15×15 circle, which can be adjusted by the implementer according to the actual pipeline design parameters.
[0036] At this point, the highlight center skeleton line of the drainage pipe has been obtained.
[0037] S2. Select multiple sampling points along the skeleton line; generate a cross-sectional line perpendicular to the central skeleton line at each sampling point, and extract multiple offsets relative to the sampling point on the cross-sectional line at a fixed sampling interval. Determine the coordinates of each offset based on the linear operation of the vector; extract the gray values corresponding to the coordinates of all offsets to form cross-sectional data.
[0038] It should be noted that the flattening deformation of the pipeline is local, and the flattening feature of the cross-section after flattening is usually perpendicular to the pipeline direction. In order to assess whether such deformation exists, it is necessary to analyze along the cross-section of the pipeline. In the two-dimensional image, this cross-section corresponds to the normal direction of a certain point on the skeleton line. Since the obtained skeleton line is a discrete pixel, the geometric direction cannot be obtained directly by differentiation. Therefore, it is necessary to introduce the central difference method to approximate the calculation of the tangent vector, use a larger neighborhood range to smooth the noise, and then derive the normal vector to ensure that the subsequent cut surface is strictly perpendicular to the pipeline axis.
[0039] Specifically, the preset sampling step size is... , It must be greater than the single-pixel jitter range to avoid abrupt changes in tangent direction caused by the digital raster effect; at the same time The radius of curvature must be less than one-tenth of the pipe's bending radius to avoid the loss of bending characteristics due to the tangent-circle cut effect caused by excessive span. In this embodiment of the invention, considering both pipe curvature and image noise, a preferred selection is... Take 5; the implementers can adjust this according to the actual testing requirements. It should be added that for insufficient start and end points of the skeleton line... For each step length of the endpoint region, the nearest neighbor interpolation method is used for vector filling, that is, the tangent vector and normal vector of the nearest valid sampling point are directly used to ensure the integrity and continuity of the detection data of the entire skeleton line.
[0040] Traverse the set of points representing the skeleton of the highlight center, selecting a sampling point at every sampling step. Based on the coordinate differences between adjacent sampling points, determine the tangent vector at each sampling point; the tangent vector satisfies the expression:
[0041]
[0042] In the formula, For the first The tangent vector at each sampling point; , For the first on the skeleton line Pixels in The coordinates in the axial direction and in Coordinates along the axis; , For the first on the skeleton line Pixels in The coordinates in the axial direction and in Coordinates along the axis.
[0043] in, Utilizing the front and back Difference is performed on pixels with a step size, which effectively suppresses the orientation error caused by single-pixel jitter compared to directly using adjacent points.
[0044] Considering that the normal vector and tangent vector are perpendicular in a two-dimensional plane, meaning their dot product is zero, we rotate the tangent vector at each sampling point counterclockwise by 90 degrees to obtain the normal vector at that sampling point, and then normalize it to obtain the unit normal vector. , In the formula, For the first Unit normal vector at each sampling point; , For the first The tangent vector at each sampling point The value of the axis direction and in The value of the axis direction is, where, , When there is and When both are 0, the unit normal vector of the sampling point is .
[0045] Furthermore, with the first Centered on each sampling point, a line of length is generated along the unit normal vector direction. The cross-sectional line is obtained, and samples are extracted relative to the first cross-section at fixed sampling intervals. Multiple offsets for each sampling point, i.e. One offset; in this embodiment, the preferred sampling interval is 1 pixel, which can be adjusted by the implementer according to the actual specified length of the cross-section line.
[0046] For each offset, its coordinates are determined using linear operations on the vectors; the coordinates satisfy the expression:
[0047]
[0048] In the formula, , For the first The sampling point of the first sampling point The offset is in The coordinates in the axial direction and in Coordinates along the axis; , For the first Each sampling point is at The coordinates in the axial direction and in Coordinates along the axis; , For the first The unit normal vector at each sampling point is The value of the axis direction and in Values are taken in the axial direction; For the first The sampling point of the first sampling point One offset; The rounding up symbol.
[0049] in, Reflecting the The sampling point of the first sampling point The offset is in Projection components along the axial direction; Representing the The sampling point of the first sampling point The theoretical coordinates of each offset in the original image coordinate system; since the calculated coordinates may be located at non-integer positions in the image pixel grid, in order to accurately obtain the light intensity information at this position, the calculated non-integer coordinates are converted into integer coordinates by rounding, thereby determining the corresponding pixel position.
[0050] It should be added that, The pipe diameter needs to be covered. If it is too small, the wide reflective band may be truncated, affecting the fitting accuracy; if If the diameter is too large, it may introduce interference from other workpieces in the background; by obtaining the current camera resolution and object distance, the cross-sectional diameter of the pipe in the image is calculated to be 40-45 pixels, and then set... This is 1.2 times the average pixel diameter of the drain pipe. To avoid affecting the subsequent fitting quality, the ratio is 1.5 times; therefore, in this embodiment of the invention, The resolution is set to 60 pixels, but the operator can adjust it according to the actual testing requirements.
[0051] Iterate through the coordinates of all offsets on the cross-sectional line of each sampling point, extract the corresponding grayscale values, and construct the cross-sectional data.
[0052] At this point, the cross-sectional data for each sampling point has been obtained.
[0053] S3. Fit a Gaussian function model based on the cross-sectional data of each sampling point to obtain the optimal standard deviation; calculate the light band width of each sampling point based on the optimal standard deviation.
[0054] It should be noted that for a standard circular cross-section pipe, its surface curvature is large, resulting in strong reflective focusing ability and an intensity cross-section that approximates a sharp Gaussian distribution. When the pipe is flattened, the radius of curvature of the cross-section increases, and the surface becomes flatter, causing reflected light to scatter in all directions, resulting in a wider and gentler intensity cross-section. Therefore, the standard parameter FWHM (Full Width at Half Maximum), which describes the peak width in physics, is introduced as a quantitative indicator to measure the degree of diffusion in the core area of the reflective band. According to the characteristics of the Gaussian function, FWHM has a linear relationship with the standard deviation, and FWHM... This parameter accurately reflects the diffusion level of the core area of the reflective strip and is insensitive to substrate noise.
[0055] Specifically, construct the Gaussian function model: ,in, The theoretical grayscale value fitted for each offset; The value is set for the offset. High light intensity; , The center offset and standard deviation of the Gaussian distribution; This represents the background grayscale noise.
[0056] For each sampling point, perform the following sub-steps:
[0057] Using all offsets of the sampling point as independent variables and the corresponding gray values as dependent variables, the Gaussian function model is fitted and solved using a nonlinear least squares algorithm. The optimal parameter set for the sampling point is obtained by minimizing the sum of squared residuals between the gray values and the theoretical gray values as the objective function. .
[0058] The optimal standard deviation obtained based on the sampling point fitting Calculate the light band width at this sampling point. , Among these factors, since the full width at half-wave is positively correlated with the radius of curvature of the pipe cross-section, the more the light converges when the pipe cross-section is circular (i.e., the greater the curvature), the more concentrated the light becomes. A smaller value leads to a decrease in the light band width; when the tube is flattened, i.e., the curvature decreases and tends to be planar, the light diverges, causing... The increase is significant, resulting in a significant increase in the optical band width.
[0059] At this point, the light band width of each sampling point has been obtained.
[0060] S4. Determine the kurtosis coefficient of each sampling point based on the distribution characteristics of the gray values of all offsets on the cross-sectional line of each sampling point.
[0061] It should be noted that when the flattening is extremely severe, the top of the pipe becomes completely flat and no longer reflects light. The reflective band may split into two thin lines on both sides. At this time, the fitted Gaussian width may not be large, but the cross-sectional shape has undergone a qualitative change. To avoid missing this situation, it is necessary to analyze the steepness of the distribution pattern of the cross-sectional grayscale data. The waveform corresponding to a normal circular cross-section should be pointed, while the flattened cross-section will have a flat top or double peak characteristics. Therefore, kurtosis information is introduced to capture waveform characteristics, thereby improving the identification accuracy of various flattening defects.
[0062] Specifically, for each sampling point, the kurtosis coefficient of that sampling point is determined based on the distribution characteristics of the gray values of all offsets on the cross-sectional line of that sampling point; the kurtosis coefficient satisfies the expression:
[0063]
[0064] In the formula, For the first Kuness coefficient of each sampling point; For the first The sampling point of the first sampling point Each offset corresponds to a grayscale value; For the first The mean of the gray values corresponding to all offsets of each sampling point; , The index value and number of the offset of the sampling points; This is to bring the kurtosis baseline of the normal distribution to zero.
[0065] in, Represents the fourth-order central moment. The fourth central moment represents the square of the second central moment; it is used to measure the thickness of the tail and the sharpness of the peak of the gray value distribution curve. The physical mapping relationship is as follows: when When the value is positive and relatively large, it indicates that the first... The grayscale value distribution corresponding to all offsets at each sampling point is a sharp single peak. At this point, the waveform is sharper than a standard Gaussian curve, meaning the reflected light converges into an extremely thin bright line. This indicates that the current sampling point may be located in a region with a rounded cross-section and concentrated reflection. When the value is negative and the larger the absolute value, the more significant the negative value. The distribution of gray values corresponding to all offsets at a sampling point is either flat-topped or bimodal, with the data distribution spreading to both sides. This means that the more pronounced the flat-topped or bimodal feature of the cross-section corresponding to the current sampling point, the more severe the flattening defect. It should be noted that when the gray values corresponding to all offsets on the cross-section are the same (i.e., the denominator of the formula is 0), the gray-level distribution of that cross-section does not have a peak shape, and the kurtosis coefficient can be used. Define it directly as 0.
[0066] At this point, the kurtosis coefficient of each sampling point has been obtained.
[0067] S5. The light band width and kurtosis coefficient are weighted and summed to obtain the flattening factor of each sampling point; in response to the flattening factor of the sampling point being greater than the set threshold, the sampling point is marked as a drainage pipe defect point.
[0068] It should be noted that different types of pipelines have different flattening sensitivities. For example, width is sensitive to flattening, and kurtosis is sensitive to flattening. In order to achieve robust detection of different degrees of flattening, the two need to be weighted and fused to construct a unified index that can comprehensively characterize the degree of deformation of the pipeline cross section, effectively overcoming the limitations of a single index under a specific flattening morphology.
[0069] Specifically, the bandwidth and kurtosis coefficient of each sampling point are weighted and summed to obtain the flattening factor for that sampling point; the flattening factor satisfies the expression:
[0070]
[0071] In the formula, For the first The flattening factor of each sampling point; For the first The width of the light band at each sampling point; This represents the maximum value of the light band width across all sampling points; For the first Kuness coefficient of each sampling point; It is the maximum-minimum normalization function; These are the weighting coefficients.
[0072] in, The larger the value, the wider the light band at the sampling point, that is, the higher the degree of light diffusion, and the more severe the flattening deformation of the corresponding pipeline; The smaller the value, the more the light intensity distribution at the sampling point tends to be flat-topped or bimodal, that is, deviating from the standard circular single-peak characteristic, and the more significant the flattening defect characteristics of the corresponding pipeline; in summary, if The larger and The larger the value, the greater the likelihood of a flattening defect at that sampling point, and the higher the overall risk.
[0073] In this embodiment of the invention, since the width feature is most commonly found in cases of slight to moderate flattening, it is given a higher weight, while kurtosis is mainly used to correct for bimodal anomalies caused by severe flattening, serving as an auxiliary criterion. Therefore, in this embodiment of the invention... The implementers can adjust the process according to actual testing preferences.
[0074] Furthermore, a preset judgment threshold is established. Iterate through the flattening factor of each sampling point on the pipeline skeleton. If there are adjacent sampling points whose flattening factors are all greater than 1, then... If the sampling point is found to have a flattening defect, the defect signal is marked.
[0075] The specific value of the preset judgment threshold can be set according to the actual application scenario and needs. In this invention, the judgment threshold is set to 0.75.
[0076] For example, Figure 2 The image shows the original grayscale image of the drainage pipe, where the horizontal axis represents the image length in pixels and the vertical axis represents the image width in pixels. Within the range of approximately 530 to 630 pixels on the horizontal axis, there is a significant local flattening defect at the bend of the pipe, which manifests as a widening of the pipe and a change in the shape of its reflective features.
[0077] Figure 3 This is a trend chart of the feature indicators extracted along the drainage pipe skeleton. The horizontal axis represents the image length, the left vertical axis represents the light band width, and the right vertical axis represents the kurtosis. In the range of approximately 530 to 600 on the horizontal axis, the light band width curve shows a sharp upward trend and reaches a peak. At this point, the kurtosis coefficient curve drops sharply and shows a negative minimum value, indicating that the reflective band is extremely diffuse and the light intensity distribution has a flat-top or bimodal shape, which is judged as a severe flattening defect. Similarly, in the range of approximately 120 to 150 on the horizontal axis, the light band width curve shows an abnormal peak, and the kurtosis coefficient shows a trough, indicating that there is also a local deformation or reflective anomaly at this location. In the normal straight pipe area, the light band width remains at a low and stable level, and the kurtosis coefficient remains at a high positive level, verifying that the method can effectively distinguish between circular cross sections and flattened cross sections by using the light band width and kurtosis indicators.
[0078] This invention also discloses an image processing-based drainage pipe defect detection system, including a processor and a memory. The memory stores computer program instructions, which, when executed by the processor, implement an image processing-based drainage pipe defect detection method according to the present invention.
[0079] The system also includes other components well known to those skilled in the art, such as communication buses and communication interfaces, the settings and functions of which are known in the art and will not be described in detail here.
Claims
1. A method for sewer defect detection based on image processing, characterized in that, include: Acquire an image of the surface of the drain pipe and extract the highlight center skeleton line of the highlight area in the image; Multiple sampling points are selected along the skeleton line; a cross-sectional line perpendicular to the central skeleton line is generated at each sampling point, and multiple offsets relative to the sampling point are extracted on the cross-sectional line at a fixed sampling interval. The coordinates of each offset are determined according to the linear operation of the vector; the gray values corresponding to the coordinates of all offsets are extracted to form cross-sectional data. A Gaussian function model is fitted based on the cross-sectional data of each sampling point to obtain the optimal standard deviation; the optical band width of each sampling point is calculated based on the optimal standard deviation; the optical band width of each sampling point satisfies: ; In the formula, is the light bandwidth of the first sampling point; is the light bandwidth of the second sampling point; is the light bandwidth of the first sampling point; is the optimal standard deviation obtained by fitting the first sampling point and the second sampling point. Based on the distribution characteristics of the gray values of all offsets on the cross-sectional line of each sampling point, determine the kurtosis coefficient of each sampling point; The light band width and kurtosis coefficient are weighted and summed to obtain the flattening factor of each sampling point; in response to the flattening factor of an adjacent sampling point being greater than a set threshold, the sampling point is marked as a drainage pipe defect point.
2. The method for detecting defects in drainage pipes based on image processing according to claim 1, characterized in that, The step of acquiring an image of the drain pipe surface and extracting the highlight center skeleton line of the highlight area in the image includes: The surface image of the drainage pipe is processed into a grayscale image. A 15×15 circular structuring element is used to perform a high-hat transformation on the grayscale image to obtain a preprocessed image. The preprocessed image is then segmented using Otsu thresholding to obtain a binary image. The Zhang-Suen thinning algorithm is used to extract the highlight center skeleton line from the binary image.
3. The method for detecting defects in drainage pipes based on image processing according to claim 1, characterized in that, The plurality of sampling points are obtained by sampling along the central skeleton line at intervals of... Each pixel is obtained by selecting one sampling point, where This is the preset sampling step size.
4. The method for detecting defects in drainage pipes based on image processing according to claim 1, characterized in that, The step of generating a cross-sectional line perpendicular to the central skeleton line at each sampling point includes: Calculate the difference in coordinates of adjacent sampling points in each direction to obtain the tangent vector of each sampling point; rotate the tangent vector counterclockwise by 90 degrees and normalize it to obtain the unit normal vector; generate a vector of length [missing information] along the direction of the unit normal vector, centered on each sampling point. The cross-sectional line; where This is 1.2 times the average pixel diameter of the drain pipe. 1.5 times.
5. The method for detecting defects in drainage pipes based on image processing according to claim 1, characterized in that, The coordinates of each offset satisfy the expression: ; In the formula, , For the first The sampling point of the first sampling point The offset is in The coordinates in the axial direction and in Coordinates along the axis; , For the first Each sampling point is The coordinates in the axial direction and in Coordinates along the axis; , For the first The unit normal vector at each sampling point is The value of the axis direction and in Values are taken in the axial direction; For the first The sampling point of the first sampling point One offset; The rounding up symbol.
6. The method for detecting defects in drainage pipes based on image processing according to claim 1, characterized in that, The process of fitting a Gaussian function model to obtain the optimal standard deviation based on the cross-sectional data of each sampling point includes: Constructing a Gaussian function model: ,in, The theoretical grayscale value fitted for each offset; The value is set for the offset. High light intensity; , The center offset and standard deviation of the Gaussian distribution; The background is grayscale noise; all offsets of the sampling point are used as independent variables and the corresponding grayscale values are used as dependent variables; the constructed Gaussian function model is fitted and solved using a nonlinear least squares algorithm to obtain the optimal standard deviation.
7. The method for detecting defects in drainage pipes based on image processing according to claim 1, characterized in that, The kurtosis coefficient of each sampling point satisfies the expression: ; In the formula, For the first Kuness coefficient of each sampling point; For the first The sampling point of the first sampling point Each offset corresponds to a grayscale value; For the first The mean of the gray values corresponding to all offsets of each sampling point; , This represents the index value and number of the offset of the sampling points.
8. The method for detecting defects in drainage pipes based on image processing according to claim 1, characterized in that, The flattening factor of each sampling point satisfies the expression: ; In the formula, For the first The flattening factor of each sampling point; For the first The width of the light band at each sampling point; This represents the maximum value of the light band width across all sampling points; For the first Kuness coefficient of each sampling point; It is the maximum-minimum normalization function; These are the weighting coefficients.
9. A drainage pipe defect detection system based on image processing, characterized in that, include: A processor and a memory, the memory storing computer program instructions that, when executed by the processor, implement a drainage pipe defect detection method based on image processing according to any one of claims 1-8.