Pipeline crack extraction method and system based on machine vision

By using machine vision-based methods to preprocess images, detect and refine boundaries of pipe cracks, calculate geometric parameters and convert them into physical dimensions, and generate standardized inspection reports, the problem of inaccurate and unreliable pipe crack measurement is solved, achieving high-precision crack detection and assessment.

CN121724910APending Publication Date: 2026-03-24JINAN HEATING POWER ENG CO +2
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202511745572.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-11-26
Publication Date
2026-03-24

AI Technical Summary

Technical Problem

In existing technologies, the geometric feature parameters of pipe cracks are not accurately measured, and the quantitative evaluation results have low reliability. In particular, when factors such as changes in lighting and contamination of the pipe surface interfere, traditional methods are unable to capture sub-pixel level boundary details and lack a reliable and accurate mapping between the image coordinate system and the physical coordinate system.

Method used

A machine vision-based approach is adopted to acquire pipeline surface image data, perform preprocessing, boundary detection and screening, refine the boundary point positions, calculate geometric parameters and perform physical size conversion, generate a standardized inspection report, and evaluate it in conjunction with the measurement accuracy identification code.

Benefits of technology

It achieves sub-pixel-level precise positioning of crack boundaries, solves the problem of inaccurate mapping between image features and physical dimensions, improves measurement accuracy and the reliability of detection results, and provides a scientific basis for pipeline safety operation and maintenance.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121724910A_ABST
    Figure CN121724910A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of machine vision, and discloses a pipeline crack extraction method and system based on machine vision, and the method comprises the steps: obtaining the original image data of the surface of a pipeline; performing preprocessing, boundary detection processing and boundary point position refining processing according to the original image data to obtain crack boundary contour curve fitting data; according to the fracture boundary contour curve fitting data, geometric parameter calculation and physical size conversion are carried out, and fracture geometric characteristic parameters of the physical size are obtained; and according to the geometrical characteristic parameters of the crack, carrying out precision evaluation, constructing a structured data format and judging the danger degree of the crack to obtain a quantitative evaluation result. According to the method, accurate measurement and quantitative evaluation of the pipeline crack can be realized.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of machine vision technology, and in particular to a method and system for extracting pipe cracks based on machine vision. Background Technology

[0002] Currently, pipeline infrastructure serves as the lifeline of modern industry and urban operations, and its safety status directly impacts production efficiency and public safety. Pipeline cracks, as the most common and highly dangerous type of defect, can lead to serious accidents if they propagate; therefore, accurate detection and quantitative assessment of pipeline cracks are of paramount importance.

[0003] In existing technologies, pipeline crack detection primarily relies on manual visual inspection and simple measuring tools, or employs automated visual inspection techniques to identify cracks. However, these methods struggle to guarantee the reliability and consistency of detection results when faced with interference from multiple factors such as changes in lighting, pipeline surface contamination, and limitations in inspection angles. Particularly when crack boundaries are blurred or irregular in shape, traditional pixel-level edge detection methods struggle to capture sub-pixel-level boundary details. More critically, these techniques lack a reliable and precise mapping mechanism between the image coordinate system and the actual physical coordinate system, failing to accurately convert crack features in the image into true physical dimensions, leading to significant deviations in quantization results.

[0004] Existing technologies suffer from technical problems such as inaccurate measurement of geometric characteristic parameters of pipeline cracks and low reliability of quantitative assessment results. Summary of the Invention

[0005] This invention provides a method and system for extracting pipeline cracks based on machine vision, in order to solve the technical problems of inaccurate measurement of geometric feature parameters of pipeline cracks and low reliability of quantitative evaluation results.

[0006] In a first aspect, to address the aforementioned technical problems, the present invention provides a method for extracting pipe cracks based on machine vision, comprising: The original image data of the pipe surface is acquired, and the original image data is preprocessed to obtain preprocessed image data; The preprocessed image data is subjected to boundary detection processing, and boundary points are filtered to obtain a set of effective boundary feature point coordinates; The effective boundary feature point coordinate set is refined to obtain crack boundary contour curve fitting data. Based on the fitted data of the crack boundary contour curve, geometric parameters are calculated and physical dimensions are converted to obtain the crack geometric feature parameters of physical dimensions; The accuracy of the crack geometric feature parameters is evaluated, and the boundary fitting error is analyzed based on the crack boundary contour curve fitting data to generate a measurement accuracy identification code. A structured data format is constructed based on the measurement accuracy identification code and the crack geometric feature parameters to generate a standardized inspection report; Based on the standardized inspection report, the degree of crack hazard is determined, and a quantitative assessment result is obtained.

[0007] In one optional implementation, the step of acquiring raw image data of the pipe surface and preprocessing the raw image data to obtain preprocessed image data includes: Obtain raw image data of the pipe surface; Perform statistical analysis on the pixel grayscale values ​​of the original image data to obtain the variance of the pixel grayscale value distribution; If the variance of the pixel grayscale value distribution exceeds a preset noise threshold, the size of the filtering window is dynamically adjusted, and the original image data is subjected to adaptive median filtering to obtain the preprocessed image data.

[0008] In one optional implementation, the step of performing boundary detection processing on the preprocessed image data and filtering boundary points to obtain a set of effective boundary feature point coordinates includes: Edge detection processing is performed on the preprocessed image data, and gradient intensity and gradient direction are calculated to obtain gradient intensity data and gradient direction data. Based on the comparison between the gradient intensity and the preset boundary threshold, weak boundary points are eliminated to obtain a set of candidate boundary feature point coordinates; The set of candidate boundary feature point coordinates is subjected to non-maximum suppression processing to obtain an optimized boundary point set; Connectivity analysis is performed on the optimized boundary point set, and based on the gradient direction data, the coordinate set of the effective boundary feature points is obtained.

[0009] In one optional implementation, refining the boundary point positions of the effective boundary feature point coordinate set to obtain crack boundary contour curve fitting data includes: Local gradient interpolation is performed on the set of effective boundary feature point coordinates to obtain a sub-pixel level set of boundary point coordinates; The interpolation residual value is calculated based on the sub-pixel level boundary point coordinate set and compared with the preset residual threshold. Abnormal boundary points are removed to obtain a purified sub-pixel level boundary point coordinate set. The set of sub-pixel level boundary point coordinates of the purification system is subjected to polynomial curve fitting to obtain preliminary crack boundary contour curve data. Calculate the geometric deviation value between the preliminary crack boundary contour curve data and the set of sub-pixel level boundary point coordinates of the purification system, and compare the geometric deviation value with a preset geometric threshold to verify the geometric deviation of the preliminary crack boundary contour curve data, thereby obtaining the crack boundary contour curve fitting data.

[0010] In one optional implementation, the step of calculating geometric parameters and converting physical dimensions based on the crack boundary contour curve fitting data to obtain the crack geometric feature parameters of physical dimensions includes: Based on the fitted data of the crack boundary contour curve, the length of the continuous pixel path is calculated to obtain the preliminary crack pixel length value; The crack boundary contour curve fitting data is smoothed and the crack pixel width is calculated to obtain the crack pixel width sequence. The crack type is determined from the crack pixel width sequence to obtain crack type data; Based on preset camera calibration parameters, the initial crack pixel length value and the crack pixel width sequence are physically converted and integrated with the crack type data to obtain the crack geometric feature parameters of the physical size.

