An intelligent detection method for oil and gas engineering supporting facilities based on machine vision

By constructing a structural tensor matrix and using iterative diffusion processing with adaptive contrast parameters, the problem of ignoring edge morphology in anisotropic diffusion algorithms is solved, achieving high accuracy and reliability in oil and gas facility defect detection.

CN120833329BActive Publication Date: 2026-02-10SHAANXI YUYANG PETROLEUM TECH ENG CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202511325082.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-09-17
Publication Date
2026-02-10
Estimated Expiration
2045-09-17

AI Technical Summary

Technical Problem

Existing anisotropic diffusion algorithms only consider gradient intensity and ignore edge morphology when protecting edges, which makes it impossible to distinguish between slender, continuous cracks and coarse, regular welds and other pseudo-defects, affecting the accuracy of defect detection in oil and gas facilities.

Method used

By constructing the structural tensor matrix of pixels, calculating the local linear structure response value and crack continuity, obtaining morphological saliency values, adjusting the adaptive contrast parameter, performing multiple iterative diffusion processes, and combining with the Canny edge detection algorithm, real cracks and pseudo-defects can be identified and distinguished.

Benefits of technology

It significantly improves the accuracy and reliability of defect detection in oil and gas facilities, effectively identifying long and continuous real cracks while smoothing out false defects such as coarse welds and patchy rust, reducing misjudgments.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120833329B_ABST
    Figure CN120833329B_ABST
Patent Text Reader

Abstract

The application belongs to the technical field of image processing, and particularly relates to an oil and gas engineering supporting facility intelligent detection method based on machine vision, which comprises the following steps: constructing a structure tensor matrix based on the gradient of a pixel point, calculating a local linear structure response value according to two characteristic values of the structure tensor matrix, calculating the crack continuity of the pixel point according to the direction alignment degree of the feature vector of the pixel point on the local path, comprehensively obtaining a morphological saliency value of the pixel point, adjusting a basic contrast parameter, performing an anisotropic diffusion treatment on a to-be-detected image of an oil and gas facility based on the obtained adaptive contrast parameter, obtaining an enhanced image through multiple iteration updates, and obtaining a defect detection result image through edge detection. The application solves the problem that the traditional method is prone to misjudging pseudo defects as cracks, and significantly improves the accuracy and reliability of detection.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of image processing technology. More specifically, this invention relates to a machine vision-based intelligent detection method for oil and gas engineering supporting facilities. Background Technology

[0002] In the field of oil and gas engineering, using drones and other equipment equipped with cameras to inspect pipelines, storage tanks and other facilities is an important means of ensuring safe production. However, since the facilities are exposed to the outdoors for a long time, their surfaces are often covered with rust, oil stains and have structures such as welds and scratches. These complex backgrounds and pseudo-defects are similar to the real crack defects in the images, which seriously interferes with the accuracy of intelligent detection algorithms.

[0003] Anisotropic diffusion is an advanced image smoothing technique that iteratively smooths an image to remove noise while preserving important edge details. The core of this technique is that it controls the intensity of diffusion, i.e., smoothing, based on the magnitude of the local gradient of the image: in flat areas with small gradients, stronger diffusion is allowed to erase noise and texture; while in edge areas with large gradients, diffusion is suppressed to protect the edges from being blurred.

[0004] However, existing anisotropic diffusion methods have significant technical problems: their sole criterion for judging and protecting edges is the magnitude of the local gradient, while completely ignoring the geometric information of the edges; this means that whether it is a thin, winding real crack, a thick, regular weld, or a sharp shadow, as long as their gradient strengths are similar and large enough, they will be preserved by the algorithm without difference.

[0005] Therefore, after processing the images of oil and gas facilities, although the rust and oil stains in the background are smoothed to a certain extent, false defects such as welds and scratches are also retained or even sharpened. This does not reduce the difficulty for subsequent algorithms to distinguish between real cracks and false defects, and affects the accuracy of defect detection in oil and gas facilities. Summary of the Invention

