A defoaming sand washing monitoring method and system based on image analysis

By constructing a structural tensor matrix and optimizing the anisotropic spatial kernel parameters, the problems of oil droplet deformation and motion ambiguity in high-speed flow fields of traditional bilateral filtering algorithms are solved, enabling accurate identification and monitoring of oil entrainment and improving the accuracy and anti-interference ability of the defoaming and sand flushing process.

CN121582256BActive Publication Date: 2026-03-31SHAANXI YUYANG PETROLEUM TECH ENG CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2026-01-27
Publication Date
2026-03-31

AI Technical Summary

Technical Problem

Traditional bilateral filtering algorithms cannot adapt to the deformation, stretching, and motion blur of oil droplets in high-speed flow fields when processing images of liquid discharge from sand flushing ports, resulting in missed detections of oil entrainment and affecting the accuracy of defoaming sand flushing monitoring.

Method used

By constructing the structural tensor matrix of pixels and combining it with pipeline fluid velocity data, the flow direction coherence of pixels and the confidence factor of oil phase anisotropy are determined. The anisotropic spatial kernel parameters are optimized, image enhancement processing is performed, oil phase regions are identified, and oil entrainment anomalies are judged.

Benefits of technology

It improves the accuracy and robustness of oil entrainment detection, enabling timely identification of oil entrainment anomalies caused by improper flushing pressure, thus preventing crude oil loss and environmental pollution.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121582256B_ABST
    Figure CN121582256B_ABST
Patent Text Reader

Abstract

The present application belongs to the technical field of image data processing, and particularly relates to a defoaming sand washing monitoring method and system based on image analysis, which comprises the following steps: constructing a structure tensor matrix of a pixel point, determining the flow direction coherence degree of the pixel point, determining the oil phase anisotropy confidence factor of the pixel point, determining the optimized anisotropy space kernel parameter of the pixel point, obtaining an enhanced sand washing outlet liquid discharge image, determining the area proportion of the oil phase region in the enhanced sand washing outlet liquid discharge image, and judging whether there is oil entrainment abnormality at the discharge port. By analyzing the gray scale characteristics of the pixel point and the pixel points in its neighborhood, and by adapting the anisotropy space kernel parameter, the present application overcomes the limitations of the traditional bilateral filtering algorithm using a fixed shape filtering kernel under a high-speed mixed flow field, realizes oil phase feature enhancement, and improves the accuracy and robustness of oil entrainment abnormality monitoring in the defoaming sand washing process.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of image data processing technology. More specifically, this invention relates to a defoaming and sand flushing monitoring method and system based on image analysis. Background Technology

[0002] In the operation of oilfield joint stations and transfer stations, the three-phase separator, as a core piece of equipment, relies heavily on internal sand removal as a crucial step in maintaining efficient separation. Due to the large fluctuations in sand content in the liquid entering the separator and the lack of effective online sand removal monitoring methods, on-site operations often rely on manual, timed sand flushing, leading to incomplete or excessive flushing. Especially during sand flushing and drainage, the extremely high flow rate and turbidity of the fluid make it difficult for traditional level gauges to accurately determine the composition of the outlet fluid. If the flushing pressure is not properly controlled, crude oil can easily be entrained into the sand discharge pipeline, causing oil loss—a phenomenon known as oil entrainment. Therefore, identifying oil phase anomalies against a highly turbid background is of great significance for achieving intelligent sand flushing control. The sand flushing and drainage contains a large number of high-speed flowing suspended sand particles. These discrete particles form dense high-frequency noise and rough textures in the image, which interferes with the identification of oil phase edges. Existing image analysis methods typically use bilateral filtering algorithms to enhance the sand flushing port drainage image to extract oil phase features.

[0003] However, when using bilateral filtering algorithms to process images of sand flushing outlets, the spatial distance weights are usually calculated based on isotropic circular kernels, i.e., using a fixed-shape filter kernel. In the high-speed flow field of sand flushing, the mixed oil droplets undergo severe deformation under shear force, exhibiting a stretched strip shape along the flow velocity direction, accompanied by strong motion blur. If a fixed circular kernel is used for filtering, the algorithm may have an excessively large smoothing range in the direction perpendicular to the flow velocity, which will destroy the narrow edges of the stretched oil droplets. On the other hand, the smoothing range in the direction parallel to the flow velocity may be insufficient, failing to repair the texture of the oil droplets broken by motion blur. As a result, the bilateral filtering algorithm cannot effectively enhance the oil phase characteristics, leading to missed detection of oil entrainment and affecting the accuracy of defoaming sand flushing monitoring. Summary of the Invention

