Oil and gas engineering supporting facility intelligent detection method based on machine vision
By constructing a structural tensor matrix and adaptive contrast parameters, the problem that anisotropic diffusion algorithms cannot distinguish between cracks and pseudo-defects was solved, achieving high accuracy and reliability in oil and gas facility detection.
Patent Information
- Application Number
- CN202511325082.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-09-17
- Publication Date
- 2025-10-24
- Estimated Expiration
- 2045-09-17
AI Technical Summary
Existing anisotropic diffusion algorithms, when protecting edges, rely solely on the magnitude of local gradients while ignoring the edge morphology. This results in an inability to distinguish between slender, continuous cracks and coarse, regular welds, which are pseudo-defects, affecting the accuracy of defect detection in oil and gas facilities.
By constructing the structure tensor matrix of pixels, calculating the local linear structure response value and crack continuity, obtaining morphological saliency values, adjusting adaptive contrast parameters, performing anisotropic diffusion processing, enhancing the image, and performing edge detection.
It significantly improves the accuracy and reliability of defect detection in oil and gas facilities, and can identify long and continuous real cracks and smooth out false defects such as coarse welds and patchy rust.
Smart Images

Figure CN120833329A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of image processing. More particularly, the present application relates to an intelligent detection method for oil and gas engineering facilities based on machine vision. BACKGROUND
[0002] In the field of oil and gas engineering, using unmanned aerial vehicles and other equipment to carry cameras to patrol and inspect pipelines, storage tanks and other facilities is an important means to ensure safety in production. However, due to the long-term exposure of facilities to the outdoors, rust, oil stains often adhere to the surface of the facilities, and there are welds, scratches and other structures. These complex backgrounds and pseudo-defects are similar to the characteristics of real cracks in images, which seriously interfere with the accuracy of intelligent detection algorithms.
[0003] Anisotropic diffusion algorithm is an advanced image smoothing technique that iteratively smooths images to remove noise while preserving important edge details. The core of this technique is that it controls the strength of diffusion (smoothing) according to the local gradient size of the image: in flat areas with small gradients, strong diffusion is allowed to remove noise and texture; in edge areas with large gradients, diffusion is suppressed to protect the edges from being blurred.
[0004] However, the existing anisotropic diffusion method has a significant technical problem: the only basis for its judgment and protection of edges is the size of the local gradient, completely ignoring the geometric shape information of the edges. This means that whether it is a real crack that is thin and winding, a thick and regular weld, or a sharp shadow, as long as their gradient intensity is similar and large enough, they will be preserved by the algorithm without distinction.
[0005] Therefore, after processing the images of oil and gas facilities, although the rust and oil stains in the background are smoothed to some extent, the pseudo-defects such as welds and scratches are also retained or even sharpened, which does not reduce the difficulty of distinguishing real cracks from pseudo-defects in subsequent algorithms, and affects the accuracy of defect detection of oil and gas facilities. SUMMARY
[0006] To solve the technical problems that the anisotropic diffusion algorithm only considers the intensity of the gradient when protecting the edge, and completely ignores the morphology of the edge, which leads to the inability to distinguish between the slender continuous crack morphology and the coarse regular weld morphology and other pseudo defects, and affects the accuracy of the defect detection of oil and gas facilities, the present application provides an intelligent detection method for oil and gas engineering supporting facilities based on machine vision, which comprises the following steps: acquiring an image to be detected of an oil and gas facility; constructing a structure tensor matrix based on the gradient of a pixel point; calculating a local linear structure response value of the pixel point according to two eigenvalues of the structure tensor matrix; performing bidirectional path tracking along the direction of the eigenvector corresponding to the smallest eigenvalue to obtain a local path of the pixel point; calculating the crack continuity of the pixel point according to the alignment degree of the direction of the eigenvector of the pixel point on the local path; taking the product of the local linear structure response value of the pixel point and the crack continuity as the morphological saliency value of the pixel point; adjusting a basic contrast parameter according to the morphological saliency value to obtain an adaptive contrast parameter of the pixel point; performing anisotropic diffusion processing on the image to be detected based on the adaptive contrast parameter of the pixel point, and obtaining an enhanced image through multiple iteration updates; performing edge detection on the enhanced image to obtain a defect detection result image.
[0007] The present application constructs the morphological saliency value of the pixel point, comprehensively considers the local linear structure response value and the crack continuity of the pixel point, thereby obtaining an adaptive contrast parameter capable of identifying the edge morphology, so that the diffusion processing is no longer indiscriminately protecting all strong edges, but can strongly protect the real crack area with the characteristics of being slender and continuous, and at the same time, can perform smoothing processing on pseudo defects without such morphological characteristics, such as coarse welds and patchy rust, thereby fundamentally solving the problem that the traditional method is prone to misjudging pseudo defects as cracks, and significantly improving the accuracy and reliability of the detection.
[0008] Preferably, the structure tensor matrix based on the gradient of the pixel point is constructed, comprising: taking any one pixel point as a target pixel point, obtaining a neighborhood window with the target pixel point as the center and a size of 3*3, and taking the pixel points in the neighborhood window as the neighborhood pixel points of the target pixel point. ; in the formula, is the structure tensor matrix of the target pixel point; and are the horizontal gradient and the vertical gradient of the th neighborhood pixel point of the target pixel point, respectively; is the neighborhood window of the target pixel point.
[0009] Preferably, the local linear structure response value of the pixel point is calculated according to the two eigenvalues of the structure tensor matrix, comprising: ; in the formula, is the local linear structure response value of the pixel point; , is an eigenvalue of the structure tensor matrix of the pixel point, and .
[0010] The application uses the square ratio of the difference and sum of the eigenvalues of the structure tensor matrix to represent the linear degree of the local structure of the pixel point, effectively distinguishes the linear crack with high response value from the corner point or flat area with low response value, and provides data basis for subsequent morphological significance judgment.
[0011] Preferably, the bidirectional path tracking is performed along the direction of the eigenvector corresponding to the minimum eigenvalue, to obtain the local path of the pixel point, including: according to two eigenvalues and of the structure tensor matrix of the pixel point, obtaining the eigenvector corresponding to the eigenvalue and the eigenvector corresponding to the eigenvalue ; performing bidirectional path tracking along the direction of the eigenvector to obtain a local path with a length equal to , and is a preset length.
[0012] Preferably, the crack continuity of the pixel point is calculated according to the alignment degree of the direction of the eigenvector of the pixel point on the local path, including: ; in the formula, is the crack continuity of the pixel point ; and is a preset length, and the length of the local path is equal to ; is the local path with the pixel point as the center and along the direction of the eigenvector ; is the eigenvector corresponding to the eigenvalue of the pixel point ; is a pixel point on the local path; is the eigenvector corresponding to the eigenvalue of the pixel point ; is a pixel point on the local path; is the dot product operation of the vector; represents taking the absolute value.
[0013] The application constructs the crack continuity index by calculating the dot product mean of the edge direction vector and the center point direction vector of all pixel points on the local path, can effectively judge whether a pixel point belongs to a continuous linear structure, thereby distinguishing the real continuous crack from the isolated and discontinuous pseudo-defect, and enhances the recognition ability of the complete crack structure.
[0014] Preferably, adjusting the basic contrast parameter according to the morphological significance value to obtain the adaptive contrast parameter of the pixel point includes: Where, is the adaptive contrast parameter of the pixel; is the basic contrast parameter; is the morphological significance value of the pixel; is the regulating factor.
[0015] The present invention dynamically adjusts the contrast parameter according to the morphological significance value of each pixel point. When the morphological significance value is high, the adaptive contrast parameter is low to protect cracks. When the morphological significance value is low, the adaptive contrast parameter is high to smooth pseudo-defects, thereby accurately converting the results of morphological analysis into control of diffusion behavior.
[0016] Preferably, the adaptive contrast parameter based on the pixel point is used to perform anisotropic diffusion processing on the image to be detected, and an enhanced image is obtained through multiple iterative updates, including: The image of the first iteration is given by The image of the iteration is calculated, and the specific calculation formula is: Where, is the number of iterations, and ; For the sequence The image coordinates of the iteration The gray value of the pixel at ; is the iteration step length; For the The coordinates in the image of the iteration The divergence operator of the pixel point at .
[0017] Preferably, the calculation formula of the divergence operator of the pixel point is: Where, 、 For the The coordinates in the image of the iteration 、 The horizontal flux of the pixel at ; 、 For the The image coordinates of the iteration 、 The vertical flux of the pixel at the position of the pixel is equal to the product of the diffusion coefficient of the pixel and the gradient vector. The coordinates in the image of the iteration The pixel point at which the gradient vector , 、 Respectively The coordinates in the image of the iteration The horizontal and vertical gradients of the pixel at .
[0018] Preferably, the diffusion coefficient of the pixel point is calculated as: Where, For the The coordinates in the image of the iteration The diffusion coefficient of the pixel at ; For the The coordinates in the image of the iteration The gradient vector of the pixel point at ; Represents the vector modulus; is the coordinate in the image to be detected Adaptive contrast parameter of the pixel at .
[0019] The present invention combines the adaptive contrast parameters of the pixels to calculate the diffusion coefficient of the pixels, so that the diffusion intensity of each pixel is determined by its own morphological characteristics and gradient, ensuring that the results of the morphological analysis can accurately guide each iteration of the diffusion process.
[0020] Preferably, performing edge detection on the enhanced image to obtain a defect detection result map includes: performing edge detection on the enhanced image through the Canny edge detection algorithm to obtain an edge detection result map, wherein the edge detection result map is a binary image, wherein white pixels are strong edge pixels, representing defects such as cracks; removing edges with a length of less than 20 in the edge detection result map to obtain a defect detection result map.
[0021] The beneficial effects of the present invention are: The present invention constructs the morphological significance value of the pixel point and integrates the local linear structure response value and crack continuity of the pixel point to obtain an adaptive contrast parameter that can identify the edge morphology. The diffusion processing no longer indiscriminately protects all strong edges, but can strongly protect the real crack areas with slender and continuous characteristics. At the same time, it smoothes the pseudo-defects that do not have such morphological characteristics, such as thick 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. BRIEF DESCRIPTION OF THE DRAWINGS
[0022] Figure 1 is a flow chart schematically illustrating a method for intelligent detection of oil and gas engineering supporting facilities based on machine vision in the present invention; Figure 2 is a flowchart schematically illustrating step S2; Figure 3is a flow chart schematically showing step S3; Figure 4 is a schematic diagram schematically showing an image to be detected; Figure 5 is an image to which a 2nd iteration update is performed; Figure 4 Figure 6 is an image to which a 5th iteration update is performed; Figure 4 Figure 7 is an edge detection result diagram of Figure 6 Figure 8 is a defect detection result diagram of Figure 6 DETAILED DESCRIPTION
[0023] The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are some but not all of the embodiments of the present application. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative work fall within the scope of the present application.
[0024] The specific embodiments of the present application will be described in detail below with reference to the drawings.
[0025] The embodiments of the present application disclose an intelligent detection method for oil and gas engineering supporting facilities based on machine vision, referring to Figure 1 , comprising steps S1 to S4: S1: obtaining an image to be detected of an oil and gas facility.
[0026] It should be noted that the original unmanned aerial vehicle aerial image collected contains Gaussian white noise introduced by the camera sensor or the transmission process. Such random noise will seriously interfere with the calculation accuracy of the subsequent gradient and structure tensor. Therefore, the image needs to be preliminarily smoothed to suppress such noise.
[0027] Specifically, an original image of the oil and gas facility to be detected is obtained by the onboard camera of the unmanned aerial vehicle, and the obtained original image is subjected to Gaussian smoothing preprocessing to obtain the image to be detected of the oil and gas facility, so as to suppress the Gaussian white noise in the original image and provide a basis for stable calculation of the subsequent structure tensor.
[0028] The Gaussian kernel function is a commonly used smoothing filter, which realizes smoothing by weighted average of the neighborhood pixel points, and the weight is determined by the distance from the neighborhood pixel point to the center pixel point, which conforms to the normal distribution and can effectively suppress Gaussian noise conforming to the normal distribution.
[0029] It should be noted that Gaussian smoothing effectively filters out random Gaussian noise in the image, providing a stable and reliable data basis for the precise calculation of the structure tensor in the subsequent S2 step, avoiding the interference of noise on the gradient calculation, and thus improving the accuracy of morphological analysis.
[0030] S2: Construct a structural tensor matrix based on the gradient of the pixel point. According to the two eigenvalues of the structural tensor matrix, calculate the local linear structure response value of the pixel point. According to the degree of directional alignment of the eigenvector of the pixel point on the local path, calculate the crack continuity of the pixel point, and then calculate the morphological significance value of the pixel point.
[0031] See the flowchart of step S2 Figure 2 , including steps S201 to S204, specifically: S201: Constructing a structure tensor matrix based on the gradient of the pixel points.
[0032] It should be noted that when analyzing the structural information within the neighborhood of each pixel point, whether it is flat, an edge or a corner point, a single gradient vector is insufficient, and a tool that can describe the gradient distribution is needed. The structure tensor can comprehensively describe the distribution of all gradient vectors in the local neighborhood by calculating the second-order mixed central moment of the gradient component, and is the basis for morphological analysis.
[0033] Specifically, for each pixel in the image to be detected, calculate its horizontal gradient and vertical gradient Specific methods include but are not limited to Sobel operator and Laplacian operator.
[0034] Furthermore, any pixel point is taken as the target pixel point, and a neighborhood window of size 3×3 with the target pixel point as the center is obtained. The pixels in the neighborhood window are taken as the neighborhood pixels of the target pixel point; based on the gradient information of the neighborhood pixels of the target pixel point, the structure tensor matrix of the target pixel point is constructed. , the specific calculation formula is: ; Where, is the structure tensor matrix of the target pixel; and are the target pixel points The horizontal gradient and vertical gradient of each neighborhood pixel; is the neighborhood window of the target pixel.
[0035] It should be noted that by constructing the structure tensor, the local information of each pixel is converted from the gradient vector to a matrix that can describe the gradient distribution, providing a strong data basis for the subsequent distinction between linear, point-shaped and flat areas.
[0036] S202: Calculate the local linear structure response value of the pixel point according to two eigenvalues of the structure tensor matrix.
[0037] It should be noted that the eigenvalue and eigenvector reveal the local geometric structure by performing eigenvalue analysis on the structure tensor matrix: the eigenvalue is used to represent the linear degree, and the eigenvector is 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, and changes little in its orthogonal direction, which is the typical feature of linear or edge structure, therefore, the present application constructs an index based on the difference between the eigenvalues to quantify the linear degree of each pixel point.
[0038] Specifically, the structure tensor matrix of each pixel point is subjected to eigenvalue decomposition to obtain two eigenvalues and , and .
[0039] Further, the local linear structure response value of the pixel point is calculated according to the eigenvalues and , and the specific calculation formula is: ; In the formula, is the local linear structure response value of the pixel point; , is the eigenvalue of the structure tensor matrix of the pixel point.
[0040] wherein, the local linear structure response value of the pixel point is obtained by using the ratio of the difference and the sum of the eigenvalues: when , it belongs to a typical linear structure, the numerator is close to the denominator, the ratio tends to 1, and the local linear structure response value also tends to 1; when , it belongs to a corner or a region with complex texture, the numerator is close to 0, and the local linear structure response value tends to 0; when , it belongs to a flat region, is equal to 0, and the local linear structure response value is equal to 0.
[0041] It should be noted that the local linear structure eigenvalue of the pixel point represents the possibility of each pixel point belonging to a linear structure, so that the linear regions such as cracks, welds and scratches in the image obtain high response values, and the response values of non-linear regions such as backgrounds and rust spots are suppressed, thereby realizing preliminary screening of linear morphology.
[0042] S203: performing bidirectional path tracing along the direction of the eigenvector corresponding to the minimum eigenvalue to obtain a local path of the pixel point; and calculating the crack continuity of the pixel point based on the degree of alignment of the eigenvectors of the pixel points on the local path.
[0043] It should be noted that real cracks are not only locally linear, but also show good continuity as a whole. Many pseudo-features, such as isolated scratches or texture noise, may also be locally linear but lack extensibility. The eigenvector of the structural tensor indicates the direction of the local edge. By comparing whether the edge directions of adjacent pixels are consistent, the continuity can be effectively measured.
[0044] Specifically, according to the structural tensor matrix of the pixel point The two eigenvalues of and , and obtain the eigenvalues The corresponding eigenvector and eigenvalues The corresponding eigenvector , where the smallest eigenvalue The corresponding eigenvector Indicates the direction of the local linear structure, that is, the tangent direction of the edge.
[0045] It should be noted that performing eigenvalue decomposition on the structure tensor matrix to obtain two eigenvalues, and obtaining corresponding eigenvectors based on the two eigenvalues are both well-known technologies and will not be described in detail here.
[0046] Furthermore, for each pixel, along the feature vector The bidirectional path tracking is performed in the direction of The local path.
[0047] in, The preset length is a spatial scale standard used to measure whether the local path is continuous, and to distinguish between true continuous cracks and accidentally formed short linear noise or pseudo features. Therefore, the preset length The value range of is [7,21] and is an odd number. The present invention will preset the length Set to 13.
[0048] Furthermore, the crack continuity of the pixel points is calculated based on the degree of directional alignment of the feature vectors of the pixel points on the local path. The specific calculation formula is: ; Where, Pixel Crack continuity; Pixels Centered along the eigenvector The local path in the direction of Pixel The eigenvalue of The corresponding eigenvector; is the pixel point on the local path; Pixel The eigenvalue of The corresponding eigenvector; is the dot product operation of vectors; Indicates taking the absolute value, Represents the feature vector and eigenvectors The absolute value of the dot product of measures the degree of alignment of the two vectors in direction, and its value range is [0,1].
[0049] The present invention measures the crack continuity at the pixel point by aligning the edge direction vectors of all pixel points on the local path with the edge direction vector of the central pixel point: if the pixel points on the local path all belong to the same continuous crack, their edge directions will be highly consistent, and the dot product results will be close to 1. Crack continuity Also approaches 1; if the local path passes through an area with a sudden change in direction or interruption, the dot product result will become smaller, thereby reducing the pixel point Crack continuity .
[0050] It should be noted that the constructed crack continuity provides a key basis for distinguishing continuous real cracks from discontinuous pseudo features, adds an indicator of structural continuity to linear features, and makes the morphological analysis more in-depth and reliable.
[0051] S204: Obtaining a morphological significance value of the pixel point according to the product of the local linear structure response value of the pixel point and the crack continuity.
[0052] It should be noted that the confidence that a pixel point belongs to a real crack should depend on both its local linear morphology and the macroscopic continuity of the structure to which it belongs. The local linear structure response value and crack continuity obtained in steps S202 and S203 are combined to obtain the morphological significance value of the pixel point. Pixels with high values meet the requirements of being locally linear and globally continuous, thereby being distinguished from pseudo features to the greatest extent possible.
[0053] Specifically, the product of the local linear structure response value of the pixel point and the crack continuity is used as the morphological significance value of the pixel point; the morphological significance values of all pixels in the image to be detected are combined to form a morphological significance map of the image to be detected.
[0054] Only when a pixel point has both high line feature and high continuity, i.e., the local line feature response value and the crack continuity are both large, can the final saliency value be high. If either one is low, the final result will be suppressed. In this way, only the structure that is both line and continuous, i.e., the structure that is most consistent with the morphology of the crack, can be highlighted in the final atlas.
[0055] It should be noted that the generated morphological saliency atlas is a crack probability map, which can be used to accurately identify the position where the crack is most likely to exist in the image to be detected, and provide pixel-level spatial guidance for the adaptive control of anisotropic diffusion in the subsequent step.
[0056] S3: Adjust the basic contrast parameter according to the morphological saliency value to obtain an adaptive contrast parameter of the pixel point, and perform anisotropic diffusion processing on the image to be detected, and obtain an enhanced image through multiple iteration updates.
[0057] The flowchart of step S3 refers to Figure 3 , including steps S301 to S302, specifically: S301: Adjust the basic contrast parameter according to the morphological saliency value to obtain an adaptive contrast parameter of the pixel point.
[0058] It should be noted that the fundamental defect of the traditional anisotropic diffusion is that the contrast parameter is globally fixed. In order to enable the diffusion process to identify and distinguish edges of different morphologies, morphological information needs to be introduced into the diffusion control, and the contrast parameter is dynamically adjusted according to the morphological saliency atlas obtained in step S2.
[0059] Specifically, according to the morphological saliency value of the pixel point, the adaptive contrast parameter of each pixel point is calculated, and the specific calculation formula is: In the formula, is the adaptive contrast parameter of the pixel point; is the basic contrast parameter, which is a basic parameter set for the diffusion algorithm before the morphological information is introduced. It corresponds to the gradient intensity of the weakest crack expected to be detected, and therefore, the value range is [5, 20]. In the present application, the basic contrast parameter is set to 10; is the morphological saliency value of the pixel point; is an adjustment factor for controlling the influence strength of the morphological information on the contrast parameter, the greater the adjustment factor is, the greater the influence strength of the morphological information is, and the stronger the smoothing ability of the non-crack morphology edge is, in [1, 10], the morphological information can significantly adjust the diffusion behavior, and therefore, the adjustment factor The value range is [1,10]. The present invention adjusts the factor Set to 5.
[0060] Among them, when the morphological significance value of a pixel When it is close to 1, it is a strong crack feature. The term is close to 0, then The value of is close to the basic contrast parameter Or smaller, which makes the diffusion very sensitive to the gradient response. Even a weak crack gradient will be identified as a strong edge and strongly protected. On the contrary, when the morphological significance value of the pixel point is Close to 0, such as weld or rust features, The term is close to 1, then The value of will become very large, which makes the diffusion response to the gradient become slow. Even the weld edge with a strong gradient may be regarded as an internal texture by the algorithm and smoothed.
[0061] It should be noted that by constructing the adaptive contrast parameter ,Introducing morphological semantic information into the diffusion algorithm,,the diffusion process changes from simply preserving edges to purposefully preserving edges of,specific morphology (such as cracks).
[0062] 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 iterative updates.
[0063] It should be noted that after obtaining the adaptive contrast parameters, they are applied to the anisotropic diffusion iterative process to perform the final image enhancement process. Through multiple iterations, the guiding effect of the morphological information is gradually accumulated and reflected in the entire image range.
[0064] Specifically, based on the adaptive contrast parameters of the pixels, anisotropic diffusion processing is performed on the image to be detected, and the image of the fifth iteration is used as the final enhanced image after five iterations.
[0065] Among them, The image of the first iteration is given by The image of the iteration is calculated, is the number of iterations, and ; The specific calculation formula is: ; Where, For the The image coordinates of the iteration The gray value of the pixel at ; For the The image coordinates of the iteration The gray value of the pixel at ; For the The coordinates in the image of the iteration The divergence operator of the pixel point at ; It is the iteration step size, which is used to control the evolution amplitude of a single iteration and ensure that the entire iterative process is stable and convergent. The value range is [0.1, 0.2]. The present invention will iterate the step length Set to 0.15.
[0066] Among them, the calculation formula of the pixel divergence operator is: ; Where, 、 For the The coordinates in the image of the iteration 、 The horizontal flux of the pixel at ; 、 For the The coordinates in the image of the iteration 、 The vertical flux of the pixel at the position is equal to the product of the diffusion coefficient and the gradient vector. The coordinates in the image of the iteration The pixel point at which the gradient vector , 、 Respectively The coordinates in the image of the iteration The horizontal gradient and vertical gradient of the pixel point at , therefore, the flux of the pixel point includes horizontal flux and vertical flux.
[0067] Among them, the diffusion coefficient of the pixel point is calculated based on the modulus of the gradient vector of the pixel point and the adaptive contrast parameter, so the first The coordinates in the image of the iteration The diffusion coefficient of the pixel at The calculation formula is: ; Where, For the The coordinates in the image of the iteration The gradient vector of the pixel at ; Represents the vector modulus; the modulus of the gradient vector of the pixel point , characterizes the severity of the grayscale change at the pixel point. The modulus of the gradient vector of the pixel point at the edge is large, and the modulus of the gradient vector of the pixel point in the flat area is small; is the coordinate in the image to be detected Adaptive contrast parameter of the pixel at .
[0068] Among them, if the gradient modulus of the pixel point is is much smaller than the adaptive contrast parameter of the pixel, indicating that even if there is a grayscale change here, it is a grayscale change that is allowed to be smoothed, then the denominator is close to 1 and the diffusion coefficient is close to 1; if the gradient modulus of the pixel is If the value is much larger than the adaptive contrast parameter of the pixel, it means that there is a strong edge that needs to be protected. Then the denominator will become very large and the diffusion coefficient will be close to 0.
[0069] It should be noted that through multiple iterations, the morphological guidance information is added to the image to be detected. In the enhanced image obtained, the structure and edges of the real cracks are completely preserved and the contrast is enhanced, while pseudo defects such as welds, rust spots, oil stains and background noise are significantly smoothed, achieving efficient separation of the two.
[0070] For example, for Figure 4 The image to be detected shown includes cracks and welds, wherein the contrast between the cracks and the background is relatively low, while the welds are clear and have a high gradient value; Figure 4 Anisotropic diffusion processing is performed and the final enhanced image is obtained through 5 iterations. Figure 5 The image updated in the second iteration is schematically shown. Figure 6 The image updated after the fifth iteration, i.e., the final enhanced image, is shown schematically. In the final enhanced image, the real cracks are perfectly preserved and enhanced, and because the surrounding background is smoothed, their contrast is higher and clearer, while pseudo defects such as welds are significantly smoothed and suppressed.
[0071] S4: Perform edge detection on the enhanced image to obtain a defect detection result image.
[0072] It should be noted that after the morphological adaptive diffusion processing of S3, the real crack becomes a high-contrast structure in the image, and the final defect result is accurately extracted through edge detection.
[0073] Specifically, edge detection is performed on the enhanced image using the Canny edge detection algorithm to obtain an edge detection result image. The edge detection result image is a binary image, in which white pixels (pixels marked as 1) are strong edge pixels, representing defects such as cracks, and black pixels (pixels marked as 0) are background pixels. Edges with a length of less than 20 in the edge detection result image are removed to obtain a defect detection result image.
[0074] For example, for Figure 6The final enhanced image is shown, and the edge detection result image obtained by performing edge detection on the enhanced image through a Canny edge detection algorithm is shown Figure 7 As shown, by removing Figure 7 The edge length is less than 20, and the defect detection result image obtained is shown Figure 8 As shown, the clear and complete crack is extracted, and therefore, the present application realizes accurate identification and extraction of real defects under complex interference by introducing morphological analysis.
[0075] It should be noted that the present application constructs an adaptive contrast parameter capable of identifying edge morphology, so that the diffusion processing is no longer indiscriminately protecting all strong edges, but can strongly protect the real crack area with the characteristics of being thin and continuous, and at the same time, the pseudo defects without such morphological characteristics are smoothed, such as thick welds and patchy rust, thereby fundamentally solving the problem that the traditional method is easy to misjudge the pseudo defects as cracks, and significantly improving the accuracy and reliability of the detection.
Claims
1. A machine vision-based intelligent detection method for oil and gas engineering facilities, characterized in that, include: Obtain images of oil and gas facilities to be inspected; Construct a structure tensor matrix based on the gradient of pixel points; Based on the two eigenvalues of the structure tensor matrix, the local linear structure response value of the pixel point is calculated; bidirectional path tracing is performed along the direction of the eigenvector corresponding to the smallest eigenvalue to obtain the local path of the pixel point; based on the degree of directional alignment of the eigenvectors of the pixel points on the local path, the crack continuity of the pixel point is calculated; the product of the local linear structure response value of the pixel point and the crack continuity is used as the morphological significance value of the pixel point; The basic contrast parameters are adjusted according to the morphological significance 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 an enhanced image is obtained through multiple iterative updates; Perform edge detection on the enhanced image to obtain the defect detection result map. 2.The machine vision-based intelligent detection method for oil and gas engineering facilities according to claim 1, characterized in that, The step of constructing a structure tensor matrix based on pixel gradients includes: Take any pixel as the target pixel, obtain a 3×3 neighborhood window centered on the target pixel, and take the pixels in the neighborhood window as the neighborhood pixels of the target pixel; ; Where, is the structure tensor matrix of the target pixel; and are the target pixel points The horizontal gradient and vertical gradient of each neighborhood pixel; is the neighborhood window of the target pixel. 3.The machine vision-based intelligent detection method for oil and gas engineering facilities according to claim 1, characterized in that, Calculating the local linear structure response value of the pixel point according to the two eigenvalues of the structure tensor matrix includes: ; In the formula, is a local linear structure response value of the pixel point; , is an eigenvalue of the structure tensor matrix of the pixel point, and .
4. The machine vision-based intelligent detection method for oil and gas engineering facilities according to claim 3, characterized in that, The bidirectional path tracking is performed along the direction of the eigenvector corresponding to the minimum eigenvalue to obtain the local path of the pixel point, including: According to two eigenvalues of a structure tensor matrix of a pixel point , and , eigenvalue corresponding eigenvector and eigenvalue corresponding eigenvector are obtained; bidirectional path tracing along the direction of the eigenvector results in a local path of length equal to the preset length.
5. The machine vision-based intelligent detection method for oil and gas engineering facilities according to claim 1, characterized in that, The calculating of the crack continuity of the pixel points according to the degree of directional alignment of the feature vectors of the pixel points on the local path includes: ; In the formula, is a pixel point of crack continuity; is a preset length, and the length of the local path is equal to ; is a local path with the pixel point as the center and in the direction of the feature vector ; is a feature value of the pixel point corresponding to the feature vector; is a pixel point on the local path; is a feature value of the pixel point corresponding to the feature vector; is a dot product operation of vectors; denotes taking an absolute value.
6. The machine vision-based intelligent detection method for oil and gas engineering facilities according to claim 1, characterized in that, The step of adjusting the basic contrast parameter according to the morphological significance value to obtain the adaptive contrast parameter of the pixel point includes: ; wherein, is an adaptive contrast parameter for the pixel point; is a base contrast parameter; is a morphological saliency value for the pixel point; is an adjustment factor.
7. The machine vision-based intelligent detection method for oil and gas engineering facilities according to claim 1, characterized in that, The method of performing anisotropic diffusion processing on the image to be detected based on the adaptive contrast parameter of the pixel points and obtaining an enhanced image through multiple iterative updates includes: The first iteration image is calculated from the second iteration image according to the following formula: The second iteration image is calculated from the first iteration image according to the following formula: The third iteration image is calculated from the second iteration image according to the following formula: ; Where, is the number of iterations, and ; For the sequence The image coordinates of the iteration The gray value of the pixel at ; is the iteration step length; For the The image coordinates of the iteration The divergence operator of the pixel point at .
8. The machine vision-based intelligent detection method for oil and gas engineering facilities according to claim 7, characterized in that, The calculation formula of the divergence operator of the pixel point is: ; wherein , is the horizontal flux of the pixel at coordinates in the image at the th iteration; , is the vertical flux of the pixel at coordinates in the image at the th iteration; the flux of a pixel is equal to the product of the diffusion coefficient of the pixel and the gradient vector, for the pixel at coordinates in the image at the th iteration, the gradient vector , , , are the horizontal and vertical gradients, respectively, of the pixel at coordinates in the image at the th iteration. 9. The machine vision-based intelligent detection method for oil and gas engineering facilities according to claim 8, characterized in that, The calculation formula of the diffusion coefficient of the pixel point is: ; Where, For the The coordinates in the image of the iteration The diffusion coefficient of the pixel at ; For the The coordinates in the image of the iteration The gradient vector of the pixel at ; Represents the vector modulus; is the coordinate in the image to be detected Adaptive contrast parameter of the pixel at .
10. The machine vision-based intelligent detection method for oil and gas engineering facilities according to claim 1, characterized in that, The step of performing edge detection on the enhanced image to obtain a defect detection result image includes: The enhanced image is subjected to edge detection using the Canny edge detection algorithm to obtain an edge detection result map. The edge detection result map is a binary image in which white pixels are strong edge pixels, representing defects such as cracks. Edges with a length less than 20 in the edge detection result map are removed to obtain a defect detection result map.
Citation Information
Patent Citations
Printing piece flaw detection method and system based on machine vision
CN120334236A
Hydraulic engineering crack detection method and system based on intelligent visual identification
CN120339222A
Image monitoring system for traditional village heritage risk assessment
CN120495877A
AU2020101874A4
KR20250014210A
Cited By
Large shaft forging blank center forging method and system based on machine vision
CN121213668A
Metal part forging defect detection method and system
CN121353284A
Flexible connection lamination side edge welding seam quality detection method based on image processing
CN121544608A
An image processing-based soft connection lamination side seam weld quality detection method
CN121544608B