[0011] In one optional implementation, the step of evaluating the accuracy of the crack geometric feature parameters and performing boundary fitting error analysis based on the crack boundary contour curve fitting data to generate a measurement accuracy identification code includes: Boundary fitting error analysis was performed on the fitted data of the crack boundary contour curve to obtain boundary fitting error data; Based on the boundary fitting error data and the crack geometric feature parameters, the accuracy level is divided into categories, and the accuracy level division rules are obtained. The measurement accuracy identification code is generated based on the accuracy level classification rules and the crack geometric feature parameters.

[0012] In one optional implementation, the step of constructing a structured data format based on the measurement accuracy identifier code and the crack geometric feature parameters to generate a standardized inspection report includes: Based on the measurement accuracy identification code and the crack geometric feature parameters, template matching processing is performed to obtain initial report data; The initial report data is subjected to field integrity verification to obtain the field verification results; Based on the field verification results and preset default values, the initial report data is populated with fields to generate the standardized test report.

[0013] In one optional implementation, the step of determining the degree of crack hazard based on the standardized inspection report to obtain a quantitative assessment result includes: The standardized inspection report is parsed to obtain the geometric feature parameters of the crack and the measurement accuracy identification code; Based on the geometric feature parameters of the crack and the measurement accuracy identification code, a correlation calculation and level determination are performed to obtain the hazard level; The quantitative assessment result is obtained by integrating the data based on the hazard level, the crack geometric characteristic parameters, and the measurement accuracy identification code.

[0014] Secondly, the present invention provides a machine vision-based pipe crack extraction system, comprising: The data preprocessing module is used to acquire raw image data of the pipe surface and preprocess the raw image data to obtain preprocessed image data. The boundary detection module is used to perform boundary detection processing on the preprocessed image data and to filter boundary points to obtain a set of effective boundary feature point coordinates. The position refinement module is used to refine the position of the effective boundary feature point coordinate set to obtain crack boundary contour curve fitting data. The parameter conversion module is used to calculate geometric parameters and convert physical dimensions based on the crack boundary contour curve fitting data, so as to obtain the crack geometric feature parameters of physical dimensions. The accuracy assessment module is used to assess the accuracy of the crack geometric feature parameters, perform boundary fitting error analysis based on the crack boundary contour curve fitting data, and generate a measurement accuracy identification code. The report generation module is used to construct a structured data format based on the measurement accuracy identification code and the crack geometric feature parameters, and generate a standardized inspection report. The risk assessment module is used to determine the degree of crack hazard based on the standardized inspection report and obtain a quantitative assessment result.

[0015] Compared with the prior art, the present invention has the following beneficial effects: (1) This invention obtains a set of effective boundary feature point coordinates by performing boundary detection processing and boundary point screening on preprocessed image data, and further applies a high-precision boundary positioning algorithm to this set. Through local gradient interpolation calculation and boundary point position refinement processing, the crack boundary contour curve fitting data is obtained. This method effectively overcomes the defect of traditional pixel-level edge detection methods that are difficult to capture the gradual or blurred boundaries of small cracks on the pipe surface. It can achieve sub-pixel-level accurate positioning of crack boundaries, providing a high-precision contour data foundation for subsequent accurate geometric measurements.

[0016] (2) Based on the high-precision crack boundary contour curve fitting data, the present invention calculates geometric parameters and establishes the conversion relationship from pixel coordinates to physical size through camera calibration parameters to obtain the crack geometric feature parameters of physical size. This method solves the technical bottleneck in the prior art where the mapping between image features and physical size is inaccurate and the quantization result deviation is large due to changes in shooting distance and angle. It realizes the accurate conversion from sub-pixel level image data to real physical size and significantly improves the measurement accuracy of crack geometric parameters.

[0017] (3) This invention evaluates the accuracy of the geometric feature parameters of the crack, generates a measurement accuracy identification code based on the boundary fitting error analysis, constructs a standardized inspection report in combination with the geometric parameters, and finally determines the degree of danger of the crack to obtain a quantitative evaluation result. This method solves the problem that the existing technology lacks the ability to evaluate the reliability of the inspection results. By introducing the measurement accuracy identification code, the output inspection results not only contain accurate quantitative data, but also have their own credibility assessment, thus making the final degree of danger determination result more reliable and providing a scientific decision-making basis for pipeline safety operation and maintenance. Attached Figure Description

[0018] Figure 1 This is a schematic diagram of a pipeline crack extraction method based on machine vision provided in the first embodiment of the present invention; Figure 2 This is a schematic diagram of a machine vision-based pipeline crack extraction system provided in the second embodiment of the present invention. Detailed Implementation

[0019] 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 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.

[0020] Reference Figure 1 The first embodiment of the present invention provides a method for extracting pipe cracks based on machine vision, including the following steps: S11, acquire the original image data of the pipe surface, and preprocess the original image data to obtain preprocessed image data; S12, perform boundary detection processing on the preprocessed image data and filter boundary points to obtain a set of effective boundary feature point coordinates; S13, refine the boundary point positions of the set of effective boundary feature point coordinates to obtain crack boundary contour curve fitting data; S14. Based on the crack boundary contour curve fitting data, perform geometric parameter calculation and physical size conversion to obtain the crack geometric feature parameters of physical size; S15, perform accuracy evaluation on the geometric feature parameters of the crack, and perform boundary fitting error analysis based on the crack boundary contour curve fitting data to generate a measurement accuracy identification code; S16, construct a structured data format based on the measurement accuracy identification code and the crack geometric feature parameters, and generate a standardized inspection report; S17. Based on the standardized inspection report, determine the degree of crack hazard and obtain a quantitative assessment result.

[0021] In step S11, raw image data of the pipe surface is acquired, and the raw image data is preprocessed to obtain preprocessed image data, including: Obtain raw image data of the pipe surface; Perform statistical analysis on the pixel grayscale values ​​of the original image data to obtain the variance of the pixel grayscale value distribution; If the variance of the pixel grayscale value distribution exceeds a preset noise threshold, the size of the filtering window is dynamically adjusted, and the original image data is subjected to adaptive median filtering to obtain the preprocessed image data.

[0022] It should be noted that the acquisition of raw image data of the pipe surface is achieved through an industrial camera deployed on the pipe inspection equipment. The camera continuously captures images of the inner wall of the pipe at a preset image resolution (e.g., 1920×1080 pixels), outputting an unprocessed 8-bit grayscale image sequence containing timestamps as the raw image data.

[0023] For example, in a pipeline inspection task, a frame of raw image data of 1920×1080 pixels was acquired at the timestamp "2025-10-21T10:30:05.100Z".

