Microscopic displacement image adaptive threshold processing method and device and storage medium

By using an adaptive thresholding method, combined with RGB color space and grayscale information, the problem of blurred boundaries between oil and water mixing regions in microscopic displacement images was solved. This enabled accurate identification of affected and unaffected regions and accurate calculation of oil saturation, thus improving the reliability of experimental results.

CN121505014APending Publication Date: 2026-02-10CHINA UNIV OF PETROLEUM (BEIJING)
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202511665231.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-11-13
Publication Date
2026-02-10

AI Technical Summary

Technical Problem

Traditional micro-displacement image segmentation methods based on the RGB color space suffer from large errors in sand-filled model displacement experiments, especially due to the blurred boundaries of oil-water mixed regions, making accurate segmentation difficult.

Method used

An adaptive thresholding method is adopted. By acquiring the RGB color space of the micro-displacement image, the affected area is extracted and converted into a grayscale image. Multiple candidate grayscale thresholds are set to calculate the oil content. By combining the curve of the total fluid oil content with the candidate grayscale thresholds, the curve shape is analyzed to determine the optimal grayscale threshold, so as to achieve accurate identification of the affected and unaffected areas.

Benefits of technology

This significantly improves the accuracy of identifying affected and unaffected areas in microscopic displacement images, enhances the accuracy of oil saturation calculation, and provides a high-precision quantitative data foundation for subsequent microscopic seepage mechanism analysis.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121505014A_ABST
    Figure CN121505014A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides an adaptive threshold processing method and device for a microscopic displacement image, a storage medium and a computer program product. The method comprises the following steps: acquiring a microscopic displacement image acquired in a microscopic displacement experiment process; based on the RGB color space of the microcosmic displacement image, extracting a swept area according to a preset condition; determining a first oil content of an unaffected area of the microscopic displacement image; converting the swept area into a grayscale image, setting and traversing a plurality of candidate grayscale thresholds, and for each threshold, calculating the number of pixels of which the grayscale values are smaller than the threshold in the swept area to obtain a second oil content of the corresponding swept area; determining the oil content of the total fluid according to the first oil content and the second oil content, and drawing a curve of the oil content of the total fluid along with the change of the candidate gray threshold; the curve form is analyzed, the corresponding candidate gray threshold value when the complete monotone decreasing trend is presented for the first time is determined as the optimal gray threshold value, and the remaining oil saturation is determined according to the optimal gray threshold value.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the field of oil development, in particular to a micro-displacement image adaptive threshold processing method and device, a storage medium and a computer program product. BACKGROUND

[0002] In the field of oil development, laboratory experiments are usually the main means to understand various mechanisms of oil reservoirs in the development process. In the experiment of evaluating the effectiveness of a certain development plan, the oil recovery degree as a key parameter can directly and effectively reflect whether the plan is economically feasible. The laboratory experiments in the field of oil include two types of macro and micro: macro experiments can only quantitatively evaluate the experimental results, but cannot effectively reveal the micro mechanisms involved in the experimental process. Therefore, micro experiments are needed to understand the related mechanisms from the micro level, so as to reasonably explain the macro experimental phenomena. The conventional micro experiment generally obtains the pore structure information of the reservoir based on the first-hand data, and then performs one-to-one replication simulation. Common micro experimental equipment includes micro visualization chip and sand filling model.

[0003] After the micro experiment, the main task is to extract and process the images collected during the experiment. The basic idea of this technology is to rely on image processing technology, to identify and segment different color regions based on RGB color space (under the same brightness condition, different types of colors have significant differences in RGB values). By counting the number of pixels in different regions, the required data can be obtained. However, this method has obvious limitations in different types of micro experiments. For micro visualization chip equipment, it is suitable for reservoir types with small pore structure, and the boundaries between different regions in the experimental image are clear; while the sand filling model simulates reservoirs with poor cementation, and the pore structure size is large. After the displacement experiment is completed, there are often regions with high scouring degree, oil-water mixing regions and regions not affected by the image, among which the boundaries between the oil-water mixing regions and other regions are blurred, and it is difficult to directly and accurately segment. Therefore, using the traditional segmentation method will result in large experimental result errors. SUMMARY

[0004] The purpose of the embodiments of the present application is to overcome the problem of large result error of the traditional segmentation method based on RGB color space in the blurred image boundary scene of micro experiments (especially sand filling model displacement experiments), and to provide a micro displacement image adaptive threshold processing method, device, storage medium and computer program product.