[0006] To address the technical problem that the aforementioned anisotropic diffusion algorithm, when protecting edges, only considers the gradient intensity while completely ignoring the edge morphology, resulting in the inability to distinguish between slender, continuous crack morphologies and coarse, regular weld morphologies, thus affecting the accuracy of defect detection in oil and gas facilities, this invention provides a machine vision-based intelligent detection method for oil and gas engineering supporting facilities. The method includes: acquiring an image of the oil and gas facility to be inspected; constructing a structure tensor matrix based on the gradient of each pixel; calculating the local linear structure response value of each pixel based on two eigenvalues ​​of the structure tensor matrix; performing bidirectional path tracing along the direction of the eigenvector corresponding to the smallest eigenvalue to obtain the local path of the pixel; calculating the crack continuity of the pixel based on the directional alignment of the eigenvectors of the pixels on the local path; using the product of the local linear structure response value and the crack continuity as the morphological saliency value of the pixel; adjusting the basic contrast parameter based on the morphological saliency value to obtain the adaptive contrast parameter of the pixel; performing anisotropic diffusion processing on the image to be inspected based on the adaptive contrast parameter of the pixel, and obtaining an enhanced image through multiple iterations; and performing edge detection on the enhanced image to obtain a defect detection result image.

[0007] This invention constructs morphological saliency values ​​for pixels, integrating the local linear structure response values ​​and crack continuity of pixels to obtain adaptive contrast parameters capable of identifying edge morphology. This allows diffusion processing to no longer indiscriminately protect all strong edges, but instead to provide strong protection for real crack regions with slender and continuous features. At the same time, it smooths out pseudo-defects that do not possess such morphological features, such as coarse welds and patchy rust. This fundamentally solves the problem of traditional methods easily misjudging pseudo-defects as cracks, significantly improving the accuracy and reliability of detection.

[0008] Preferably, the step of constructing a structure tensor matrix based on the gradient of a pixel includes: taking any pixel as the target pixel, obtaining a neighborhood window with a size of 3×3 centered on the target pixel, and taking the pixels in the neighborhood window as the neighborhood pixels of the target pixel. In the formula, The structure tensor matrix of the target pixel; and The target pixel is the first The horizontal and vertical gradients of each neighboring pixel; For the neighborhood window of the target pixel.

[0009] Preferably, the step of calculating the local linear structure response value of a pixel based on two eigenvalues ​​of the structure tensor matrix includes: In the formula, This represents the local linear structure response value of a pixel. , Let be the eigenvalues ​​of the structure tensor matrix of the pixel, and .

[0010] This invention utilizes the ratio of the difference to the square of the sum of the eigenvalues ​​of the structural tensor matrix to characterize the linearity of the local structure of a pixel, effectively distinguishing linear cracks with high response values ​​from corners or flat areas with low response values, thus providing data for subsequent morphological saliency assessment.