[0004] To address the technical problem that traditional bilateral filtering algorithms, when processing images of sand flushing outlets, typically calculate spatial distance weights based on isotropic circular kernels, which fails to adapt to the deformation, stretching, and motion blur of oil droplets in the high-speed flow field of sand flushing outlets, thus leading to missed detections of oil entrainment, this invention provides solutions in the following aspects.

[0005] In a first aspect, the present invention provides an image analysis-based method for monitoring defoaming and sand flushing, comprising: acquiring images of sand flushing outlet drainage and pipeline fluid velocity data; constructing a structural tensor matrix of pixels, determining the flow direction coherence of pixels based on the eigenvalues ​​of the structural tensor and the pipeline fluid velocity data; determining an oil phase anisotropy confidence factor of pixels based on the flow direction coherence and the average rate of change of gray values ​​of pixels along the fluid extension direction within their neighborhood window; determining optimized anisotropy spatial kernel parameters of pixels based on the oil phase anisotropy confidence factor; enhancing the sand flushing outlet drainage image using the optimized anisotropy spatial kernel parameters to obtain an enhanced sand flushing outlet drainage image; determining the area proportion of the oil phase region in the enhanced sand flushing outlet drainage image, and determining whether there is an oil entrainment anomaly at the discharge outlet based on the area proportion.

[0006] This invention highlights the directional stretching texture characteristics of oil droplets in high-speed flow fields by calculating the coherence of the flow direction and utilizing the differences in eigenvalues ​​of the structural tensor and pipeline fluid velocity data. By calculating the anisotropy confidence factor of the oil phase, it analyzes the grayscale fluctuations and discontinuities of sand particle trails, achieving accurate identification of sand particle noise. By determining optimized anisotropic spatial kernel parameters based on the oil phase anisotropy confidence factor and adaptively adjusting the basic spatial standard deviation, it enhances the anti-interference capability of the bilateral filtering algorithm in complex flow fields. By generating an enhanced flushing port drainage image based on the optimized anisotropic spatial kernel parameters and calculating the area ratio of the oil phase region and judging oil entrainment anomalies, it achieves the evaluation of the defoaming flushing process, accurately identifying oil entrainment anomalies caused by improper flushing pressure, and improving the accuracy and robustness of detection.

[0007] Preferably, the method for acquiring the flushing port drainage image and pipeline fluid velocity data is as follows: a high-speed industrial camera is deployed at the sight glass position of the separator sand discharge pipeline and connected to the pipeline electromagnetic flow meter data interface to collect the fluid video stream during the sand discharge process, and the pipeline fluid velocity value corresponding to each frame image is acquired synchronously. The fluid video stream is converted into a digital grayscale image sequence using an image acquisition card, and the obtained result is used as the flushing port drainage image.

[0008] Preferably, the method for obtaining the eigenvalues ​​of the structure tensor is as follows: using the Sobel operator to perform convolution operation on the drainage image of the sand flushing port, calculating the gradient values ​​of the pixel in the horizontal and vertical directions, constructing the structure tensor matrix of the pixel, selecting a neighborhood window of a preset size with the pixel as the center, performing Gaussian weighted summation on the gradient product terms within the neighborhood window, obtaining the three components of the structure tensor matrix respectively, taking the sum of the two diagonal components of the structure tensor matrix as the first value, taking half of the sum of the first value and the square root of the discriminant of the structure tensor as the maximum eigenvalue of the neighborhood structure tensor of the pixel, and taking half of the difference between the first value and the square root of the discriminant as the minimum eigenvalue of the neighborhood structure tensor of the pixel.

[0009] Preferably, the degree of coherence of the flow direction satisfies the expression:

[0010] In the formula, For the first The degree of flow coherence of each pixel This is the pipeline fluid velocity data at the moment the image of the sand flushing outlet discharge is acquired. and The first The maximum and minimum eigenvalues ​​of the neighborhood structure tensor of each pixel. To prevent tiny quantities with a denominator of zero.

[0011] This invention achieves the assessment of flow direction coherence by constructing a composite function of the exponential term of the pipe fluid velocity data and the ratio term of the structural tensor eigenvalues. The ratio term of the structural tensor eigenvalues ​​analyzes the uniformity of the local texture direction of pixels, while the pipe fluid velocity data term introduces the weighting of macroscopic physical conditions on microscopic texture features. This results in a larger flow direction coherence value being calculated for real fluid regions with clear flow direction features, while the flow direction coherence value is smaller for turbulent noise with chaotic directions or static backgrounds due to the small difference in eigenvalues. This provides a flow direction feature basis for the subsequent adaptive control of anisotropic filtering intensity.

[0012] Preferably, the confidence factor for oil phase anisotropy satisfies the following expression:

[0013] In the formula, For the first Oil phase anisotropy confidence factor per pixel For the first The degree of flow coherence of each pixel The number of reference pixels selected along the fluid extension direction within the neighborhood window of each pixel. and The first The x and y coordinates of each pixel and The first The unit vector representing the fluid extension direction of each pixel. This is the distance offset step size. For the first Moving along the fluid extension direction within its neighborhood window, centered on a pixel. The grayscale value of the pixel at the position reached after a step, and the movement... The difference in grayscale values ​​of the pixels at the position reached after a step. It is a natural exponential function.

[0014] This invention constructs a composite function of the coherence degree of the flow direction and the exponential term of the gray-scale difference along the fluid extension direction to evaluate the anisotropy confidence factor of the oil phase. The coherence degree of the flow direction reflects the uniformity of the texture direction in the neighborhood of the pixel, while the exponential term of the gray-scale difference along the fluid extension direction reflects the continuous stability of the gray-scale value of the pixel in the fluid extension direction. This results in a larger anisotropy confidence factor for the real oil phase region and a smaller anisotropy confidence factor for the sand grain region, thus providing a reliable basis for subsequently determining the anisotropy spatial kernel parameters of the pixel after optimization.

[0015] Preferably, the optimized anisotropic space kernel parameters satisfy the expression:

[0016] ; In the formula, For the first The standard deviation of the filter kernel for each pixel in the direction of fluid extension within its neighborhood window. For the first The standard deviation of the filter kernel for each pixel in the direction of fluid extension perpendicular to its neighborhood window. Based on the spatial standard deviation, For the first Oil phase anisotropy confidence factor per pixel The filter scale gain factor for each pixel. is the filter scale attenuation factor for each pixel.

[0017] This invention utilizes the anisotropic confidence factor of the oil phase to amplify the gain and attenuate the standard deviation of the basic space, thereby achieving adaptive calculation of the optimized anisotropic spatial kernel parameters. The filter scale gain factor stretches the standard deviation parallel to the fluid extension direction, enhancing the smooth connectivity along the streamline, while the filter scale attenuation factor controls the standard deviation perpendicular to the fluid extension direction, preventing fluid edge blurring. This results in a filter kernel with a large aspect ratio and significant directionality being calculated for the oil phase region with clear texture, while a small-scale filter kernel with isotropic properties is calculated for the turbulent noise region. This provides a structurally guided basis that conforms to the fluid physics characteristics for subsequent anisotropic filtering.

[0018] Preferably, the enhancement processing of the flushing port drainage image includes: traversing the pixels in the flushing port drainage image, constructing anisotropic Gaussian space weights for the pixels based on the optimized anisotropic space kernel parameters of the pixels and the angle values ​​of the fluid extension direction within their neighborhood windows, determining the grayscale weights of the pixels based on the standard deviation of the grayscale values, and performing bilateral filtering calculations by combining the grayscale weights and the anisotropic Gaussian space weights of the pixels to obtain the enhanced flushing port drainage image.

[0019] Preferably, determining the area ratio of the oil phase region in the enhanced sand flushing port drainage image includes: applying adaptive threshold segmentation to the enhanced sand flushing port drainage image; in response to a pixel in the enhanced sand flushing port drainage image having a gray value less than the calculated adaptive segmentation threshold, the pixel in the enhanced sand flushing port drainage image belongs to the oil phase region; calculating the ratio of the total area of ​​the oil phase region to the total area of ​​the enhanced sand flushing port drainage image; and using the result as the area ratio of the oil phase region in the enhanced sand flushing port drainage image.

[0020] Preferably, determining whether there is an oil entrainment anomaly at the discharge outlet includes: responding to the fact that the area ratio of the oil phase region in the enhanced flushing port drainage image is greater than a preset alarm threshold, indicating that there is an oil entrainment anomaly at the discharge outlet.

[0021] This invention achieves automated monitoring of abnormal oil entrainment at the discharge port by comparing the area ratio of the oil phase region in the enhanced sand flushing port drainage image with a set alarm threshold. The area ratio of the oil phase region directly quantifies the relative content of crude oil components in the enhanced sand flushing port drainage image, enabling the system to quickly determine an abnormal oil entrainment when it detects a significant expansion of the oil phase area exceeding the preset safety limit. This provides accurate information for on-site personnel to adjust drainage strategies in a timely manner, effectively preventing crude oil loss and environmental pollution.

[0022] Secondly, the present invention provides an image analysis-based defoaming and sand flushing monitoring system, including a processor and a memory, wherein the memory stores computer program instructions, and when the computer program instructions are executed by the processor, the above-mentioned image analysis-based defoaming and sand flushing monitoring method is implemented.

[0023] By adopting the above technical solution, a computer program for the above-mentioned image analysis-based defoaming and sand flushing monitoring method is generated and stored in a memory so that it can be loaded and executed by a processor. A terminal device can then be made based on the memory and processor for convenient use.

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