[0005] To achieve the above purpose, in one aspect, the present application provides a micro displacement image adaptive threshold processing method, comprising: obtaining a micro displacement image collected during a micro displacement experiment; extracting a swept region according to a preset condition based on an RGB color space of the microscopic displacement image; determining a first oil content of the unswept region of the microscopic displacement image; converting the swept region into a grayscale image, setting and traversing a plurality of candidate grayscale thresholds, and calculating a second oil content of the swept region for each threshold respectively, where the second oil content is the number of pixels with a grayscale value less than the threshold in the swept region; determining a total fluid oil content according to the first oil content and the second oil content, and drawing a curve of the total fluid oil content changing with the candidate grayscale threshold; analyzing the shape of the curve, determining the candidate grayscale threshold corresponding to the first time when a completely monotone decreasing trend is presented as the optimal grayscale threshold, and determining the remaining oil saturation according to the optimal grayscale threshold.

[0006] In the embodiments of the present application, the swept region is extracted according to a preset condition based on an RGB color space of the microscopic displacement image, including: in the microscopic displacement image, the pixels with a blue channel value greater than or equal to a red channel value and a blue channel value greater than or equal to a green channel value are determined as the pixels of the swept region; and the set of the pixels of the swept region is determined as the swept region.

[0007] In the embodiments of the present application, the first oil content of the unswept region of the microscopic displacement image is determined, including: determining the set of all pixel points of the microscopic displacement image as a total area of the model; determining an area ratio of the swept region according to the ratio of the swept region to the total area of the model; obtaining an area ratio of the unswept region based on the area ratio of the swept region, to determine the area of the unswept region; and determining the first oil content based on the product of the area of the unswept region and a unit oil content.

[0008] In the embodiments of the present application, the second oil content of the swept region is calculated, including: in a preset grayscale value range, a plurality of candidate grayscale thresholds are sequentially selected; for each candidate grayscale threshold, all pixel points with a grayscale value less than the current candidate grayscale threshold in the grayscale image are counted to obtain the number of oil-containing pixels under the current threshold; based on the product of the number of oil-containing pixels and a single-pixel area, the oil-containing area in the swept region is obtained; and the product of the oil-containing area and a model thickness is determined as the second oil content, where the model thickness is determined according to the size of the solid particles constituting the porous medium model.

[0009] In the embodiments of the present application, the single-pixel area is obtained, including: obtaining the physical size of the physical model corresponding to the microscopic displacement image; and calculating the single-pixel area according to the ratio of the known physical size to the total number of pixels in the corresponding direction of the microscopic displacement image.

[0010] In the embodiment of the present application, the remaining oil saturation is determined according to the optimal gray threshold value, comprising: determining the sum of the second oil content of the swept area and the first oil content of the unswept area as the third oil content; determining the ratio of the third oil content to the model pore volume as the remaining oil saturation.

[0011] In the embodiment of the present application, the model pore volume is calculated according to the product of the model total area, the model thickness and the porosity, wherein the porosity is determined based on the stacking mode of the solid particles constituting the porous medium model.

[0012] The second aspect of the present application provides a device for adaptive threshold processing of micro-displacement images, comprising: a memory configured to store instructions; a processor configured to call the instructions from the memory and capable of implementing the adaptive threshold processing method for micro-displacement images according to any one of the above embodiments when executing the instructions.

[0013] The third aspect of the present application provides a machine-readable storage medium having instructions stored thereon, which, when executed by a processor, causes the processor to be configured to perform the adaptive threshold processing method for micro-displacement images according to any one of the above embodiments.

[0014] The fourth aspect of the present application provides a computer program product comprising a computer program, which, when executed by a processor, implements the adaptive threshold processing method for micro-displacement images according to any one of the above embodiments.

[0015] Through the above technical solution, the present application can solve the image segmentation problem caused by ambiguous phase boundary and oil-water mixing in micro-displacement experiments, perform coupling calculation of RGB color space and gray information, jointly verify the image segmentation result with the physical law that the total oil content in the displacement process should be monotonically decreasing, greatly improve the recognition accuracy of swept area and unswept area, and improve the accuracy and reliability of oil saturation calculation, thereby providing high-precision quantitative data basis for subsequent micro-flow mechanism analysis and remaining oil distribution research.

[0016] Other features and advantages of the embodiments of the present application will be described in detail in the following specific implementation part. BRIEF DESCRIPTION OF DRAWINGS