[0011] Preferably, the step of performing bidirectional path tracing along the direction of the eigenvector corresponding to the smallest eigenvalue to obtain the local path of the pixel includes: based on the structure tensor matrix of the pixel. Two eigenvalues and , obtain eigenvalues corresponding feature vector and eigenvalues corresponding feature vector ; along the eigenvector Perform bidirectional path tracing in the direction of [the path] to obtain a path of length equal to [the path's length]. Local path, This is the preset length.

[0012] Preferably, calculating the crack continuity of a pixel based on the orientation alignment of its feature vectors along the local path includes: In the formula, For pixels Crack continuity; The length of the local path is equal to the preset length. ; In pixels Centered on the feature vector Local path in the direction, For pixels eigenvalues The corresponding feature vector; For pixels on a local path; For pixels eigenvalues The corresponding feature vector; This is the dot product operation for vectors; This indicates taking the absolute value.

[0013] This invention constructs a crack continuity index by calculating the mean of the dot product of the edge direction vector and the center point direction vector of all pixels on a local path. This index can effectively determine whether a pixel belongs to a continuous linear structure, thereby distinguishing truly continuous cracks from isolated and discontinuous pseudo-defects and enhancing the ability to identify complete crack structures.

[0014] Preferably, the step of adjusting the base contrast parameters based on morphological saliency values ​​to obtain adaptive contrast parameters for pixels includes: In the formula, For the adaptive contrast parameters of the pixels; Basic contrast parameters; The morphological saliency value of the pixel; It is a regulating factor.

[0015] This invention dynamically adjusts the contrast parameter based on the morphological saliency value of each pixel. When the morphological saliency value is high, the adaptive contrast parameter is low to protect the crack. When the morphological saliency value is low, the adaptive contrast parameter is high to smooth out pseudo-defects, thereby accurately converting the results of morphological analysis into control of diffusion behavior.

[0016] Preferably, the pixel-based adaptive contrast parameter performs anisotropic diffusion processing on the image to be detected, and obtains an enhanced image through multiple iterative updates, including: the first... The image of the next iteration is generated by the first... The image is obtained from the next iteration, and the specific calculation formula is: In the formula, Let be the number of iterations, and ; For the first sequence Coordinates in the image of the next iteration The grayscale value of the pixel at that location; This is the iteration step size; For the first Coordinates in the image of the next iteration The divergence operator for the pixels at that location.

[0017] Preferably, the formula for calculating the divergence operator of the pixel is: In the formula, , For the first Coordinates in the image of the next iteration , The horizontal flux of the pixel at that location; , For the first Coordinates in the image of the next iteration , The vertical flux of the pixel at point ; the flux of a pixel is equal to the product of the pixel's diffusion coefficient and gradient vector, for the . Coordinates in the image of the next iteration The gradient vector of the pixel at that location , , The first Coordinates in the image of the next iteration The horizontal and vertical gradients of the pixels at that location.

[0018] Preferably, the diffusion coefficient of the pixel is calculated using the following formula: In the formula, For the first Coordinates in the image of the next iteration The diffusion coefficient of the pixel at that location; For the first Coordinates in the image of the next iteration The gradient vector of the pixel at that location; Indicates the magnitude of the vector; Coordinates in the image to be detected The adaptive contrast parameter of the pixel at that location.

[0019] This invention combines the adaptive contrast parameter of pixels to calculate the diffusion coefficient of pixels, so that the diffusion intensity of each pixel is determined by its own morphological features and gradient, ensuring that the results of morphological analysis can accurately guide each step of the diffusion process.

[0020] Preferably, the step of performing edge detection on the enhanced image to obtain a defect detection result image includes: performing edge detection on the enhanced image using the Canny edge detection algorithm to obtain an edge detection result image, wherein the edge detection result image is a binary image, in which white pixels are strong edge pixels, representing defects such as cracks; removing edges with a length of less than 20 from the edge detection result image to obtain the defect detection result image.

[0021] The beneficial effects of this invention are as follows:

[0022] This invention constructs morphological saliency values ​​for pixels, integrating the local linear structure response values ​​and crack continuity of pixels to obtain adaptive contrast parameters capable of identifying edge morphology. This allows diffusion processing to no longer indiscriminately protect all strong edges, but instead to provide strong protection for real crack regions with slender and continuous features. At the same time, it smooths out pseudo-defects that do not possess such morphological features, such as coarse welds and patchy rust. This fundamentally solves the problem of traditional methods easily misjudging pseudo-defects as cracks, significantly improving the accuracy and reliability of detection. Attached Figure Description

[0023] Figure 1 This is a flowchart illustrating an intelligent detection method for oil and gas engineering supporting facilities based on machine vision, as described in this invention.

[0024] Figure 2This is a flowchart illustrating step S2;

[0025] Figure 3 This is a flowchart illustrating step S3;

[0026] Figure 4 This is a schematic diagram illustrating the image to be detected;

[0027] Figure 5 It is an illustrative representation of the... Figure 4 The image to be updated in the second iteration;

[0028] Figure 6 It is an illustrative representation of the... Figure 4 The image undergoing its 5th iteration update;

[0029] Figure 7 It is shown schematically. Figure 6 The edge detection results are shown in the image.

[0030] Figure 8 It is shown schematically. Figure 6 The defect detection results are shown in the image. Detailed Implementation

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

[0032] The specific embodiments of the present invention will now be described in detail with reference to the accompanying drawings.

[0033] This invention discloses an intelligent detection method for oil and gas engineering supporting facilities based on machine vision, referring to... Figure 1 This includes steps S1 to S4:

[0034] S1: Acquire images of the oil and gas facilities to be inspected.

[0035] It should be noted that the raw drone aerial images collected contain Gaussian white noise introduced by the camera sensor or the transmission process. This random noise can seriously interfere with the accuracy of subsequent gradient and structure tensor calculations. Therefore, the images need to be preliminarily smoothed to suppress this type of noise.

[0036] Specifically, the original images of the oil and gas facilities to be inspected are acquired using the onboard camera of the UAV, and the acquired original images are preprocessed with Gaussian smoothing to obtain the images of the oil and gas facilities to be inspected, so as to suppress Gaussian white noise in the original images and provide a basis for the subsequent stable calculation of the structure tensor.

[0037] The Gaussian kernel function is a commonly used smoothing filter. It achieves smoothing by weighting the neighboring pixels. The weights are determined by the distance from the neighboring pixels to the center pixel, which conforms to a normal distribution and can effectively suppress Gaussian noise that follows a normal distribution.

[0038] It should be noted that Gaussian smoothing effectively filters out random Gaussian noise in the image, providing a stable and reliable data foundation for the accurate calculation of the structure tensor in the subsequent S2 step, avoiding the interference of noise on gradient calculation, and thus improving the accuracy of morphological analysis.

[0039] S2: Construct a structure tensor matrix based on the gradient of the pixel. Calculate the local linear structure response value of the pixel based on the two eigenvalues ​​of the structure tensor matrix. Calculate the crack continuity of the pixel based on the directional alignment of the eigenvectors of the pixel on the local path, and then calculate the morphological saliency value of the pixel.

[0040] The flowchart for step S2 is shown below. Figure 2 The process includes steps S201 to S204, specifically as follows:

[0041] S201: Construct a structural tensor matrix based on the gradient of each pixel.

[0042] It should be noted that when analyzing the structural information within the neighborhood of each pixel, such as whether it is flat, an edge, or a corner, a single gradient vector is insufficient. A tool that can describe the gradient distribution is needed. The structure tensor, by calculating the second-order mixing central moments of the gradient components, can comprehensively describe the distribution of all gradient vectors in the local neighborhood, which is the basis for morphological analysis.

[0043] Specifically, for each pixel in the image to be detected, its horizontal gradient is calculated. and vertical gradient Specific methods include, but are not limited to, the Sobel operator and the Laplacian operator.

[0044] Furthermore, taking any pixel as the target pixel, a 3×3 neighborhood window centered on the target pixel is obtained, and the pixels in the neighborhood window are taken as the neighbors of the target pixel. Based on the gradient information of the neighboring pixels of the target pixel, the structure tensor matrix of the target pixel is constructed. The specific calculation formula is as follows:

[0045] ;

[0046] In the formula, The structure tensor matrix of the target pixel; and The target pixel is the first The horizontal and vertical gradients of each neighboring pixel; For the neighborhood window of the target pixel.

[0047] It should be noted that by constructing a structural tensor, the local information of each pixel is transformed from the gradient vector into a matrix that can describe the gradient distribution, providing a strong data basis for subsequently distinguishing linear, point-like, and flat regions.

[0048] S202: Calculate the local linear structure response value of the pixel based on the two eigenvalues ​​of the structure tensor matrix.

[0049] It should be noted that by performing feature analysis on the structural tensor matrix, the eigenvalues ​​and eigenvectors reveal the local geometric structure: the eigenvalues ​​are used to characterize the linearity, and the eigenvectors are used to determine the edge direction; when one eigenvalue is much larger than the other, it indicates that the gradient is highly concentrated in a certain direction, while the change in its orthogonal direction is very small. This is a typical feature of linear or edge structures. Therefore, this invention constructs an index based on the difference in eigenvalues ​​to quantify the linearity of each pixel.

[0050] Specifically, for the structure tensor matrix of each pixel Perform eigenvalue decomposition to obtain two eigenvalues. and ,and .

[0051] Furthermore, based on eigenvalues and The local linear structure response value of a pixel is calculated using the following formula:

[0052] ;

[0053] In the formula, This represents the local linear structure response value of a pixel. , These are the eigenvalues ​​of the structure tensor matrix of the pixels.

[0054] Among them, the local linear structure response value of a pixel is obtained by using the ratio of the difference in feature values ​​to the sum of the feature values: when At this time, it belongs to a typical linear structure, the numerator is close to the denominator, the ratio approaches 1, and the local linear structure response value It also approaches 1; when At this time, in areas with corners or complex textures, the molecular response value is close to 0, and the local linear structure response value is... Approaching 0; when At that time, it was a flat area. Equal to 0, local linear structure response value It equals 0.

[0055] It should be noted that the local linear structure feature value of a pixel represents the probability that each pixel belongs to a linear structure. This allows linear regions such as cracks, welds, and scratches in the image to obtain high response values, while the response values ​​of non-linear regions such as the background and rust spots are suppressed, thus achieving preliminary screening of linear morphologies.

[0056] S203: Perform bidirectional path tracing along the direction of the eigenvector corresponding to the smallest eigenvalue to obtain the local path of the pixel; calculate the crack continuity of the pixel based on the alignment degree of the eigenvector of the pixel on the local path.

[0057] It should be noted that real cracks are not only linear in their local areas, but also exhibit good continuity as a whole. In contrast, many pseudo-features, such as isolated scratches or texture noise, may also appear linear locally, but they lack extensibility. The eigenvectors of the structure tensor indicate the direction of the local edges. By comparing whether the edge directions of neighboring pixels are consistent, continuity can be effectively measured.

[0058] Specifically, based on the structure tensor matrix of the pixel. Two eigenvalues and , obtain eigenvalues corresponding feature vector and eigenvalues corresponding feature vector Among them, the smallest eigenvalue corresponding feature vector It indicates the direction of the local linear structure, that is, the tangent direction of the edge.

[0059] It should be noted that eigenvalue decomposition of the structure tensor matrix to obtain two eigenvalues, and obtaining the corresponding eigenvectors based on the two eigenvalues, are well-known techniques and will not be elaborated here.

[0060] Furthermore, for each pixel, along the feature vector Perform bidirectional path tracing in the direction of [the path] to obtain a path of length equal to [the path's length]. The local path.

[0061] in, The preset length is a spatial scale standard used to measure the continuity of a local path, thereby distinguishing between true continuous cracks and accidentally formed short linear noise or pseudo-features. Therefore, the preset length... The value range is [7, 21], and it is an odd number. This invention will preset the length... Set it to 13.

[0062] Furthermore, based on the directional alignment of the feature vectors of pixels along the local path, the crack continuity of the pixels is calculated. The specific calculation formula is as follows:

[0063] ;

[0064] In the formula, For pixels Crack continuity; In pixels Centered on the feature vector Local path in the direction, For pixels eigenvalues The corresponding feature vector; For pixels on a local path; For pixels eigenvalues The corresponding feature vector; This is the dot product operation for vectors; This indicates taking the absolute value. Representing the eigenvector and eigenvectors The absolute value of the dot product measures the alignment of two vectors in a direction, with a range of [0,1].

[0065] In this invention, the continuity of a crack at a pixel is measured by the alignment of the edge direction vectors of all pixels along a local path with the edge direction vector of the central pixel. If all pixels along the local path belong to the same continuous crack, their edge directions will be highly consistent, and their dot product will all approach 1. The resulting pixel... Crack continuity It also approaches 1; if the local path passes through regions with abrupt changes in direction or interruptions, the dot product result will become smaller, thus reducing the number of pixels. Crack continuity .

[0066] It should be noted that the constructed crack continuity provides a key basis for distinguishing between continuous real cracks and discontinuous pseudo-features, adds an index of structural continuity to linear features, and makes morphological analysis more in-depth and reliable.

[0067] S204: Obtain the morphological saliency value of a pixel by multiplying the local linear structure response value of the pixel with the crack continuity.

[0068] It should be noted that the confidence level of a pixel belonging to a real crack should depend on both its local linear morphology and the macroscopic continuity of its structure. The local linear structure response value and crack continuity obtained in steps S202 and S203 are combined to obtain the morphological saliency value of the pixel. Pixels with high values ​​satisfy both local linearity and global continuity, thereby distinguishing them from pseudo features to the greatest extent.

[0069] Specifically, the product of the local linear structure response value of a pixel and the crack continuity is used as the morphological saliency value of the pixel; the morphological saliency values ​​of all pixels in the image to be detected are used to form the morphological saliency map of the image to be detected.

[0070] Among them, only when a pixel has both high linearity and high continuity, that is, when both the local linear structure response value and crack continuity are large, will its final significance value be high. If the value of either one is low, the final result will be suppressed. This ensures that only those structures that are both linear and continuous, that is, structures that best match the shape of cracks, can be highlighted in the final map.

[0071] It should be noted that the generated morphological saliency map is a crack probability map, which can be used to accurately identify the most likely location of cracks in the image to be detected, providing pixel-level spatial guidance for the adaptive control of anisotropic diffusion in subsequent steps.

[0072] S3: Adjust the basic contrast parameters based on the morphological saliency value to obtain the adaptive contrast parameters of the pixels, perform anisotropic diffusion processing on the image to be detected, and obtain the enhanced image through multiple iterations.

[0073] Refer to the flowchart for step S3 Figure 3 The process includes steps S301 to S302, specifically as follows:

[0074] S301: Adjust the basic contrast parameters based on the morphological saliency value to obtain the adaptive contrast parameters of the pixels.

[0075] It should be noted that the fundamental drawback of traditional anisotropic diffusion is that its contrast parameter is globally fixed. In order for the diffusion process to identify and differentiate edges of different shapes, morphological information needs to be introduced into the diffusion control, and the contrast parameter needs to be dynamically adjusted according to the morphological saliency map obtained in step S2.

[0076] Specifically, based on the morphological saliency value of each pixel, the adaptive contrast parameter of each pixel is calculated, and the specific calculation formula is as follows:

[0077] ;

[0078] In the formula, For the adaptive contrast parameters of the pixels; The basic contrast parameter is a fundamental parameter set for the diffusion algorithm before morphological information is introduced. It corresponds to the gradient intensity of the weakest crack that is expected to be detected, and therefore its value range is [5, 20]. This invention uses the basic contrast parameter... Set to 10; The morphological saliency value of the pixel; This is a modulating factor used to control the intensity of the influence of morphological information on the contrast parameter. The larger the value, the stronger the influence of morphological information, and the greater the ability to smooth the edges of non-crack morphological features. Within [1,10], morphological information can significantly modulate diffusion behavior; therefore, the moderating factor... The value range is [1, 10]. This invention will adjust the factor. Set it to 5.

[0079] Among them, when the morphological saliency value of a pixel When the value is close to 1, it indicates a strong crack characteristic. When the term is close to 0, at this time The value approaches the base contrast parameter Or even smaller, which makes diffusion extremely sensitive to gradients; even weak crack gradients will be identified as strong edges and strongly protected, while conversely, when the morphological saliency value of a pixel is high... If the value is close to 0, it may be a characteristic of welds or rust spots. When the term is close to 1, at this time The value of can become very large, which makes the diffusion response to gradients sluggish. Even weld edges with strong gradients may be treated as internal textures and smoothed by the algorithm.

[0080] It should be noted that by constructing adaptive contrast parameters By incorporating morphological semantic information into the diffusion algorithm, the diffusion process is transformed from simply preserving edges to purposefully retaining edges of specific shapes (such as cracks).

[0081] S302: Based on the adaptive contrast parameter, anisotropic diffusion processing is performed on the image to be detected, and an enhanced image is obtained through multiple iterations.

[0082] It should be noted that after obtaining the adaptive contrast parameter, it is applied to the anisotropic diffusion iteration process to perform the final image enhancement process. Through multiple iterations, the guiding effect of morphological information gradually accumulates and manifests throughout the entire image range.

[0083] Specifically, based on the adaptive contrast parameter of the pixels, anisotropic diffusion processing is performed on the image to be detected. After 5 iterations, the image of the 5th iteration is used as the final enhanced image.

[0084] Among them, the The image of the next iteration is generated by the first... The image was calculated in the next iteration. Let be the number of iterations, and The specific calculation formula is as follows:

[0085] ;

[0086] In the formula, For the first Coordinates in the image of the next iteration The grayscale value of the pixel at that location; For the first Coordinates in the image of the next iteration The grayscale value of the pixel at that location; For the first Coordinates in the image of the next iteration The divergence operator for the pixel at that location; The iteration step size controls the evolution magnitude of a single iteration, ensuring that the entire iteration process is stable and convergent. The value range is [0.1, 0.2]. This invention uses the iteration step size... Set it to 0.15.

[0087] The formula for calculating the divergence operator of a pixel is:

[0088] ;

[0089] In the formula, , For the first Coordinates in the image of the next iteration , The horizontal flux of the pixel at that location; , For the first Coordinates in the image of the next iteration , The vertical flux of the pixel at point ; the flux of a pixel is equal to the product of the diffusion coefficient and the gradient vector, for the . Coordinates in the image of the next iteration The gradient vector of the pixel at that location , , The first Coordinates in the image of the next iteration The horizontal and vertical gradients of a pixel are given, therefore, the flux of a pixel includes both horizontal and vertical flux.

[0090] The pixel diffusion coefficient is calculated based on the magnitude of the pixel's gradient vector and the adaptive contrast parameter. Therefore, the 1st... Coordinates in the image of the next iteration Diffusion coefficient of pixels at that location The formula for calculation is:

[0091] ;

[0092] In the formula, For the first Coordinates in the image of the next iteration The gradient vector of the pixel at that location; Represents the magnitude of the vector; the magnitude of the gradient vector of a pixel. The gradient vector of a pixel represents the degree of grayscale change at the pixel. The gradient vector of a pixel at the edge has a large magnitude, while the gradient vector of a pixel in a flat area has a small magnitude. Coordinates in the image to be detected The adaptive contrast parameter of the pixel at that location.

[0093] Wherein, if the gradient magnitude of the pixel If the gradient magnitude is much smaller than the adaptive contrast parameter of the pixel, it means that even if there is a grayscale change, it is a grayscale change that can be smoothed out. Therefore, the denominator is close to 1, and the diffusion coefficient is close to 1. If the value is much larger than the adaptive contrast parameter of that pixel, it indicates that this is a strong edge that needs to be protected. In this case, the denominator will become very large, and the diffusion coefficient will be close to 0.

[0094] It should be noted that by iterating multiple times and adding morphological guidance information to the image to be detected, the structure and edges of the real crack are completely preserved and the contrast is enhanced in the obtained enhanced image, while false defects such as welds, rust spots, and oil stains, as well as background noise, are significantly smoothed, thus achieving efficient separation of the two.

[0095] For example, targeting Figure 4 The image to be detected includes cracks and welds, wherein the cracks have relatively low contrast with the background, while the welds are clear and have high gradient values; the method of the present invention is used to detect... Figure 4 Anisotropic diffusion processing is performed, and the final enhanced image is obtained through 5 iterations. Figure 5 The image shown is schematically illustrated in the second iteration update. Figure 6The image of the 5th iteration update is schematically shown, which is the final enhanced image; in the final enhanced image: real cracks are perfectly preserved and enhanced, and their contrast is higher and clearer due to the smoothing of the surrounding background, while pseudo-defects such as welds are significantly smoothed and suppressed.

[0096] S4: Perform edge detection on the enhanced image to obtain the defect detection result image.

[0097] It should be noted that after the S3 morphological adaptive diffusion processing, the real crack becomes a high-contrast structure in the image, and the final defect result is accurately extracted through edge detection.

[0098] Specifically, the enhanced image is edge-detected using the Canny edge detection algorithm to obtain an edge detection result image, which is a binary image. White pixels (pixels marked as 1) are strong edge pixels, representing defects such as cracks, while black pixels (pixels marked as 0) belong to the background pixels. Edges with a length less than 20 in the edge detection result image are removed to obtain a defect detection result image.

[0099] For example, targeting Figure 6 The final enhanced image shown is obtained by performing edge detection on the enhanced image using the Canny edge detection algorithm, as shown in the image below. Figure 7 As shown, by removing Figure 7 For edges with a length less than 20, the defect detection results are shown in the figure below. Figure 8 As shown, a clear and complete crack was extracted. Therefore, by introducing morphological analysis, this invention achieves accurate identification and extraction of real defects under complex interference.

[0100] It should be noted that by constructing an adaptive contrast parameter that can identify edge morphology, the diffusion process no longer indiscriminately protects all strong edges, but can strongly protect real crack areas with slender and continuous features, while smoothing pseudo-defects that do not have such morphological features, such as coarse welds and patchy rust. This fundamentally solves the problem that traditional methods easily misjudge pseudo-defects as cracks, and significantly improves the accuracy and reliability of detection.

Claims

1. A machine vision-based intelligent detection method for oil and gas engineering supporting facilities, characterized in that, include: Acquire images of oil and gas facilities to be inspected; Constructing a structural tensor matrix based on the gradient of each pixel; Based on the two eigenvalues ​​of the structure tensor matrix, calculate the local linear structure response value of the pixel; perform bidirectional path tracing along the direction of the eigenvector corresponding to the smallest eigenvalue to obtain the local path of the pixel; calculate the crack continuity of the pixel based on the directional alignment of the eigenvectors of the pixel on the local path; and use the product of the local linear structure response value of the pixel and the crack continuity as the morphological saliency value of the pixel. The basic contrast parameters are adjusted based on the morphological saliency value to obtain the adaptive contrast parameters of the pixels; based on the adaptive contrast parameters of the pixels, anisotropic diffusion processing is performed on the image to be detected, and the enhanced image is obtained through multiple iterations. The process of performing edge detection on the enhanced image to obtain a defect detection result image includes: performing edge detection on the enhanced image using the Canny edge detection algorithm to obtain an edge detection result image, wherein the edge detection result image is a binary image, in which white pixels are strong edge pixels, representing crack defects; and removing edges with a length of less than 20 from the edge detection result image to obtain the defect detection result image.

2. The intelligent detection method for oil and gas engineering supporting facilities based on machine vision according to claim 1, characterized in that, The gradient-based construction of the structure tensor matrix based on pixels includes: Take any pixel as the target pixel, obtain a neighborhood window with a size of 3×3 centered on the target pixel, and take the pixels in the neighborhood window as the neighborhood pixels of the target pixel. ; In the formula, The structure tensor matrix of the target pixel; and The target pixel is the first The horizontal and vertical gradients of each neighboring pixel; For the neighborhood window of the target pixel.

3. The intelligent detection method for oil and gas engineering supporting facilities based on machine vision according to claim 1, characterized in that, The step of calculating the local linear structure response value of a pixel based on two eigenvalues ​​of the structure tensor matrix includes: ; In the formula, This represents the local linear structure response value of a pixel. , Let be the eigenvalues ​​of the structure tensor matrix of the pixel, and .

4. The intelligent detection method for oil and gas engineering supporting facilities based on machine vision according to claim 3, characterized in that, The step of performing bidirectional path tracing along the direction of the feature vector corresponding to the smallest feature value to obtain the local path of the pixel includes: Based on the structure tensor matrix of the pixel Two eigenvalues and , obtain eigenvalues corresponding feature vector and eigenvalues corresponding feature vector ; Along the feature vector Perform bidirectional path tracing in the direction of [the path] to obtain a path of length equal to [the path's length]. Local path, This is the preset length.

5. The intelligent detection method for oil and gas engineering supporting facilities based on machine vision according to claim 1, characterized in that, The step of calculating the crack continuity of pixels based on the orientation alignment of the feature vectors of pixels on the local path includes: ; In the formula, For pixels Crack continuity; The length of the local path is equal to the preset length. ; In pixels Centered on the feature vector Local path in the direction, For pixels eigenvalues The corresponding feature vector; For pixels on a local path; For pixels eigenvalues The corresponding feature vector; This is the dot product operation for vectors; This indicates taking the absolute value.

6. The intelligent detection method for oil and gas engineering supporting facilities based on machine vision according to claim 1, characterized in that, The step of adjusting the base contrast parameters based on morphological saliency values ​​to obtain adaptive contrast parameters for pixels includes: ; In the formula, For the adaptive contrast parameters of the pixels; Basic contrast parameters; The morphological significance value of the pixel; It is a regulating factor.

7. The intelligent detection method for oil and gas engineering supporting facilities based on machine vision according to claim 1, characterized in that, The pixel-based adaptive contrast parameter is used to perform anisotropic diffusion processing on the image to be detected, and through multiple iterations, an enhanced image is obtained, including: No. The image of the next iteration is generated by the first... The image is obtained from the next iteration, and the specific calculation formula is: ; In the formula, Let be the number of iterations, and ; For the first sequence Coordinates in the image of the next iteration The grayscale value of the pixel at that location; This is the iteration step size; For the first Coordinates in the image of the next iteration The divergence operator for the pixels at that location.

8. The intelligent detection method for oil and gas engineering supporting facilities based on machine vision according to claim 7, characterized in that, The formula for calculating the divergence operator of the pixel is: ; In the formula, , For the first Coordinates in the image of the next iteration , The horizontal flux of the pixel at that location; , For the first Coordinates in the image of the next iteration , The vertical flux of the pixel at point ; the flux of a pixel is equal to the product of the pixel's diffusion coefficient and gradient vector, for the . Coordinates in the image of the next iteration The gradient vector of the pixel at position [0, 1]. , , The first Coordinates in the image of the next iteration The horizontal and vertical gradients of the pixels at that location.

9. The intelligent detection method for oil and gas engineering supporting facilities based on machine vision according to claim 8, characterized in that, The formula for calculating the diffusion coefficient of the pixel is: ; In the formula, For the first Coordinates in the image of the next iteration The diffusion coefficient of the pixel at that location; For the first Coordinates in the image of the next iteration The gradient vector of the pixel at that location; Indicates the magnitude of the vector; Coordinates in the image to be detected The adaptive contrast parameter of the pixel at that location.

Citation Information

Patent Citations

  • Printing piece flaw detection method and system based on machine vision

    CN120334236A

  • Image monitoring system for traditional village heritage risk assessment

    CN120495877A