[0025] This invention solves the technical problem that traditional bilateral filtering algorithms cannot adapt to the stretching deformation and motion blur of oil droplets in high-speed mixed-phase flow environments of defoaming and sand flushing due to the use of fixed-shape filtering kernels, thus misjudging sand particle trailing noise as oil phase targets by introducing an anisotropic filtering kernel adaptive correction mechanism based on multidimensional feature coupling.

[0026] This invention establishes the intrinsic mapping relationship between the degree of flow direction coherence and the linear texture of the real oil phase by analyzing the structural tensor feature values ​​of pixels and combining them with the flow velocity data of pipeline fluid. On this basis, it further integrates the average change rate of gray values ​​along the fluid extension direction, and tightly couples the index reflecting local texture consistency with the index reflecting texture smoothness, thereby achieving accurate identification of high-density sand particle interference.

[0027] This invention calculates optimized anisotropic spatial kernel parameters for each pixel, matching its local fluid rheological characteristics. By dynamically stretching and compressing the standard deviation of the filter kernel in the parallel and perpendicular flow directions, it achieves accurate matching between the filtering process and the local directional features of the image. For sand noise areas, the filter kernel is automatically compressed to suppress false textures; for real oil phase areas, the filter kernel is moderately stretched to repair motion blur, ensuring high integrity and clarity of oil phase features in the enhanced sand flushing outlet drainage image. Ultimately, this invention improves the accuracy and anti-interference capability of oil entrainment anomaly detection, enhances the robustness of defoaming sand flushing monitoring, and can timely and accurately identify oil phase anomalies at the discharge outlet, providing a solid technical guarantee for intelligent sand flushing control and crude oil loss prevention in oilfield three-phase separators. Attached Figure Description

[0028] Figure 1 This is a flowchart illustrating an image analysis-based defoaming and sand flushing monitoring method according to the present invention;

[0029] Figure 2 This diagram schematically illustrates a comparison of defoaming and sand-washing monitoring results between a fixed-shape filter kernel in the prior art and the adaptive-shape filter kernel of this invention. Detailed Implementation

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

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

[0032] This invention discloses an image analysis-based method for monitoring defoaming and sand flushing, referring to... Figure 1 This includes steps S001 to S005, specifically:

[0033] S001: Obtain images of the drainage from the sand flushing port and data on the fluid velocity in the pipeline.

[0034] Specifically, a high-speed industrial camera is deployed at the sight glass position of the separator's sand discharge pipeline and connected to the pipeline electromagnetic flowmeter data interface to collect the fluid video stream during the sand discharge process. Simultaneously, the pipeline fluid velocity value corresponding to each frame of the image is acquired. The video stream is converted into a digital grayscale image sequence using an image acquisition card to obtain the sand flushing fluid image to be processed. In this embodiment, the frame rate of the high-speed industrial camera is 60fps. In other embodiments, the implementer can set the frame rate of the high-speed industrial camera according to the actual implementation situation.

[0035] S002: Construct the structure tensor matrix of the pixel, and determine the flow direction coherence of the pixel based on the eigenvalues ​​of the structure tensor and the flow velocity data of the pipeline.

[0036] It should be noted that traditional bilateral filtering algorithms use filter kernels with fixed shapes, which are ill-suited to the dynamic distortion of oil droplet morphology caused by drastic changes in flow velocity in sand-fluid processes. This leads to reduced sensitivity and accuracy in extracting features along the fluid extension direction. According to fluid mechanics principles, oil droplets in a mixed-phase fluid undergo deformation and stretching under viscous shear forces in a high-speed flow field, resulting in significant anisotropic texture in the image. Specifically, the gradient change along the fluid extension direction within the pixel's neighborhood window is small, while the gradient change perpendicular to the fluid extension direction is large. Therefore, this invention combines the maximum and minimum eigenvalues ​​of the pixel's neighborhood structure tensor to determine the degree of flow coherence of the pixel, which characterizes the strength of directional stretching of local image texture caused by macroscopic flow velocity.

[0037] Specifically, the Sobel operator is used to perform convolution operations on the drainage image of the sand flushing port to determine the gradient values ​​of the pixels in the horizontal and vertical directions. A structure tensor matrix for each pixel is constructed. A neighborhood window of a preset size is selected centered on the pixel. A Gaussian kernel of the same size as the neighborhood window is used to perform a Gaussian weighted sum of the gradient products of the pixels within the neighborhood window, resulting in three components of the structure tensor matrix: the Gaussian weighted sum of the squares of the horizontal gradients of the pixels within the neighborhood window, the Gaussian weighted sum of the squares of the vertical gradients of the pixels within the neighborhood window, and the Gaussian weighted sum of the products of the horizontal and vertical gradients of the pixels within the neighborhood window. The sum of the two diagonal components of the structure tensor matrix is ​​taken as the first value. Half of the sum of the first value and the square root of the discriminant of the structure tensor is taken as the largest eigenvalue of the neighborhood structure tensor of the pixel. Half of the difference between the first value and the square root of the discriminant is taken as the smallest eigenvalue of the neighborhood structure tensor of the pixel.