[0017] The accompanying drawings are included to provide a further understanding of the embodiments of the present application, and constitute a part of the specification, and are used together with the following specific implementation to explain the embodiments of the present application, but do not constitute a limitation on the embodiments of the present application. In the drawings: Figure 1 The flowchart of the adaptive threshold processing method for micro-displacement images according to the embodiments of the present application is schematically shown. Figure 2 A schematic diagram of the distribution of high scouring, oil-water mixing and un-swept regions during displacement according to an embodiment of the present application is shown schematically; Figure 3 A bar chart of the relationship between oil saturation in swept and un-swept regions according to an embodiment of the present application is shown schematically; Figure 4 A schematic diagram of the distribution of oil saturation in un-swept regions according to an embodiment of the present application is shown schematically; Figure 5 A schematic diagram of the variation of color and grayscale images in swept regions according to an embodiment of the present application is shown schematically; Figure 6 A flowchart of an adaptive threshold processing method for microscopic displacement images according to another embodiment of the present application is shown schematically; Figure 7 A schematic diagram of different curve variation patterns based on an embodiment of the present application according to an embodiment of the present application is shown schematically; Figure 8 A schematic diagram of the internal structure of a computer device according to an embodiment of the present application is shown schematically. DETAILED DESCRIPTION

[0018] In order to make the objectives, technical solutions and advantages of the embodiments of the present application clearer, the technical solutions in the embodiments of the present application will be described clearly and completely below with reference to the drawings in the embodiments of the present application. It should be understood that the specific embodiments described herein are merely intended to illustrate and explain the embodiments of the present application, and are not intended to limit the embodiments of the present application. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative effort fall within the scope of the present application.

[0019] It should be noted that if the embodiments of the present application involve directional indications (such as up, down, left, right, front, back, etc.), the directional indications are merely used to explain the relative positional relationship, movement condition, etc. between components in a certain specific posture (as shown in the drawings). If the specific posture changes, the directional indications also change accordingly.

[0020] Furthermore, if the embodiments of this application involve descriptions such as "first" or "second," these descriptions are for descriptive purposes only and should not be construed as indicating or implying their relative importance or implicitly specifying the number of technical features indicated. Therefore, features defined with "first" or "second" may explicitly or implicitly include at least one of those features. Additionally, the technical solutions of various embodiments can be combined with each other, but this must be based on the ability of those skilled in the art to implement them. If the combination of technical solutions is contradictory or impossible to implement, it should be considered that such a combination of technical solutions does not exist and is not within the scope of protection claimed in this application.

[0021] Figure 1 A schematic flowchart illustrating an adaptive thresholding method for microscopic displacement images according to an embodiment of this application is shown. Figure 1 As shown, in one embodiment of this application, an adaptive thresholding method for microscopic displacement images is provided, comprising the following steps: Step 101: Obtain microscopic displacement images collected during the microscopic displacement experiment.

[0022] Microscopic displacement images are digital images that reflect the fluid distribution in a porous media model and are acquired in real time during a microscopic displacement experiment using a high-definition image acquisition system. The porous media model is composed of stacked transparent solid particles (such as glass beads), and the displacement medium simulates formation water for the displacement experiment. The processor can connect to the image acquisition system to acquire a series of microscopic displacement images collected at different time points during the displacement experiment. These images contain RGB color space information for subsequent analysis of dynamic changes in oil saturation.

[0023] In one embodiment, during the displacement process, the model simultaneously includes a highly scourized region (oil-free), an oil-water mixed region (low oil content), and an unaffected region (high oil content / original oil saturation). The displacement process refers to the process of displacing crude oil from the pores by injecting a displacement medium into the porous medium. In the laboratory, this process is simulated using a microscopic visualization displacement device, and the fluid distribution within the porous medium at different displacement stages is recorded using an image acquisition system, providing a data foundation for subsequent image analysis and oil saturation calculation. In this embodiment, the displacement medium used in the experiment is simulated formation water stained with methylene blue. Methylene blue is a blue dye that makes the water-affected areas appear a bright blue.

[0024] Figure 2 This schematically illustrates the distribution of highly scoured, oil-water mixed, and unaffected areas during the displacement process according to an embodiment of this application. Figure 2As shown, the highly scourged area is located in the upper right of the main image, with corresponding labels and a magnified view in the upper right corner for further observation. This area has been thoroughly scourned by the displacing fluid and contains almost no oil. Visually, it exhibits a uniform color and sparse, light-colored dots, consistent with its oil-free state. The oil-water mixed area appears as a strip-shaped region slightly to the right of the center of the main image, also labeled and with a magnified view in the upper left corner. This area shows a mixture of colors and a dense distribution of dots, reflecting the coexistence of oil and water, consistent with the description of low oil content. The unaffected area is located on the left side of the main image, labeled and with a magnified view in the lower left corner. Unaffected by the displacing fluid, this area retains its original oily state. The image clearly shows significant differences in color and dot distribution compared to the highly scourted and oil-water mixed areas, clearly demonstrating its unaffected state.