[0024] It should be noted that the pixel grayscale value statistical analysis of the original image data aims to quantify the overall noise level of the image. This process involves iterating through each pixel in the original image data, reading its grayscale value within the range of 0 to 255, and calculating the mean of the entire image based on these grayscale values. ) and standard deviation ( Finally, using the variance calculation formula ( This yields the variance of pixel grayscale value distribution, which reflects the degree of grayscale dispersion in the image.

[0025] For example, after statistical analysis of the raw image data collected above, the mean pixel grayscale value is calculated to be 115 and the standard deviation is 25. The final variance of the pixel grayscale value distribution is 625.

[0026] It should be noted that if the variance of the pixel grayscale value distribution exceeds the preset noise threshold, it indicates that the image has been significantly interfered with by factors such as uneven lighting, surface stains or sensor noise, and the adaptive filtering process needs to be activated.

[0027] It is worth noting that the method for determining the preset noise threshold is as follows: First, a large number (e.g., 5000) of pipeline images are collected under various ideal, interference-free operating conditions to form a "clean image" dataset. Then, the variance of the pixel grayscale value distribution for each image in this dataset is calculated, forming a variance distribution. Finally, the 95th percentile of this variance distribution is selected as a stable critical value. Any variance exceeding this threshold in actual operation is statistically well-founded to be considered as being caused by significant noise.

[0028] For example, assuming that statistical analysis of the "clean image" dataset determines the variance of the 95th percentile to be 400, the preset noise threshold is set to 400. Since the actual variance of the current image, 625, exceeds this threshold, the system determines that noise reduction processing is required.

[0029] It should be noted that adaptive median filtering of the original image data is a dynamic noise reduction process. This process first performs noise detection on the image, marking the locations of pixels with abnormal grayscale values. Based on the density of these noise points in the local region, the window size for subsequent median filtering is dynamically adjusted. Specifically, if the local noise density is higher than a preset density threshold, the filtering window size is increased (e.g., from 3×3 to 5×5); otherwise, the standard window size is used. Subsequently, a median filtering algorithm is used to traverse the image through a sliding window. The algorithm works by acquiring the grayscale values ​​of all pixels in the neighborhood at each window location, sorting the pixel set in ascending order, and selecting the grayscale value at the middle position (i.e., the median) as the filtered output value for the current center pixel.

[0030] It is worth noting that the preset density threshold is determined through comparative experiments on a sample image set containing different noise density levels. Specifically, the system uses different candidate density thresholds (e.g., 0.003, 0.005, 0.008) to trigger adaptive filtering and evaluates the accuracy of edge detection in the subsequent S12 step. Finally, the density value that achieves the best balance between "effectively removing noise" and "maximally preserving crack edge details" is selected as the preset density threshold.

[0031] For example, if the system detects that the noise density exceeds a preset density threshold (e.g., 0.005) within a 100×100 pixel region, it expands the filtering window size from the default 3×3 to 5×5. When processing the pixel at coordinates (300, 200), the system obtains the grayscale values ​​of its 25 neighboring pixels within its 5×5 neighborhood, sorts them, and selects the median (e.g., 128) to replace the original value of that pixel. This image, after conditional and adaptive noise reduction, is the final preprocessed image data.

[0032] In step S12, the preprocessed image data undergoes boundary detection processing, and boundary point filtering is performed to obtain a set of valid boundary feature point coordinates, including: Edge detection processing is performed on the preprocessed image data, and gradient intensity and gradient direction are calculated to obtain gradient intensity data and gradient direction data. Based on the comparison between the gradient intensity and the preset boundary threshold, weak boundary points are eliminated to obtain a set of candidate boundary feature point coordinates; The set of candidate boundary feature point coordinates is subjected to non-maximum suppression processing to obtain an optimized boundary point set; Connectivity analysis is performed on the optimized boundary point set, and based on the gradient direction data, the coordinate set of the effective boundary feature points is obtained.

[0033] It should be noted that edge detection processing on the preprocessed image data is performed to locate regions in the image where grayscale values ​​change abruptly. In this embodiment, the Sobel operator is used to perform edge detection processing on the preprocessed image data. Specifically, this processing uses a horizontal convolution kernel and a vertical convolution kernel to perform convolution operations on the image, thereby calculating the horizontal and vertical gradients of each pixel. Based on these two gradient values, the gradient intensity (i.e., the magnitude of the gradient) and gradient direction (i.e., the angle of the gradient) of each pixel are further calculated, ultimately generating the gradient intensity data and the gradient direction data.

[0034] For example, in an image of a pipe surface, the pixel grayscale value at the edge of a crack might abruptly change from 120 to 180. After processing with the Sobel operator, the pixel at that edge location is calculated to have a high gradient intensity value (e.g., 80), while the gradient intensity value in the grayscale flat region is close to 0.

[0035] It should be noted that comparing the gradient intensity data with a preset boundary threshold aims to achieve the first layer of filtering for boundary points. This process iterates through each pixel in the gradient intensity data, comparing its gradient intensity value with the preset boundary threshold. If the gradient intensity is lower than the threshold, the point is marked as a weak boundary point and discarded; otherwise, it is retained, thus obtaining the set of candidate boundary feature point coordinates.

[0036] It is worth noting that the preset boundary threshold is determined through statistical analysis on a sample image set containing a large number of manually labeled crack edges. Specifically, the system calculates the gradient intensity distribution of pixels with "real crack edges" and pixels with "non-edge (background noise)" respectively, and uses receiver operating characteristic (ROC) curve analysis to find the optimal intensity value that can distinguish these two types of distributions by the maximum Youden exponent (i.e., true positive rate - false positive rate). This value is set as the preset boundary threshold.

[0037] For example, suppose the preset boundary threshold determined by statistical analysis is 45. The system detects that the gradient strength at coordinates (800, 600) is 42 (below 45), and this point is discarded; while the gradient strength at coordinates (820, 610) is 48 (above 45), and this point is retained and added to the candidate boundary feature point coordinate set.

[0038] It should be noted that the Non-Maximum Suppression (NMS) processing on the candidate boundary feature point coordinate set aims to achieve a second layer of refinement in boundary point selection, namely, removing redundant "coarse" edges and refining them to edges of single-pixel width. This process traverses each point in the candidate boundary feature point coordinate set and uses the gradient direction data to determine its gradient axis. Subsequently, the system compares the gradient intensity of this point with that of its neighboring pixels along the gradient axis direction (obtained from the gradient intensity data). If the gradient intensity of this point is not a local maximum, it is suppressed (i.e., removed).

[0039] For example, taking a candidate point at coordinates (600, 400) as an example, its gradient direction is northeast (45 degrees). Non-maximum suppression processing compares this point with its neighbors in the north, east, south, and west directions. If its gradient intensity is greater than that of these neighbors, the point is retained, thus effectively removing false boundary points caused by surface texture. The set of pixels obtained after this processing is the optimized boundary point set.

[0040] It should be noted that the purpose of performing connected component analysis on the optimized boundary point set is to connect discrete edge points into a continuous contour. This process is implemented through a clustering algorithm. Specifically, the system traverses the optimized boundary point set, compares the spatial distance between adjacent boundary points with a preset distance threshold, and compares the difference in gradient direction data with a preset angle threshold. Points that simultaneously meet both conditions (i.e., spatial proximity and similar gradient directions) are merged into the same connected component (i.e., cluster), thereby aggregating boundary points belonging to the same crack together.

[0041] It is worth noting that the preset distance threshold and the preset angle threshold are determined by performing a grid search optimization on a validation dataset containing a large number of manually labeled crack contours. Specifically, the system tests multiple candidate parameter pairs (e.g., [2 pixels, 10 degrees], [3 pixels, 10 degrees], [2 pixels, 15 degrees]), and uses a connected component analysis algorithm to cluster the validation set, calculating the F1 score between the clustering results and the manually labeled "true contours". Finally, the parameter pair that achieves the highest F1 score (i.e., the best balance between precision and recall) is selected as the fixed preset threshold.

[0042] For example, if the system determines that the spatial distance between the point at coordinates (600, 400) and the point at coordinates (610, 405) is less than a preset distance threshold (e.g., 2 pixels) and the gradient direction difference is less than a preset angle threshold (e.g., 10 degrees), then they are merged. Finally, all discrete optimized boundary points belonging to the same crack are connected into one or more continuous boundary clusters, and the set of these clusters is the set of effective boundary feature point coordinates.

[0043] In step S13, the set of effective boundary feature point coordinates is refined to obtain crack boundary contour curve fitting data, including: Local gradient interpolation is performed on the set of effective boundary feature point coordinates to obtain a sub-pixel level set of boundary point coordinates; The interpolation residual value is calculated based on the sub-pixel level boundary point coordinate set and compared with the preset residual threshold. Abnormal boundary points are removed to obtain a purified sub-pixel level boundary point coordinate set. The set of sub-pixel level boundary point coordinates of the purification system is subjected to polynomial curve fitting to obtain preliminary crack boundary contour curve data. Calculate the geometric deviation value between the preliminary crack boundary contour curve data and the set of sub-pixel level boundary point coordinates of the purification system, and compare the geometric deviation value with a preset geometric threshold to verify the geometric deviation of the preliminary crack boundary contour curve data, thereby obtaining the crack boundary contour curve fitting data.

[0044] It should be noted that performing local gradient interpolation on the set of effective boundary feature point coordinates aims to improve the accuracy of boundary localization from the integer pixel level to the sub-pixel level. This embodiment employs a quadratic polynomial fitting method; specifically, within the local neighborhood (e.g., a 3×3 pixel region) of the effective boundary feature point coordinates, a quadratic surface model is constructed by selecting the gradient intensity values ​​of surrounding pixels centered on the integer pixel coordinates. The model is fitted using the least squares method, and the extreme points of the quadratic surface (i.e., the points with the maximum gradient intensity) are calculated to obtain the sub-pixel level boundary point coordinates. This method can more accurately locate edge peaks and improve the boundary refinement accuracy.

[0045] It should be noted that calculating the interpolation residual value based on the sub-pixel level boundary point coordinate set is to eliminate spurious boundary points that may be generated during the interpolation process, ensuring the reliability of the sub-pixel coordinates. This process compares the results with those obtained in integer coordinates. Actual measured gradient value at the location (Gradient strength data from S12) and an interpolated predicted gradient value To calculate the degree of agreement between the two, i.e., the interpolation residual value. Wherein, the interpolation prediction gradient value It is done through an interpolation method (e.g., based on...). (The gradient values ​​of the 4-neighbor or 8-neighbor pixels) are used to predict Gradient value at the point. Interpolation residual value. The calculation formula is If the residual value is... If the residual value exceeds the preset residual threshold, it indicates that the actual gradient value of the point does not match the gradient distribution of its neighborhood, the interpolation result is unreliable, and it should be marked as an abnormal boundary point and removed, thereby obtaining the set of purified sub-pixel level boundary point coordinates.

[0046] It is worth noting that the preset residual threshold is determined through statistical analysis on a validation dataset containing a large number of manually precisely located sub-pixel edges. Specifically, the system calculates the distribution of interpolation residual values ​​for all "true edge points" in the validation set and selects the 99th percentile of this distribution as a stable critical value. Any residual exceeding this threshold in actual operation is statistically well-founded to be considered an outlier caused by interpolation errors or image noise.

[0047] For example, assume a preset residual threshold of 6. The system measures the actual gradient value at coordinates (820, 610). The value is 52, and the predicted gradient value is calculated through neighborhood interpolation. The value is 48. The interpolation residual value is calculated. The point with a residual value below 6 is retained. However, the point at coordinates (850, 640) has a residual value of 8 (above 6), and is marked as an outlier and removed from the set.

[0048] It should be noted that the polynomial curve fitting process applied to the set of sub-pixel level boundary point coordinates aims to transform the discrete sub-pixel points into a mathematically continuous smooth curve. In this embodiment, the least squares method is used to perform cubic polynomial curve fitting on the set of sub-pixel level boundary point coordinates. Specifically, the goal of this process is to find an optimal set of polynomial coefficients ( ), making the fitted curve With all purification points Minimize the sum of squared residuals between them, where the sum of squared residuals is This process calculates an optimal set of polynomial coefficients by solving the aforementioned minimization problem, thereby generating a continuous boundary curve that can pass through all purification points with minimal error. This curve is the preliminary crack boundary profile curve data.

[0049] For example, the system collects 15 cleaned sub-pixel-level boundary points of a crack, with coordinates ranging from (550.2, 350.1) to (650.8, 450.3). The polynomial coefficients are calculated using the least squares method. This generates a smooth mathematical curve. .

[0050] It should be noted that the geometric deviation verification of the preliminary crack boundary contour curve data is to ensure that the generated mathematical curve faithfully reflects the actual crack shape. This process calculates the vertical (or normal) distance from each point in the set of purified sub-pixel level boundary point coordinates to the preliminary crack boundary contour curve data, i.e., the geometric deviation value. Subsequently, this deviation value is compared with a preset geometric threshold. If the deviation value is lower than the threshold, the curve segment is retained; otherwise, it is marked as a fitting failure or segmented processing is performed.

[0051] It is worth noting that the preset geometric threshold is determined based on the final requirement for pipe inspection accuracy, combined with the pixel equivalent after camera calibration (e.g., 1 pixel = 0.02 mm). For example, if the final measurement accuracy requirement is ±0.05 mm, and 1 pixel represents 0.02 mm, then the geometric threshold cannot exceed 2.5 pixels. Through such calibration experiments, a balanced value (e.g., 0.5 pixels) that can tolerate minor noise while eliminating significant fitting errors is selected as the preset geometric threshold.

[0052] For example, assume a preset geometric threshold of 0.5 pixels. The system calculates that the cleaned point at coordinates (600.5, 400.2) has a geometric deviation of 0.48 pixels from the fitted curve (less than 0.5), and the curve segment corresponding to this point is verified and retained. However, near coordinates (680.1, 430.7), the deviation reaches 0.75 pixels (more than 0.5), and this curve segment is marked as having insufficient fitting accuracy. The set of curves verified and retained in this step is the final crack boundary contour curve fitting data.

[0053] In step S14, based on the crack boundary contour curve fitting data, geometric parameters are calculated and physical dimensions are converted to obtain the crack geometric characteristic parameters of the physical dimensions, including: Based on the fitted data of the crack boundary contour curve, the length of the continuous pixel path is calculated to obtain the preliminary crack pixel length value; The crack boundary contour curve fitting data is smoothed and the crack pixel width is calculated to obtain the crack pixel width sequence. The crack type is determined from the crack pixel width sequence to obtain crack type data; Based on preset camera calibration parameters, the initial crack pixel length value and the crack pixel width sequence are physically converted and integrated with the crack type data to obtain the crack geometric feature parameters of the physical size.

[0054] It should be noted that calculating the continuous pixel path length based on the crack boundary contour curve fitting data is to obtain the total length of the crack in the pixel coordinate system. In this embodiment, a sub-pixel level chain code tracing method is used. This process traverses all sub-pixel points on the crack boundary contour curve fitting data, quantizes and records the direction vectors between adjacent points, and obtains the preliminary crack pixel length value by accumulating the path distances of these sub-pixel level chain codes.

[0055] For example, the system traces from the crack start point (550.2, 350.1) to the end point (650.8, 450.3), accumulates all subpixel chain codes, and calculates the initial crack pixel length value as 141.98 pixels.

[0056] It should be noted that smoothing the fitted data of the crack boundary contour curve aims to eliminate minor noise on the curve, laying the foundation for subsequent stable width measurement. This embodiment employs a bilateral filter method, which smooths the data while maintaining the sharpness of critical edges such as the crack tip. Crack pixel width calculation is achieved by calculating the spacing perpendicular to the crack path direction on the smoothed curve. This process first determines the crack centerline using a skeleton extraction method, and then samples the normal direction along this centerline at a preset step size (e.g., every 1 pixel), calculating the minimum spacing between the two crack boundary contours in this normal direction, thereby obtaining a sequence of crack pixel widths representing the crack width at different locations.

[0057] In one optional implementation, the centerline is calculated using the centerline of the fitted data of the crack boundary contour curve. Specifically, for the two boundary curves of the crack, sampling points are taken at fixed intervals along the path direction, and the average coordinates of the corresponding sampling points are calculated to generate a centerline point set. Then, the centerline point set is smoothed (e.g., by spline interpolation) to obtain a continuous centerline. The minimum distance between the two boundary curves is calculated along the normal direction of each point on the centerline to obtain the crack pixel width sequence. This method avoids the instability of skeleton extraction and is applicable to various crack shapes.

[0058] It is worth noting that the preset step size (e.g., 1 pixel) is determined based on the principle of balancing measurement completeness with computational efficiency. Setting the step size to 1 pixel, that is, sampling at the highest available resolution of the pixel grid, ensures that any width abrupt changes along the crack path (such as the narrowest or widest point) will not be missed due to excessively large sampling intervals, thereby obtaining the most representative crack pixel width sequence at a reasonable computational cost.

[0059] For example, at the crack centerline coordinates (600.5, 400.2), the minimum spacing in the normal direction is calculated to be 2.9 pixels; at coordinates (620.5, 410.2), the minimum spacing is 3.1 pixels. These values ​​[2.9, ..., 3.1] together constitute the crack pixel width sequence.

[0060] It should be noted that the crack type determination based on the crack pixel width sequence aims to preliminarily classify the severity of the cracks. This process involves finding the maximum value in the crack pixel width sequence and comparing it with a preset pixel width threshold. If the maximum value is lower than the threshold, the crack is marked as a "micro-crack"; otherwise, it is marked as a "regular crack," thus obtaining the crack type data.

[0061] It is worth noting that the method for determining the preset pixel width threshold is based on common knowledge and industry standards in pipeline safety operation and maintenance. In the field of pipeline inspection, cracks with a physical width less than a certain value (e.g., 0.1 mm) are typically defined as "micro-cracks". This preset pixel width threshold (e.g., 5 pixels) is the pixel equivalent value corresponding to this physical threshold (0.1 mm) under the current camera calibration parameters (e.g., 1 pixel = 0.02 mm).

[0062] For example, suppose the preset pixel width threshold is 5 pixels. Since the maximum value of the crack pixel width sequence obtained in the previous step is 3.1 pixels (less than 5 pixels), the system determines the crack type data of this crack as "micro crack".

[0063] It should be noted that, based on preset camera calibration parameters, performing physical size conversion on the initial crack pixel length value and the crack pixel width sequence is the core step in converting pixel units to physical units (such as millimeters). The camera calibration parameters (i.e., pixel equivalent, such as millimeters / pixel) describe the size of a pixel in the image corresponding to the actual physical space. Physical size conversion is achieved by multiplying the pixel value by this pixel equivalent.

[0064] It is worth noting that the preset camera calibration parameters are determined through a standard camera calibration procedure (e.g., the Zhang Zhengyou calibration method) combined with a calibration board of known size. By photographing the calibration board at the same shooting distance and angle as the actual detection, the number of pixels occupied by the pattern of known size in the image is analyzed, thereby accurately calculating the physical length represented by each pixel (e.g., 0.02 mm / pixel), which is used as the preset camera calibration parameters.

[0065] It should be noted that integrating the crack type data involves encapsulating all calculation and judgment results into a standardized data structure. This process creates a record containing multiple fields, storing the converted physical length, physical width sequence, and crack type data into their respective fields.

[0066] For example, assume the preset camera calibration parameter is 0.02 mm / pixel. The system converts the initial crack pixel length value of 122.5 pixels into a physical length of 2.45 mm; and converts the crack pixel width sequence [2.9, 3.1] into a physical width sequence [0.058 mm, 0.062 mm]. Finally, these data are integrated with the crack type data "micro-crack" to obtain the crack geometric feature parameters of the physical size (e.g., a structured data containing {length: 2.45, width sequence: [0.058, 0.062], type: micro}).

[0067] In step S15, the accuracy of the crack geometric feature parameters is evaluated, and boundary fitting error analysis is performed based on the crack boundary contour curve fitting data to generate a measurement accuracy identification code, including: Boundary fitting error analysis was performed on the fitted data of the crack boundary contour curve to obtain boundary fitting error data; Based on the boundary fitting error data and the crack geometric feature parameters, the accuracy level is divided into categories, and the accuracy level division rules are obtained. The measurement accuracy identification code is generated based on the accuracy level classification rules and the crack geometric feature parameters.

[0068] It should be noted that the boundary fitting error analysis performed on the fitted data of the crack boundary contour curve aims to quantify the deviation between the fitted curve generated in S13 and the purified sub-pixel points in S13. In this embodiment, a statistical regression method is used. Specifically, this process calculates the deviation of each purified sub-pixel level boundary point (let's say...). The deviation of the normal distance from the corresponding fitted curve (let's call it) to the curve is the distance from the curve to ... The sum of squared residuals (SSR) is used to accumulate all deviations. The calculation formula is .in This represents the total number of sub-pixel level boundary points to be purified. The calculation result... The quantitative value that can represent the fitting accuracy of the entire crack is the boundary fitting error data.

[0069] For example, the system compares a measured sub-pixel point (coordinates 565.3, 375.8) on the crack boundary with the theoretical corresponding point (coordinates 565.1, 375.6) on the fitted curve generated in S13, resulting in a positional deviation of 0.28 pixels (i.e., The system accumulates the squared deviations of all boundary points. Finally, the overall boundary fitting error (SSR value) was calculated to be 15.6 (pixel squared).

[0070] It should be noted that the accuracy level classification based on the boundary fitting error data and the crack geometric feature parameters is to establish a standard that maps quantification errors to management levels. This process first extracts the coordinate deviation data of key control points (such as the crack's start point, inflection point, and end point) from the crack geometric feature parameters. Then, the system comprehensively considers the boundary fitting error data (representing the overall fit) and the control point coordinate deviation data (representing the accuracy of key points) to determine the numerical range of the identification codes corresponding to different accuracy levels. A key-value pair allocation table that associates the numerical range with the quality level is then constructed using a hash mapping method; this allocation table constitutes the accuracy level classification rule.

[0071] It is worth noting that the specific thresholds (e.g., "0.2 pixels" or "0.5 pixels") in the accuracy level classification rules are determined based on statistical analysis of a large number of calibrated pipeline images with "true measurement values". Specifically, the system analyzes the correlation between measurement results at different error levels and the "true values", and uses receiver operating characteristic (ROC) curve analysis to find the optimal error boundary values ​​that can distinguish the three levels of "high accuracy", "standard accuracy", and "basic accuracy" with the highest confidence. These boundary values ​​are solidified into the accuracy level classification rules.

[0072] For example, a generated accuracy level classification rule can be defined as follows: (1) High accuracy (identifier code 90-100), requiring the boundary fitting error (after standardization) to be less than 0.2 pixels and the average deviation of control points to be less than 0.15 pixels. (2) Standard accuracy (identifier code 70-89), allowing the boundary fitting error to be between 0.2 and 0.5 pixels. (3) Basic accuracy (identifier code 50-69), applicable to cases where the boundary fitting error is greater than 0.5 pixels.

[0073] It should be noted that generating the measurement accuracy identification code based on the accuracy level classification rules and the crack geometric feature parameters is a process of applying the above rules for final scoring. This process substitutes the actual measured value of the current crack (i.e., the average deviation of control points in the crack geometric feature parameters) and the boundary fitting error data calculated in step S15 into the accuracy level classification rules for comprehensive evaluation, and finally determines a unique value, namely the measurement accuracy identification code.

[0074] For example, the system converts the boundary fitting error of 15.6 (pixels squared) calculated in step S15 into a standardized deviation value of 0.31 pixels, and extracts the average deviation of control points from the crack geometric feature parameters as 0.18 pixels. According to the example rule above (0.31 pixels is between 0.2 and 0.5, and 0.18 pixels is slightly higher than 0.15), the system obtains a final measurement accuracy identification code of 85 after comprehensive evaluation. This value (85) falls within the "standard accuracy" level (70-89), corresponding to a quality level of B.

[0075] It should be noted that the standardized deviation value is based on the number of sub-pixel level boundary point coordinate sets in the purification process. Calculate the mean squared error ,in, The sum of squared residuals is used; then, the standardized deviation is calculated. This value represents the average geometric deviation (in pixels) between the fitted curve and the boundary points. For example, assume the number of boundary points... =160, =15.6 pixels², then =15.6 / 160=0.0975 pixels²; Standardized deviation ≈0.31 pixels.

[0076] In step S16, a structured data format is constructed based on the measurement accuracy identifier code and the crack geometric feature parameters to generate a standardized inspection report, including: Based on the measurement accuracy identification code and the crack geometric feature parameters, template matching processing is performed to obtain initial report data; The initial report data is subjected to field integrity verification to obtain the field verification results; Based on the field verification results and preset default values, the initial report data is populated with fields to generate the standardized test report.

[0077] It should be noted that the template matching process, based on the measurement accuracy identifier and the crack geometric feature parameters, is a process of automatically filling the quantized data obtained in S14 and S15 into a standardized document structure. This process first converts the crack geometric feature parameters (such as length and width sequences) and the measurement accuracy identifier (such as 85) into a set of key-value pairs. Subsequently, the system uses a template matching method to map and fill the values ​​in this key-value pair set into pre-defined fields in the predefined report template, thereby generating the initial report data containing crack parameters and accuracy levels.

[0078] It is worth noting that the predefined report template is based on industry standards and format specifications in the pipeline inspection field. The template predefines all necessary data fields (such as crack ID, physical length, maximum width, precision identifier, and risk label) and their data types in a structured format (e.g., XML or JSON). Furthermore, the template may include rule-based automatic labeling logic.

[0079] For example, a set of key-value pairs is received as input: {Length: 200.5 mm, Width: 1.2 mm, AccuracyCode: 85}. Template matching processes map this to template fields. Simultaneously, a rule contained in the template (e.g., IF Width < 1.5 mm AND Length > 200 mm THEN RiskNote: "Potential expanding crack requiring close monitoring") is triggered. The resulting initial report data is: {Length: 200.5, Width: 1.2, AccuracyCode: 85, RiskNote: "Potential expanding crack requiring close monitoring"}.

[0080] It should be noted that performing field integrity verification on the initial report data is a necessary step to ensure the quality of the output report data. This process employs a field verification mechanism, performing two checks on the initial report data: first, checking for missing fields (e.g., a null length field due to image acquisition issues); second, checking the reasonableness of field values, i.e., comparing them with preset normal ranges to identify outliers. The result of this check, i.e., the field verification result, is a list containing all missing or outlier fields.

[0081] It is worth noting that the preset normal range (e.g., a reasonable range for crack width) is determined through statistical analysis of a large amount of historical detection data (e.g., the past 10,000 detections). Specifically, the system calculates a 99.9% confidence interval for each key parameter (such as width and length) and sets this interval (e.g., [0.05 mm, 8.0 mm]) as the preset normal range. Any value outside this range will be marked as abnormal.

[0082] For example, the system validates an initial report data {Width:10.0, Length:null}. The field validation mechanism finds that the Length field is missing. Simultaneously, it finds that the Width field value is 10 mm, exceeding the preset normal range [0.05 mm, 8.0 mm]. Therefore, the generated field validation result is {Missing:[Length],Abnormal:[Width]}.

[0083] It should be noted that the field filling process for the initial report data based on the field validation results and preset default values ​​is a data repair and improvement process. This process iterates through the list of field validation results. If a missing field is found, the corresponding default value for that field is retrieved from a preset default value database and filled in. If an abnormal field is found, the corresponding default value is used to replace the abnormal value, and the original abnormal value is recorded in the remarks field of the report for manual verification.

[0084] It is worth noting that the preset default value database is established based on engineering safety specifications and risk management strategies. Its core principle is "safety conservatism," meaning that default values ​​are always set to the values ​​that best guarantee a safety margin. For example, in the inspection scenario of high-temperature and high-pressure pipelines, the default value of a missing crack width field will be set to a more stringent value close to the safety threshold (e.g., 2.0 mm), rather than 0 or the average value.

[0085] For example, following the verification result {Missing:[Length],Abnormal:[Width]} from the previous step, the field filling process begins. First, the default value database is queried to obtain the default value of [Length] as 1.0 mm (basic placeholder). Second, the default value database is queried to obtain the default value of [Width] as 2.0 mm (average value of a typical crack). The system fills Length with 1.0, replaces Width with 2.0, and adds a note. The final standardized inspection report is {Length:1.0,Width:2.0,AccuracyCode:85,RiskNote:"...",Log:"Original width 10.0 mm anomaly"}.

[0086] In step S17, based on the standardized inspection report, the degree of crack hazard is determined to obtain a quantitative assessment result, including: The standardized inspection report is parsed to obtain the geometric feature parameters of the crack and the measurement accuracy identification code; Based on the geometric feature parameters of the crack and the measurement accuracy identification code, a correlation calculation and level determination are performed to obtain the hazard level; The quantitative assessment result is obtained by integrating the data based on the hazard level, the crack geometric characteristic parameters, and the measurement accuracy identification code.

[0087] It should be noted that data parsing of the standardized inspection report involves extracting core indicators for risk decision-making from the structured data generated in S16. The specific steps of this process are as follows: First, traverse the key-value pairs in the data structure (e.g., JSON or XML format) of the standardized inspection report; then, match predefined key field names (e.g., Length, Width, Depth, AccuracyCode); finally, read the corresponding values ​​from the matched fields to obtain the crack geometric feature parameters (including the crack's physical length, width sequence, etc.) and the measurement accuracy identifier code.

[0088] For example, the system parses a standardized inspection report and obtains {crack geometric feature parameters: {length: 85.6 mm, width: 2.8 mm} by matching the key names such as Length, Width, and Depth; and obtains {measurement accuracy identifier code: 91} by matching the key name AccuracyCode.

[0089] It should be noted that the correlation calculation and level determination based on the crack geometric feature parameters and the measurement accuracy identification code are for assessing the actual hazard level of the crack. The specific implementation steps of this process are as follows: First, obtain the current pipeline operating parameters (such as pipeline material and working pressure); second, based on the operating parameters, query and match the corresponding safety threshold (such as the maximum allowable crack width under a specific pressure) from the preset risk assessment standards; subsequently, compare the crack geometric feature parameters (such as the measured width value) with the safety threshold to calculate the degree of exceedance; finally, this process integrates the degree of exceedance with the measurement accuracy identification code (as the confidence level of the measurement result) and determines the crack level through a preset risk classification rule, thereby obtaining the hazard level.

[0090] The acquisition of the operating parameters (including pipe material, working pressure, ambient temperature, etc.) includes manual input by the user, querying from a pre-stored pipe database, or obtaining them through real-time communication with a pipe management system (such as a SCADA system). Then, a corresponding safety threshold (such as the maximum allowable crack width) is matched according to different operating parameters. For example, for a pipe made of X65 steel with a working pressure of 6.4 MPa, the safety width threshold is set to 2.5 mm. If the measured crack width exceeds the threshold, the hazard level is determined by combining the measurement accuracy identification code.

[0091] It is worth noting that the preset risk assessment standards and their safety thresholds are determined based on the principles of materials mechanics and pipeline safety operation and maintenance specifications (such as API 1104 "Pipeline Welding and Related Facilities" or ASME B31G "Pipeline Corrosion Defect Assessment"). For example, for pipelines of a specific material (such as X65 steel), the maximum allowable crack width (i.e., the safety threshold) under a specific working pressure (such as 6.4 MPa) is calculated based on fracture mechanics models or relevant safety specifications.

[0092] For example, suppose the risk assessment standard specifies that the safe width threshold for a pipe made of X65 steel with a working pressure of 6.4 MPa is 2.5 mm. The system resolves the crack width to be 2.8 mm (from the crack geometric characteristic parameters). Since 2.8 mm exceeds the 2.5 mm threshold, and the measurement accuracy identification code is 91 (high confidence), the system determines this state and outputs it as the aforementioned danger level, "high danger level".

[0093] It should be noted that the data integration based on the hazard level, the crack geometric feature parameters, and the measurement accuracy identification code is for generating the final comprehensive assessment report. This process combines the qualitative judgment (hazard level) obtained in step S17 (second step) with the quantitative data (crack geometric feature parameters and measurement accuracy identification code) parsed in step S17 (first step) into a complete, structured data record.

[0094] For example, the system integrates the hazard level "high hazard level", the crack geometric feature parameters, and the measurement accuracy identification code "91" to finally generate the quantitative assessment result, which can be represented as a comprehensive inspection report containing {hazard level: high, accuracy: 91, recommendation: immediate shutdown and maintenance}.

[0095] In summary, this invention constructs a complete data processing chain from raw image preprocessing, boundary detection and screening, boundary point position refinement to crack boundary contour fitting, and innovatively combines a precise conversion mechanism from pixel coordinates to physical dimensions with a measurement accuracy identification code evaluation system based on fitting error analysis. Ultimately, it achieves quantitative determination of the degree of danger through standardized reports, realizing accurate extraction of geometric feature parameters of pipeline cracks and reliable quantitative assessment of the degree of danger.

[0096] Reference Figure 2 The second embodiment of the present invention provides a pipeline crack extraction system based on machine vision, comprising: The data preprocessing module is used to acquire raw image data of the pipe surface and preprocess the raw image data to obtain preprocessed image data. The boundary detection module is used to perform boundary detection processing on the preprocessed image data and to filter boundary points to obtain a set of effective boundary feature point coordinates. The position refinement module is used to refine the position of the effective boundary feature point coordinate set to obtain crack boundary contour curve fitting data. The parameter conversion module is used to calculate geometric parameters and convert physical dimensions based on the crack boundary contour curve fitting data, so as to obtain the crack geometric feature parameters of physical dimensions. The accuracy assessment module is used to assess the accuracy of the crack geometric feature parameters, perform boundary fitting error analysis based on the crack boundary contour curve fitting data, and generate a measurement accuracy identification code. The report generation module is used to construct a structured data format based on the measurement accuracy identification code and the crack geometric feature parameters, and generate a standardized inspection report. The risk assessment module is used to determine the degree of crack hazard based on the standardized inspection report and obtain a quantitative assessment result.

[0097] It should be noted that the machine vision-based pipeline crack extraction system provided in this embodiment of the invention is used to execute all the process steps of the machine vision-based pipeline crack extraction method in the above embodiment. The working principles and beneficial effects of the two are one-to-one, so they will not be described again.

[0098] This invention also provides an electronic device. The electronic device includes a processor, a memory, and a computer program stored in the memory and executable on the processor, such as a machine vision-based pipe crack extraction program. When the processor executes the computer program, it implements the steps in the various embodiments of the machine vision-based pipe crack extraction method described above, for example... Figure 1The step S11 shown. Alternatively, when the processor executes the computer program, it implements the functions of each module / unit in the above system embodiments, such as the data preprocessing module.

[0099] For example, the computer program may be divided into one or more modules / units, which are stored in the memory and executed by the processor to complete the present invention. The one or more modules / units may be a series of computer program instruction segments capable of performing a specific function, which describe the execution process of the computer program in the electronic device.

[0100] The electronic device may be a desktop computer, laptop, handheld computer, or smart tablet, etc. The electronic device may include, but is not limited to, a processor and memory. Those skilled in the art will understand that the above components are merely examples of electronic devices and do not constitute a limitation on the electronic device. It may include more or fewer components than described above, or combine certain components, or different components. For example, the electronic device may also include input / output devices, network access devices, buses, etc.

[0101] The processor can be a Central Processing Unit (CPU), or other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor can be a microprocessor or any conventional processor. The processor is the control center of the electronic device, connecting all parts of the electronic device via various interfaces and lines.

[0102] The memory can be used to store the computer programs and / or modules. The processor implements various functions of the electronic device by running or executing the computer programs and / or modules stored in the memory and by calling data stored in the memory. The memory may mainly include a program storage area and a data storage area. The program storage area may store the operating system, at least one application program required for a function (such as sound playback function, image playback function, etc.), etc.; the data storage area may store data created according to the use of the mobile phone (such as audio data, phonebook, etc.). In addition, the memory may include high-speed random access memory, and may also include non-volatile memory, such as hard disk, memory, plug-in hard disk, smart media card (SMC), secure digital (SD) card, flash card, at least one disk storage device, flash memory device, or other volatile solid-state storage device.

[0103] If the modules / units integrated into the electronic device are implemented as software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, all or part of the processes in the methods of the above embodiments of the present invention can also be implemented by a computer program instructing related hardware. The computer program can be stored in a computer-readable storage medium, and when executed by a processor, it can implement the steps of the various method embodiments described above. The computer program includes computer program code, which can be in the form of source code, object code, executable files, or certain intermediate forms. The computer-readable medium can include: any entity or system capable of carrying the computer program code, recording media, USB flash drives, portable hard drives, magnetic disks, optical disks, computer memory, read-only memory (ROM), random access memory (RAM), electrical carrier signals, telecommunication signals, and software distribution media, etc. It should be noted that the content included in the computer-readable medium can be appropriately added or removed according to the requirements of legislation and patent practice in the jurisdiction. For example, in some jurisdictions, according to legislation and patent practice, computer-readable media do not include electrical carrier signals and telecommunication signals.

[0104] It should be noted that the system embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs. Furthermore, in the accompanying drawings of the system embodiments provided by this invention, the connection relationships between modules indicate that they have communication connections, which can be specifically implemented as one or more communication buses or signal lines. Those skilled in the art can understand and implement this without any creative effort.

[0105] The specific embodiments described above further illustrate the purpose, technical solution, and beneficial effects of the present invention. It should be understood that the above descriptions are merely specific embodiments of the present invention and are not intended to limit the scope of protection of the present invention. In particular, it should be noted that any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the scope of protection of the present invention for those skilled in the art.

Claims

1. A method for extracting pipe cracks based on machine vision, characterized in that, include: The original image data of the pipe surface is acquired, and the original image data is preprocessed to obtain preprocessed image data; The preprocessed image data is subjected to boundary detection processing, and boundary points are filtered to obtain a set of effective boundary feature point coordinates; The effective boundary feature point coordinate set is refined to obtain crack boundary contour curve fitting data. Based on the fitted data of the crack boundary contour curve, geometric parameters are calculated and physical dimensions are converted to obtain the crack geometric feature parameters of physical dimensions; The accuracy of the crack geometric feature parameters is evaluated, and the boundary fitting error is analyzed based on the crack boundary contour curve fitting data to generate a measurement accuracy identification code. A structured data format is constructed based on the measurement accuracy identification code and the crack geometric feature parameters to generate a standardized inspection report; Based on the standardized inspection report, the degree of crack hazard is determined, and a quantitative assessment result is obtained.

2. The method for extracting pipe cracks based on machine vision according to claim 1, characterized in that, The process of acquiring raw image data of the pipe surface and preprocessing the raw image data to obtain preprocessed image data includes: Obtain raw image data of the pipe surface; Perform statistical analysis on the pixel grayscale values ​​of the original image data to obtain the variance of the pixel grayscale value distribution; If the variance of the pixel grayscale value distribution exceeds a preset noise threshold, the size of the filtering window is dynamically adjusted, and the original image data is subjected to adaptive median filtering to obtain the preprocessed image data.

3. The method for extracting pipe cracks based on machine vision according to claim 1, characterized in that, The step of performing boundary detection processing on the preprocessed image data and filtering boundary points to obtain a set of effective boundary feature point coordinates includes: Edge detection processing is performed on the preprocessed image data, and gradient intensity and gradient direction are calculated to obtain gradient intensity data and gradient direction data. Based on the comparison between the gradient intensity and the preset boundary threshold, weak boundary points are eliminated to obtain a set of candidate boundary feature point coordinates; The set of candidate boundary feature point coordinates is subjected to non-maximum suppression processing to obtain an optimized boundary point set; Connectivity analysis is performed on the optimized boundary point set, and based on the gradient direction data, the coordinate set of the effective boundary feature points is obtained.

4. The method for extracting pipe cracks based on machine vision according to claim 1, characterized in that, The process of refining the boundary point positions of the effective boundary feature point coordinate set to obtain crack boundary contour curve fitting data includes: Local gradient interpolation is performed on the set of effective boundary feature point coordinates to obtain a sub-pixel level set of boundary point coordinates; The interpolation residual value is calculated based on the sub-pixel level boundary point coordinate set and compared with the preset residual threshold. Abnormal boundary points are removed to obtain a purified sub-pixel level boundary point coordinate set. The set of sub-pixel level boundary point coordinates of the purification system is subjected to polynomial curve fitting to obtain preliminary crack boundary contour curve data. Calculate the geometric deviation value between the preliminary crack boundary contour curve data and the set of coordinates of the purification sub-pixel level boundary points, and compare the geometric deviation value with a preset geometric threshold to verify the geometric deviation of the preliminary crack boundary contour curve data, thereby obtaining the crack boundary contour curve fitting data.

5. The method for extracting pipe cracks based on machine vision according to claim 1, characterized in that, The step of calculating geometric parameters and converting physical dimensions based on the fitted data of the crack boundary contour curve to obtain the crack geometric feature parameters of physical dimensions includes: Based on the fitted data of the crack boundary contour curve, the length of the continuous pixel path is calculated to obtain the preliminary crack pixel length value; The crack boundary contour curve fitting data is smoothed and the crack pixel width is calculated to obtain the crack pixel width sequence. The crack type is determined from the crack pixel width sequence to obtain crack type data; Based on preset camera calibration parameters, the initial crack pixel length value and the crack pixel width sequence are physically converted and integrated with the crack type data to obtain the crack geometric feature parameters of the physical size.

6. The method for extracting pipe cracks based on machine vision according to claim 1, characterized in that, The process of evaluating the accuracy of the crack's geometric feature parameters and performing boundary fitting error analysis based on the crack boundary contour curve fitting data to generate a measurement accuracy identification code includes: Boundary fitting error analysis was performed on the fitted data of the crack boundary contour curve to obtain boundary fitting error data; Based on the boundary fitting error data and the crack geometric feature parameters, the accuracy level is divided into categories, and the accuracy level division rules are obtained. The measurement accuracy identification code is generated based on the accuracy level classification rules and the crack geometric feature parameters.

7. The method for extracting pipe cracks based on machine vision according to claim 1, characterized in that, The step of constructing a structured data format based on the measurement accuracy identifier code and the crack geometric feature parameters to generate a standardized inspection report includes: Based on the measurement accuracy identification code and the crack geometric feature parameters, template matching processing is performed to obtain initial report data; The initial report data is subjected to field integrity verification to obtain the field verification results; Based on the field verification results and preset default values, the initial report data is populated with fields to generate the standardized test report.

8. The method for extracting pipe cracks based on machine vision according to claim 1, characterized in that, The step of determining the degree of crack hazard based on the standardized inspection report and obtaining a quantitative assessment result includes: The standardized inspection report is parsed to obtain the geometric feature parameters of the crack and the measurement accuracy identification code; Based on the geometric feature parameters of the crack and the measurement accuracy identification code, a correlation calculation and level determination are performed to obtain the hazard level; The quantitative assessment result is obtained by integrating the data based on the hazard level, the crack geometric characteristic parameters, and the measurement accuracy identification code.

9. A machine vision-based pipe crack extraction system, characterized in that, include: The data preprocessing module is used to acquire raw image data of the pipe surface and preprocess the raw image data to obtain preprocessed image data. The boundary detection module is used to perform boundary detection processing on the preprocessed image data and to filter boundary points to obtain a set of effective boundary feature point coordinates. The position refinement module is used to refine the position of the effective boundary feature point coordinate set to obtain crack boundary contour curve fitting data. The parameter conversion module is used to calculate geometric parameters and convert physical dimensions based on the crack boundary contour curve fitting data, so as to obtain the crack geometric feature parameters of physical dimensions. The accuracy assessment module is used to assess the accuracy of the crack geometric feature parameters, perform boundary fitting error analysis based on the crack boundary contour curve fitting data, and generate a measurement accuracy identification code. The report generation module is used to construct a structured data format based on the measurement accuracy identification code and the crack geometric feature parameters, and generate a standardized inspection report. The risk assessment module is used to determine the degree of crack hazard based on the standardized inspection report and obtain a quantitative assessment result.