[0038] Furthermore, the degree of coherence of the flow satisfies the expression:

[0039] ;

[0040] In the formula, For the first The degree of flow coherence of each pixel This is the pipeline fluid velocity data at the moment the image of the sand flushing outlet discharge is acquired. and The first The maximum and minimum eigenvalues ​​of the neighborhood structure tensor of each pixel. To prevent small quantities with a denominator of zero, the range of values ​​for such small quantities is as follows: In this embodiment, the minute amount to prevent the denominator from being zero is set to 0.001. In other embodiments, implementers can set it according to the actual implementation situation.

[0041] In the formula, The larger the value, the faster the fluid velocity in the pipe at the time the image of the sand flushing outlet is acquired, indicating that the... The greater the likelihood that a pixel is affected by the fluid in the pipe, the more likely the 1st pixel is to be affected by the fluid in the pipe. The greater the flow coherence of each pixel, the better. The larger it is, the more likely it is to be the first The stronger the extensibility of the texture in the neighborhood of a pixel in a specific direction, the more pronounced the effect of the texture extension in that direction. The more pronounced the stretching effect on the nth pixel, the more significant the effect on the nth pixel. The greater the likelihood of the presence of linear texture features in the neighborhood of a pixel, the higher the probability of the presence of linear texture features in the neighborhood of the first pixel. The greater the flow coherence of each pixel, the better.

[0042] S003: Determine the oil phase anisotropy confidence factor of a pixel based on the coherence of the pixel's flow direction and the average rate of change of the gray value of the pixel along the fluid extension direction in its neighborhood window.

[0043] It should be noted that under high-speed oil-sand mixed-phase flow conditions, high-density sand particles will form visual linear trails under high-speed movement. These trails also exhibit significant directional texture features, which can easily lead to misjudging the sand particle trails as oil phase, reducing the accuracy of defoaming and sand flushing monitoring. Based on the optical imaging characteristics of multiphase flow, the grayscale change of the oil phase, as a continuous medium, along the fluid extension direction exhibits a smooth and gradual characteristic, while the sand flow, as a discrete particle collection, still shows high-frequency grayscale fluctuations and discontinuities in its trails along the fluid extension direction. Therefore, this invention combines the flow direction coherence of a pixel with the cumulative characteristics of grayscale value differences along the fluid extension direction within its neighborhood window to determine the oil phase anisotropy confidence factor of the pixel, which is used to characterize that the anisotropic texture at that location belongs to the continuous oil phase.

[0044] Specifically, the direction of the eigenvector corresponding to the minimum eigenvalue of the pixel neighborhood structure tensor is taken as the fluid extension direction within the pixel neighborhood window, and the angle value of the fluid extension direction within the pixel neighborhood window is recorded.

[0045] Furthermore, the confidence factor for oil phase anisotropy satisfies the expression:

[0046] ;

[0047] In the formula, For the first Oil phase anisotropy confidence factor per pixel For the first The degree of flow coherence of each pixel The number of reference pixels selected along the fluid extension direction within the pixel's neighborhood window is used to determine the statistical sample size for calculating the confidence factor of the pixel's anisotropy with respect to the oil phase within the neighborhood window. This ensures that grayscale variation features are sufficiently captured along the fluid extension direction to accurately characterize the local anisotropy intensity. In this embodiment, the number of reference pixels is set to 16. In other embodiments, implementers can set this number according to the actual implementation situation. For example, when the fluid texture is more complex, the number of reference pixels can be appropriately increased to improve statistical reliability and reduce noise interference. When the fluid texture is simpler or computational efficiency requirements are higher, the number of reference pixels can be appropriately reduced to avoid excessive computational overhead. and The first To avoid decimals in the summation limits of the expression for the x and y coordinates of each pixel, the number of reference pixels should be set to an even number. and The first The unit vector representing the fluid extension direction of each pixel. The distance offset step of a pixel relative to the center pixel. and Each of the following is the first Moving along the fluid extension direction within its neighborhood window, centered on a pixel. The x and y coordinates of the pixel at the position reached after a step. For the first Moving along the fluid extension direction within its neighborhood window, centered on a pixel. The grayscale value of the pixel at the position reached after the nth step, and the grayscale value of the pixel at the position reached after the nth step, are compared with the grayscale value of the pixel at the position reached after the nth step. Moving along the fluid extension direction within its neighborhood window, centered on a pixel. The difference in grayscale values ​​of the pixels at the position reached after a step. It is a natural exponential function.