[0025] In this embodiment, during the displacement experiment, the overall oil saturation should gradually decrease, the oil content in the affected area should gradually increase, and the oil content in the unaffected area should gradually decrease. Therefore, the oil saturation in the unaffected area and the oil saturation in the affected area of ​​each image are extracted and summed, and a change curve is plotted. The curve should show a decreasing trend. Figure 3 As shown, the horizontal axis represents the number of photographs taken, increasing from 0 to 16 in increments of 2, reflecting different time points during the displacement experiment. The left vertical axis represents the percentage of oil saturation in the unaffected area, ranging from 50% to 80%; the right vertical axis represents the percentage of oil saturation in the affected area, ranging from 0 to 5%. Each bar consists of two colors: blue represents the oil saturation in the unaffected area, and orange represents the oil saturation in the affected area. It is clear from the graph that as the number of photographs increases, the blue portion (oil saturation in the unaffected area) generally shows a gradual decreasing trend. When the number of photographs is 0, the oil saturation in the unaffected area is the highest, close to 77%; when the number of photographs increases to 16, the oil saturation in the unaffected area decreases to about 69%. This indicates that during the displacement experiment, the oil content in the unaffected area gradually decreases as the experiment progresses. The orange portion (oil saturation in the affected area) shows a gradual increasing trend as the number of photographs increases. When the number of photographs taken was 0, the oil saturation in the affected area was low, approximately 0.5%. When the number of photographs taken reached 16, the oil saturation in the affected area increased to approximately 2.3%. This indicates that during the displacement experiment, the oil content in the affected area gradually increased, and the displacing fluid continuously entered the previously unaffected area, displacing the crude oil and changing the oil content in that area.

[0026] Step 102: Based on the RGB color space of the microscopic displacement image, extract the affected area according to preset conditions.

[0027] In one embodiment, the processor extracts the affected region based on the RGB color space of the microscopic displacement image and according to preset conditions, including: in the microscopic displacement image, determining pixels whose blue channel value is greater than or equal to the red channel value and whose blue channel value is greater than or equal to the green channel value as pixels in the affected region; and determining the set of pixels in the affected region as the affected region.

[0028] In one embodiment, because methylene blue in the displacing medium has strong reflective properties to blue light, the displaced crude oil usually appears dark or transparent. This makes the swept area occupied by the dyed water show obvious blue-dominated characteristics in the image, while the unswept area retains the dark characteristics of crude oil because it does not contain dyed water, and the oil-water mixed area shows color characteristics between the two.

[0029] For each pixel in the microscopic displacement image, the processor simultaneously compares the values ​​of its blue, red, and green channels. When the blue channel value is greater than or equal to the red channel value and the green channel value is greater than or equal to the green channel value, the pixel is determined to be a pixel in the swept area, and all pixels that meet the above color conditions are grouped together to form a complete swept area.

[0030] Step 103: Determine the first oil content in the unaffected area of ​​the micro-displacement image.

[0031] In one embodiment, the processor determines the first oil content of the unaffected region of the micro-displacement image by: determining the set of all pixels of the micro-displacement image as the total area of ​​the model; determining the area ratio of the affected region based on the ratio of the affected region to the total area of ​​the model; obtaining the area ratio of the unaffected region based on the area ratio of the affected region to determine the area of ​​the unaffected region; and determining the first oil content based on the product of the area of ​​the unaffected region and the unit oil content.

[0032] In one embodiment, the processor determines the total model area as the physical area corresponding to the set of all pixels contained in the microscopic displacement image. This area is obtained through image calibration, specifically by multiplying the total number of pixels in the image by the area of ​​a single pixel, where the area of ​​a single pixel is calculated as the ratio of the known physical dimensions of the model to the number of pixels in the corresponding direction of the image. The affected area ratio is determined based on the ratio of the number of extracted affected area pixels to the total number of pixels in the image. Based on the affected area ratio, the unaffected area is calculated using the formula: Unaffected area area = Total model area × (1 - Affected area ratio). A first oil content is determined based on the product of the unaffected area area and the unit oil content, where the unit oil content is determined based on the size and stacking method of the solid particles constituting the porous media model.

[0033] In one embodiment, for a regularly arranged glass bead model, the unit oil content can be obtained through theoretical calculation. For example... Figure 4 As shown in the figure, the multiple circles represent glass beads, which are the basic units constituting this microscopic model. The glass beads have a regular spherical shape and are closely arranged in the model. The arrows in the figure represent the direction of fluid flow, and the gray areas between the glass beads represent the space where the fluid (oil, water, or an oil-water mixture) exists, i.e., the pore space.