[0048] In the formula, The larger the value, the more significant the effect of pixel neighborhood gradient structure feature analysis. The greater the probability that a pixel is located in a linear texture region, the more likely it is to be the first pixel. The higher the probability that a pixel belongs to the oil phase region, the more likely it is to be the first pixel. The larger the confidence factor for oil phase anisotropy of each pixel, the greater the confidence factor. The larger it is, the more likely it is to be the first The coarser the texture inside a pixel along the fluid extension direction within its neighborhood window, the more drastic the change in grayscale value, indicating that the... The greater the probability that a pixel belongs to a high-density sand flow region, the more likely it is that the first pixel belongs to a high-density sand flow region. The less likely a pixel is to belong to the oil phase region, the less likely the i-th pixel is to belong to the oil phase region. The smaller the confidence factor for oil phase anisotropy of each pixel, the better.

[0049] S004: Determine the anisotropic spatial kernel parameters of the pixel after pixel optimization based on the anisotropic confidence factor of the oil phase.

[0050] It should be noted that after obtaining the oil phase anisotropy confidence factor of the pixel, this invention will correct the basic spatial kernel parameters of the pixel based on the oil phase anisotropy confidence factor. Traditional bilateral filtering algorithms usually preset a globally fixed spatial standard deviation for all pixels. This invention, however, uses the oil phase anisotropy confidence factor to correct the baseline spatial kernel parameters of the pixel, and obtains the optimized anisotropic spatial kernel parameters of the pixel, so that the bilateral filtering algorithm can extract the oil phase target more accurately.

[0051] Specifically, the optimized anisotropic space kernel parameters satisfy the expression:

[0052] ;

[0053] ;

[0054] In the formula, For the first The standard deviation of the filter kernel for each pixel in the direction of fluid extension within its neighborhood window. For the first The standard deviation of the filter kernel for each pixel in the direction of fluid extension perpendicular to its neighborhood window. The base spatial standard deviation is used to determine the reference scale of the Gaussian filter kernel within the neighborhood window of a pixel, perpendicular to the direction of fluid extension. In this embodiment, the base spatial standard deviation is set to 3. In other embodiments, implementers can set it according to the actual implementation situation. For example, when the image noise is strong or the detail requirement is high, the base spatial standard deviation can be appropriately increased to enhance the smoothing effect; when the image noise is weak or more subtle textures need to be preserved, the base spatial standard deviation can be appropriately decreased to avoid excessive blurring. For the first Oil phase anisotropy confidence factor per pixel The filter scale gain factor for a pixel is used to adjust the gain of the standard deviation of the pixel filter kernel in the fluid extension direction parallel to its neighborhood window. This ensures that when the oil phase anisotropy confidence factor is large, more flexible optimization of the basic spatial standard deviation can be achieved. The empirical range of the filter scale gain factor is... In this embodiment, the filter scale gain factor is set to 2. In other embodiments, the implementer can set it according to the actual implementation situation. For example, when the oil phase anisotropy confidence factor is large, the filter scale gain factor can be appropriately increased to avoid insufficient smoothing; when the oil phase anisotropy confidence factor is small, the filter scale gain factor can be appropriately decreased to avoid over-smoothing. The filter scale attenuation factor for each pixel is used to adjust the attenuation of the standard deviation of the pixel filter kernel in the direction perpendicular to the main flow direction. This ensures that when the confidence factor for oil phase anisotropy is large, optimization with a shrinkable basic spatial standard deviation can be achieved. The empirical range of the filter scale attenuation factor is [insert range here]. In this embodiment, the filter scale attenuation factor is set to 0.6. In other embodiments, implementers can set it according to the actual implementation situation. For example, when the oil phase anisotropy confidence factor is large, the shrinkage coefficient can be appropriately increased to avoid insufficient edge protection. When the oil phase anisotropy confidence factor is small, the shrinkage coefficient can be appropriately decreased to avoid excessive compression.

[0055] In the formula, The larger it is, the more likely it is to be the first The greater the probability that a pixel belongs to the oil phase region, the larger the effective range of the bilateral filtering algorithm in the fluid extension direction, and the more the filter kernel is stretched. Therefore, the... The larger the standard deviation of the filter kernel for each pixel in the direction of fluid extension parallel to its neighborhood window, the smaller the effective range of the bilateral filtering algorithm in the direction perpendicular to the fluid extension direction, and the more the filter kernel is compressed. Therefore, the... The smaller the standard deviation of the filter kernel for each pixel in the direction of fluid extension perpendicular to its neighborhood window.

[0056] S005: Enhance the flushing port drainage image using the optimized anisotropic spatial kernel parameters to obtain the enhanced flushing port drainage image. Determine the area ratio of the oil phase region in the enhanced flushing port drainage image and judge whether there is an oil entrainment anomaly at the discharge outlet based on the area ratio.

[0057] Specifically, determining whether there is oil entrainment abnormality at the discharge port includes:

[0058] The pixels in the flushing port drainage image are traversed. Based on the optimized anisotropic space kernel parameters of the pixels and the angle values ​​of the fluid extension direction in their neighborhood windows, anisotropic Gaussian space weights of the pixels are constructed. The grayscale weights of the pixels are calculated according to the preset grayscale standard deviation of the bilateral filtering algorithm. The grayscale weights of the pixels and the anisotropic Gaussian space weights of the pixels are combined for bilateral filtering calculation to obtain the enhanced flushing port drainage image. In this embodiment, the grayscale standard deviation is set to 20. In other embodiments, the implementer can set the grayscale standard deviation according to the actual implementation situation.

[0059] An adaptive threshold segmentation algorithm is used to perform adaptive threshold segmentation on the enhanced flushing port drainage image. If the gray value of a pixel in the enhanced flushing port drainage image is less than the segmentation threshold calculated by the adaptive threshold segmentation algorithm, the pixel in the enhanced flushing port drainage image belongs to the oil phase region. The ratio of the total area of ​​the oil phase region to the total area of ​​the enhanced flushing port drainage image is calculated to determine the area proportion of the oil phase region in the enhanced flushing port drainage image.

[0060] In response to the fact that the area of ​​the oil phase region in the enhanced flushing port drainage image is greater than the preset alarm threshold, indicating an abnormality of oil entrainment at the discharge port, in this embodiment, the alarm threshold is set to 0.08. In other embodiments, the implementer can set the alarm threshold according to the actual implementation situation.

[0061] like Figure 2 As shown, Figure 2The results show a comparison between monitoring using a fixed-shape filter kernel in existing technologies and monitoring using the adaptive-shape filter kernel of this invention. Within the normal operating range of 0-40 frames and 60-100 frames, the monitoring curve of the existing technology exhibits severe oscillations and repeatedly exceeds the alarm threshold erroneously. This is because the existing technology uses a fixed-shape filter kernel, which lacks the ability to perceive fluid direction characteristics and cannot distinguish between high-density sand particle trailing noise and true oil phase texture. This leads to sand particles being incorrectly accumulated and calculated as oil phase area, greatly reducing the reliability of the monitoring results. The monitoring curve of this invention closely matches the baseline value obtained from laboratory testing throughout the entire time period. In the oil entrainment anomaly range of 40-60 frames, because this invention introduces an oil phase anisotropy confidence factor to dynamically correct the filter kernel, it successfully suppresses sand particle interference, captures the true abrupt changes in the oil phase area ratio, and allows it to stably rise above the alarm threshold, improving the accuracy and robustness of oil entrainment anomaly monitoring.

[0062] This invention also discloses an image analysis-based defoaming and sand flushing monitoring system, including a processor and a memory. The memory stores computer program instructions, which, when executed by the processor, implement an image analysis-based defoaming and sand flushing monitoring method according to the present invention.

[0063] The system also includes other components well known to those skilled in the art, such as communication buses and communication interfaces, the settings and functions of which are known in the art and will not be described in detail here.

Claims

1. An image analysis-based defoaming sand cleaning monitoring method, characterized by, The method comprises the following steps: acquiring a sand washing outlet discharge image and pipeline fluid flow rate data; constructing a structure tensor matrix of a pixel point, determining a flow direction coherence degree of the pixel point according to eigenvalues of the structure tensor and the pipeline fluid flow rate data; determining an oil phase anisotropy confidence factor of the pixel point according to the flow direction coherence degree of the pixel point and an average change rate of a gray value of the pixel point along a fluid extension direction in a neighborhood window of the pixel point; Based on the oil phase anisotropy confidence factor, the optimized anisotropic space kernel parameters of the pixels are determined, satisfying the expression: , In the formula, For the first The standard deviation of the filter kernel for each pixel in the direction of fluid extension within its neighborhood window. For the first The standard deviation of the filter kernel for each pixel in the direction of fluid extension perpendicular to its neighborhood window. Based on the spatial standard deviation, For the first Oil phase anisotropy confidence factor per pixel The filter scale gain factor for each pixel. is the filter scale attenuation factor for each pixel; performing enhancement processing on the sand washing outlet discharge image by using the optimized anisotropy spatial kernel parameters, to obtain an enhanced sand washing outlet discharge image; determining an area proportion of an oil phase region in the enhanced sand washing outlet discharge image, and judging whether there is oil entrainment abnormality at the discharge outlet according to the area proportion.