[0034] In this embodiment, the radius of the glass bead is R, and the volume of a single glass bead is... If the glass beads are arranged in a simple cubic stack, with adjacent beads tangent to each other, then the edge length of a single glass bead is 2R, and the total volume of the space corresponding to a single glass bead is 8R. 3 Assuming the number of glass beads per unit space is n, then the total volume of glass beads per unit space is... Since the volume per unit space is fixed, the volume occupied by oil per unit space should be: volume per unit space - The oil content per unit volume can be expressed as the volume fraction of oil per unit space, i.e., (unit space volume - ... ) / unit space volume.

[0035] Step 104: Convert the affected area into a grayscale image, set and iterate through multiple candidate grayscale thresholds, and calculate the number of pixels in the affected area whose grayscale value is less than the threshold for each threshold, so as to obtain the second oil content of the corresponding affected area.

[0036] In one embodiment, the processor obtains the second oil content of the corresponding affected area according to the following steps: within a preset grayscale value range, multiple candidate grayscale thresholds are selected sequentially; for each candidate grayscale threshold, all pixels in the grayscale image with grayscale values ​​less than the current candidate grayscale threshold are counted to obtain the number of oil-containing pixels under the current threshold; based on the product of the number of oil-containing pixels and the area of ​​a single pixel, the oil-containing area within the affected area is obtained; the product of the oil-containing area and the model thickness is determined as the second oil content, wherein the model thickness is determined according to the size of the solid particles constituting the porous medium model.

[0037] In one embodiment, the processor converts the microscopic displacement image's affected area from a color image to a grayscale image. Since the center of the glass bead is the whitest and brightest, its grayscale value is the highest, close to 255. Areas with lower scouring levels are darker, with corresponding grayscale values ​​closer to 0. Therefore, the overall grayscale value within the affected area is between 0 and 255. Figure 5The diagram illustrates the variation patterns of color and grayscale images in the affected area based on an embodiment of this application. The color bar in the diagram gradually changes color from left to right, transitioning from black to blue, and then to white. Below the color bar are numerical values ​​ranging from 0 to 255, which typically represent the grayscale or color intensity range of pixels in the image. In image processing and analysis, 0-255 is a common scale for representing pixel brightness or color depth; 0 generally represents the darkest (e.g., black), and 255 represents the brightest (e.g., white). The color bar is divided into four regions, each labeled from left to right: Weak scouring region, located on the far left of the color bar, corresponding to a darker area. In the displacement experiment image, this region represents an area where the displaced fluid has a weak scouring effect, possibly still retaining a significant amount of crude oil, and appears as a darker tone in the image; Oil-water mixing region, immediately following the weak scouring region, is slightly brighter than the weak scouring region. This region indicates the area where the displaced fluid and crude oil are mixed during the displacement process, showing the characteristic color of oil-water mixing in the image; High scouring region, located slightly to the right of the middle of the color bar, is even brighter. This region is where the displaced fluid has fully acted, containing almost no oil, and appears as a brighter color in the image; Glass bead region, located on the far right of the color bar, is the brightest (close to white). This region represents the glass bead portion of the model, which appears bright in the image due to the inherent properties of the glass beads.

[0038] In one embodiment, the processor sets the grayscale threshold traversal range to 0 to 100, and sequentially selects candidate grayscale thresholds with a step size of 1. For each candidate grayscale threshold, all pixels in the grayscale image with grayscale values ​​less than the current threshold are counted. For example, when the candidate grayscale threshold is 30, all pixels with grayscale values ​​in the range of 0-29 are counted and identified as oil-containing pixels. The number of oil-containing pixels obtained is multiplied by the area of ​​a single pixel to obtain the oil-containing area within the affected region under the current threshold. The area of ​​a single pixel is obtained through image calibration, specifically by dividing the known physical size of the model by the number of pixels in the corresponding direction. The oil-containing area is multiplied by the model thickness to obtain the second oil content corresponding to the current threshold. The model thickness is determined based on the size of the solid particles constituting the porous medium model; for a glass bead model with a particle size of 0.5 mm, the model thickness is 0.5 mm.

[0039] Step 105: Determine the total fluid oil content based on the first oil content and the second oil content, and plot the curve of the total fluid oil content as a function of the candidate grayscale threshold.

[0040] In one embodiment, for each candidate grayscale threshold, the processor adds the obtained first oil content of the unaffected area to the second oil content of the affected area under the corresponding threshold to obtain the total fluid oil content corresponding to that candidate grayscale threshold. After traversing all candidate grayscale thresholds, a complete total oil content data sequence is obtained. A Cartesian coordinate system is established with the candidate grayscale thresholds as the abscissa and the total fluid oil content as the ordinate. The obtained total oil content data sequence is plotted as a curve in this coordinate system to form a graph showing the relationship between the total fluid oil content and the candidate grayscale thresholds.

[0041] Step 106: Analyze the shape of the curve, determine the candidate grayscale threshold corresponding to the first time it shows a completely monotonically decreasing trend as the optimal grayscale threshold, and determine the remaining oil saturation based on the optimal grayscale threshold.

[0042] In one embodiment, the processor calculates the total oil content at different grayscale thresholds and selects an appropriate threshold based on the curve shape of the change with grayscale value. If the selected threshold is too high, some pure water pixels may be misclassified as oily areas, causing the curve to show an increasing or first decreasing then increasing trend. In this case, the grayscale value should be appropriately reduced. When the grayscale value drops to the optimal value, the curve will first show a completely decreasing shape. However, if the grayscale value continues to decrease, some oily pixels will be missed, resulting in an underestimation of the oil content in the affected area. Although the curve still shows a decreasing trend, this grayscale value is not optimal.

[0043] In one embodiment, the remaining oil saturation is determined based on the optimal grayscale threshold: the processor determines the third oil content by the sum of the second oil content in the affected area and the first oil content in the unaffected area; the ratio of the third oil content to the model pore volume is determined as the remaining oil saturation, wherein the remaining oil saturation refers to the percentage of crude oil volume remaining in the reservoir pores relative to the total volume of rock pores after the oil field has been extracted by one or more methods (such as natural energy extraction, water injection, gas injection, etc.).

[0044] In one embodiment, the processor first analyzes the curve of total oil content changing with candidate grayscale thresholds and judges them in ascending order of thresholds. When it is found that starting from a certain candidate grayscale threshold X_start, the following conditions are met: (1) the total oil content corresponding to X_start is less than the total oil content corresponding to the previous threshold (X_start-1); (2) the total oil content corresponding to all thresholds greater than X_start is less than the total oil content corresponding to the previous threshold. Then the judgment curve shows a completely monotonically decreasing trend for the first time starting from X_start, and X_start is determined as the optimal grayscale threshold. The second oil content corresponding to the optimal grayscale threshold is added to the first oil content of the unaffected area to obtain the third oil content, which is the final total oil content. The third oil content is divided by the model pore volume to obtain the optimal grayscale value and the corresponding remaining oil saturation: Remaining oil saturation = (third oil content / model pore volume) × 100%.

[0045] This application provides an adaptive thresholding method for microscopic displacement images. By fusing RGB color space and grayscale information, and combining this with the physical law of decreasing total oil content during the displacement process, it achieves accurate identification of blurred boundaries and accurate calculation of oil saturation. This method couples and verifies image processing results with physical laws, effectively distinguishing between oil-water mixtures and pure water within the affected area, significantly improving the accuracy of identifying affected and unaffected areas in microscopic displacement images.

[0046] Figure 6 A schematic flowchart illustrating an adaptive thresholding method for microscopic displacement images according to another embodiment of this application is shown. Figure 6 As shown, another adaptive thresholding method for microscopic displacement images is provided, including: Step S1: Based on the RGB color space, extract the affected area area according to the dominance of the B channel value of the blue pixel, thereby obtaining the unaffected area area and calculating the oil content of the unaffected area.

[0047] The processor is based on the RGB color space. It extracts the area of ​​the affected region based on the dominance of the B channel value of the blue pixel (i.e., satisfying B≥R and B≥G), thereby obtaining the area of ​​the unaffected region. It then calculates the oil content of the unaffected region by combining the unit oil content.

[0048] Step S2: Convert the extracted swept area image into a grayscale image and calculate the oil content of the swept area under different grayscale levels.

[0049] The processor converts the extracted affected area image into a grayscale image, traverses candidate grayscale thresholds within a preset grayscale range, and calculates the oil-bearing area and corresponding oil content within the affected area under different grayscale thresholds.

[0050] Step S3: Sum the oil content of the affected area and the unaffected area and plot the curve.

[0051] The processor sums the oil content in the affected area and the oil content in the unaffected area corresponding to different grayscale thresholds to obtain the total oil content sequence, and plots the curve of total oil content changing with grayscale threshold.

[0052] Step S4: Analyze the curve shape, select an appropriate grayscale value, and confirm the remaining oil saturation.

[0053] By analyzing the curve shape, the processor determines the gray value that first shows a completely monotonically decreasing trend as the optimal threshold based on the physical law that "the total oil content should decrease with the displacement process," and calculates the final remaining oil saturation based on this threshold.