2. The method of claim 1, wherein, The method for acquiring the sand washing outlet discharge image and the pipeline fluid flow rate data comprises the following steps: deploying a high-speed industrial camera at a sight glass position of a separator sand discharge pipeline, connecting a pipeline electromagnetic flowmeter data interface, collecting a fluid video stream in a sand discharge process, synchronously acquiring a pipeline fluid flow rate value corresponding to each frame of image, converting the fluid video stream into a digital gray value image sequence by using an image acquisition card, and taking the obtained result as the sand washing outlet discharge image.

3. The method of claim 1, wherein, The method for acquiring the eigenvalues of the structure tensor comprises the following steps: performing convolution operation on the sand washing outlet discharge image by using a Sobel operator, calculating gradient values of a pixel point in a horizontal direction and a vertical direction, constructing a structure tensor matrix of the pixel point, selecting a neighborhood window of a preset size with the pixel point as a center, performing Gaussian weighted summation on gradient product items in the neighborhood window, respectively obtaining three components of the structure tensor matrix, taking a sum of two diagonal components of the structure tensor matrix as a first value, taking half of a sum of the first value and a square root of a discriminant of the structure tensor as a maximum eigenvalue of a neighborhood structure tensor of the pixel point, and taking half of a difference between the first value and the square root of the discriminant as a minimum eigenvalue of the neighborhood structure tensor of the pixel point.

4. The image analysis-based defoaming sand washing monitoring method according to claim 1 or 3, characterized in that, The flow direction coherence degree satisfies the expression: ; In the formula, The flow direction coherence degree of the i-th pixel point, The maximum eigenvalue and the minimum eigenvalue of the neighborhood structure tensor of the i-th pixel point, The pipe fluid flow rate data at the sand flushing outlet liquid discharge image acquisition moment, And The maximum eigenvalue and the minimum eigenvalue of the neighborhood structure tensor of the i-th pixel point, The maximum eigenvalue and the minimum eigenvalue of the neighborhood structure tensor of the i-th pixel point, A tiny amount to prevent the denominator from being zero.

5. The image analysis-based defoaming sand washing monitoring method according to claim 1, characterized in that, The oil phase anisotropy confidence factor satisfies the expression: ; In the formula, For the first Oil phase anisotropy confidence factor per pixel For the first The degree of flow coherence of each pixel The number of reference pixels selected along the fluid extension direction within the neighborhood window of each pixel. and The first The x and y coordinates of each pixel and The first The unit vector of the fluid extension direction of each pixel. This is the distance offset step size. For the first Moving along the fluid extension direction within its neighborhood window, centered on a pixel. The grayscale value of the pixel at the position reached after a step, and the movement... The difference in grayscale values ​​of the pixels at the position reached after a step. It is a natural exponential function.

6. The image analysis-based defoaming sand washing monitoring method according to claim 1, characterized in that, The method for performing enhancement processing on the sand washing outlet discharge image comprises the following steps: traversing the pixel points in the sand washing outlet discharge image, constructing an anisotropy Gaussian spatial weight of a pixel point according to the optimized anisotropy spatial kernel parameters of the pixel point and an angle value of a fluid extension direction in a neighborhood window of the pixel point, determining a gray value domain weight of the pixel point according to a gray value domain standard deviation of the pixel point, and performing bilateral filtering calculation by combining the gray value domain weight of the pixel point and the anisotropy Gaussian spatial weight of the pixel point, to obtain the enhanced sand washing outlet discharge image.

7. The image analysis-based defoaming sand washing monitoring method according to claim 1, characterized in that, The method for determining the area proportion of the oil phase region in the enhanced sand washing outlet discharge image comprises the following steps: performing adaptive threshold segmentation on the enhanced sand washing outlet discharge image, in response to a pixel point gray value of the enhanced sand washing outlet discharge image being less than a calculated adaptive segmentation threshold value, the pixel point of the enhanced sand washing outlet discharge image belongs to the oil phase region, calculating a ratio of a total area of the oil phase region to a total area of the enhanced sand washing outlet discharge image, and taking the obtained result as the area proportion of the oil phase region in the enhanced sand washing outlet discharge image.

8. The image analysis-based defoaming sand washing monitoring method according to claim 1, characterized in that, The judgment of whether the oil entrainment abnormality exists in the discharge port comprises: in response to the area proportion of the oil phase region in the enhanced sand washing port liquid discharge image being greater than a pre-set alarm threshold, the oil entrainment abnormality exists in the discharge port.

9. An image analysis based defoaming sand monitoring system, characterized in that, The method comprises the steps of: A processor and a memory, the memory stores computer program instructions, when the computer program instructions are executed by the processor, a kind of defoaming sand washing monitoring method based on image analysis according to any one of claims 1-8 is realized.

Citation Information

Patent Citations

  • SAR image change detection method based on adaptive weight image fusion

    CN104200471A

  • Intelligent safety monitoring method and system for workover treatment

    CN114893133A