[0054] In one specific embodiment, the microscopic visualization model is filled with transparent glass beads of a certain mesh size and interstitial sand. The model is then saturated with simulated formation water and formation crude oil. A waterflooding simulation is then performed using simulated formation water stained with methylene blue. Real-time image acquisition of the model is conducted using an image acquisition system. The subsequent image processing steps are as follows: (1) Based on the RGB color space, using the rule B≥G&B≥R, the number of pixels in the affected area is extracted to obtain the area of ​​the affected area, thereby obtaining the area of ​​the unaffected area, and finally obtaining the oil content of the unaffected area. A set of experiments contains several images, and the oil content of the unaffected area in each image is extracted.

[0055] (2) Set the threshold (grayscale value) test range (0~X). The range of the affected area has been extracted in (1). The affected area includes the reflective area around the glass bead, the highly scourted area, and the oil-water mixed area. The closer to the oil-water mixed area, the darker the color and the smaller the grayscale value. Therefore, the value of X can be adjusted (taking 100 as an example). Convert the affected area into a grayscale image and calculate the number of pixels in the affected area whose grayscale value is less than the set grayscale value under different grayscale value conditions. This will give the oil content of the affected area under different threshold conditions. Add the oil content of the unaffected area in (1) to the oil content of the affected area in (2) and draw a curve. This will give you 100 curves. Analyze the curve shape and find the first curve that starts to decrease. The saturation corresponding to the curve change tending to stabilize is the remaining oil saturation.

[0056] like Figure 7The figure shows schematic diagrams illustrating different curve variations based on embodiments of this application. As shown, the horizontal axis represents the number of photographs taken in the two sub-figures, ranging from approximately 0 to 30, reflecting different time points in the displacement experiment. The vertical axis represents oil saturation, expressed as a percentage (%), ranging from approximately 40% to 85%, used to measure the amount of oil in the model at different stages. Curve ① initially decreases and then increases, likely because the selected threshold was too high. In the early stages of the experiment, some pure water pixels were misclassified as oil-containing areas, causing the calculated oil saturation value to be artificially high and thus showing a decreasing trend. Curve ② is the first purely decreasing curve, corresponding to the optimal grayscale value. Curves ③ and ⑤ are purely decreasing curves. Since curve ② was the first purely decreasing curve (corresponding to the optimal grayscale value), while curves ③ and ⑤ were obtained at other grayscale values, this indicates that the current corresponding grayscale value is lower than the optimal grayscale value. At this time, some oil-containing pixels were missed, resulting in a lower calculated oil content in the affected area. Therefore, although the curve shape is decreasing, the corresponding grayscale value is not optimal. Curve ④ is a purely increasing curve because the selected threshold was too high, causing a large number of pure water pixels to be misclassified as oil-containing areas, resulting in an artificially high increasing value. This grayscale value is invalid.

[0057] This application provides a storage medium storing a program that, when executed by a processor, implements the adaptive thresholding method for microscopic displacement images described above.

[0058] This application provides a processor for running a program, wherein the program executes the adaptive thresholding method for microscopic displacement images described above.

[0059] In one embodiment, a computer device is provided, which may be a terminal, and its internal structure diagram may be as follows: Figure 8As shown in the figure, the computer device includes a processor A01, a network interface A02, a display screen A04, an input device A05, and a memory (not shown) connected via a system bus. The processor A01 provides computing and control capabilities. The memory includes internal memory A03 and a non-volatile storage medium A06. The non-volatile storage medium A06 stores an operating system B01 and a computer program B02. The internal memory A03 provides an environment for the operation of the operating system B01 and the computer program B02 stored in the non-volatile storage medium A06. The network interface A02 is used for communication with external terminals via a network connection. When the computer program is executed by the processor A01, it implements an adaptive thresholding method for microscopic displacement images. The display screen A04 can be a liquid crystal display (LCD) or an e-ink display. The input device A05 can be a touch layer covering the display screen, buttons, a trackball, or a touchpad mounted on the computer device casing, or an external keyboard, touchpad, or mouse.

[0060] Those skilled in the art will understand that Figure 8 The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device to which the present application is applied. Specific computer devices may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.

[0061] This application provides a computer (electronic) device, which includes a processor, a memory, and a program stored in the memory and executable on the processor. When the processor executes the program, it implements the steps of any of the above adaptive thresholding methods for microscopic displacement images.

[0062] This application also provides a computer program product that, when executed on a data processing device, is adapted to perform a program that initializes an adaptive thresholding method for microscopic displacement images.

[0063] Those skilled in the art will understand that embodiments of this application can be provided as methods, systems, or computer program products. Therefore, this application can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, this application can take the form of a computer program product embodied on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0064] This application is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of this application. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.

[0065] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.

[0066] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.

[0067] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.

[0068] Memory may include non-persistent memory in computer-readable media, such as random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash RAM. Memory is an example of computer-readable media.

[0069] Computer-readable media includes both permanent and non-permanent, removable and non-removable media that can store information using any method or technology. Information can be computer-readable instructions, data structures, modules of programs, or other data. Examples of computer storage media include, but are not limited to, phase-change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technologies, CD-ROM, digital versatile optical disc (DVD) or other optical storage, magnetic tape, magnetic disk storage or other magnetic storage devices, or any other non-transferable medium that can be used to store information accessible by a computing device. As defined herein, computer-readable media does not include transient computer-readable media, such as modulated data signals and carrier waves.

[0070] It should also be noted that the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such process, method, article, or apparatus. Unless otherwise specified, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes that element.

[0071] The above are merely embodiments of this application and are not intended to limit the scope of this application. Various modifications and variations can be made to this application by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the scope of the claims of this application.

Claims

1. An adaptive thresholding method for microscopic displacement images, characterized in that, The method includes: Acquire microscopic displacement images collected during the microscopic displacement experiment; Based on the RGB color space of the microscopic displacement image, the affected area is extracted according to preset conditions; Determine the first oil content in the unaffected area of ​​the microscopic displacement image; The affected area is converted into a grayscale image. Multiple candidate grayscale thresholds are set and iterated. For each threshold, the number of pixels in the affected area with grayscale values ​​less than the threshold is calculated to obtain the second oil content of the corresponding affected area. The total fluid oil content is determined based on the first oil content and the second oil content, and a curve showing the change of total fluid oil content with candidate grayscale thresholds is plotted. By analyzing the shape of the curve, the candidate grayscale threshold corresponding to the first time a completely monotonically decreasing trend is determined as the optimal grayscale threshold, and the remaining oil saturation is determined based on the optimal grayscale threshold.

2. The adaptive threshold processing method according to claim 1, characterized in that, The extraction of the swept region based on the RGB color space of the microscopic displacement image according to preset conditions includes: In the microscopic displacement image, pixels whose blue channel value is greater than or equal to the red channel value and whose blue channel value is greater than or equal to the green channel value are determined to be pixels in the affected area; The set of pixels in the affected area is defined as the affected area.

3. The method according to claim 1, characterized in that, The determination of the first oil content in the unaffected area of ​​the microscopic displacement image includes: The total area of ​​the model is determined by the set of all pixels in the microscopic displacement image. The affected area ratio is determined based on the ratio of the affected area to the total area of ​​the model. Based on the ratio of the affected area area, the ratio of the unaffected area area is obtained to determine the area of ​​the unaffected area; The first oil content is determined based on the product of the area of ​​the unaffected region and the unit oil content.

4. The method according to claim 1, characterized in that, The process of obtaining the second oil content of the corresponding swept area includes: Within a preset grayscale value range, multiple candidate grayscale thresholds are selected sequentially; For each candidate grayscale threshold, count all pixels in the grayscale image whose grayscale value is less than the current candidate grayscale threshold to obtain the number of oil-containing pixels under the current threshold. The oil-bearing area within the affected region is obtained by multiplying the number of oil-bearing pixels by the area of ​​a single pixel. The product of the oil-bearing area and the model thickness is determined as the second oil content, wherein the model thickness is determined based on the size of the solid particles constituting the porous medium model.

5. The method according to claim 4, characterized in that, The acquisition of the single pixel area includes: Obtain the physical dimensions of the physical model corresponding to the microscopic displacement image; The area of ​​a single pixel is calculated based on the ratio of the physical size to the total number of pixels in the corresponding direction of the microscopic displacement image.

6. The method according to claim 1, characterized in that, Determining the remaining oil saturation based on the optimal grayscale threshold includes: The sum of the second oil content in the affected area and the first oil content in the unaffected area is determined as the third oil content; The ratio of the third oil content to the model pore volume is determined as the remaining oil saturation.

7. The method according to claim 6, characterized in that, The pore volume of the model is calculated based on the product of the total area of ​​the model, the model thickness, and the porosity, wherein the porosity is determined based on the stacking pattern of the solid particles constituting the porous medium model.

8. An adaptive thresholding device for microscopic displacement images, characterized in that, include: The memory is configured to store instructions; The processor is configured to retrieve the instructions from the memory and, when executing the instructions, to implement the adaptive thresholding method for microscopic displacement images according to any one of claims 1 to 7.

9. A machine-readable storage medium storing instructions thereon, characterized in that, When executed by a processor, the instruction causes the processor to be configured to perform the adaptive thresholding method for microdisplacement images according to any one of claims 1 to 7.

10. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by a processor, it implements the adaptive thresholding method for microscopic displacement images according to any one of claims 1 to 7.