A rock component modeling method based on image recognition
By combining XRD mineral identification and image grayscale recognition, an image recognition-based rock composition modeling method was established, which solves the problem of insufficient mineral composition correlation in existing technologies, realizes accurate modeling and automated grouping of rock compositions, and improves the accuracy and adaptability of modeling.
Patent Information
- Application Number
- CN202510632762.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-05-16
- Publication Date
- 2026-01-27
- Estimated Expiration
- 2045-05-16
AI Technical Summary
Existing rock mechanics and microstructure modeling methods lack a connection with real mineral composition and cannot achieve accurate mapping from image pixels to mineral categories.
A granite modeling method integrating XRD mineral identification and image grayscale identification is proposed. PFC software is used for particle modeling, and a rock composition analysis model is established through grayscale threshold range and discrete element model to achieve accurate mapping from image pixels to mineral categories.
It improves the accuracy and automation of microstructure modeling, and can reflect the actual microstructure composition characteristics of multi-mineral rocks, providing a real and reliable numerical basis for numerical simulation of different rock types and engineering backgrounds.
Smart Images

Figure CN120805619B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of numerical simulation experimental technology, specifically to a rock composition modeling method based on image recognition. Background Technology
[0002] In the fields of rock mechanics and microstructure modeling, mineral identification methods are often used to numerically model samples. However, existing methods lack a correlation with the actual mineral composition and cannot achieve accurate mapping from image pixels to mineral categories. Summary of the Invention
[0003] In view of the technical problems existing in the background art, this application provides a rock composition modeling method based on image recognition. This rock composition modeling method based on image recognition integrates XRD mineral recognition and image grayscale recognition granite modeling method, and combines PFC software for particle modeling, which effectively improves the accuracy and automation level of microstructure modeling.
[0004] In a first aspect, embodiments of this application provide a modeling method for rock composition analysis based on image recognition, comprising the following steps:
[0005] Acquire image data of the rock and rock composition data of the rock;
[0006] The image data is converted to grayscale to obtain the grayscale data corresponding to each pixel in the image data;
[0007] Based on the rock composition data and the grayscale data corresponding to each pixel, the grayscale threshold ranges corresponding to various components in the rock are derived.
[0008] A discrete element model is established, and the grayscale data corresponding to each pixel is associated with the spherical particles in the discrete element model;
[0009] Based on the grayscale threshold ranges corresponding to various components, the spherical particles in the discrete model are grouped to establish a rock composition analysis model.
[0010] Furthermore, in this embodiment, the rock composition data includes the rock composition and the rock composition ratio, which are obtained based on X-ray diffraction experiments.
[0011] Furthermore, in this embodiment, the step of deriving the grayscale threshold range corresponding to various components in the rock based on the rock component data and the grayscale data corresponding to each pixel includes:
[0012] A histogram is constructed based on the grayscale data corresponding to each pixel, and the cumulative distribution function is calculated by accumulating each item.
[0013] The cumulative distribution function is normalized and matched with rock component data to derive the grayscale threshold ranges corresponding to various components in the rock.
[0014] Furthermore, in this embodiment, associating the grayscale data corresponding to each pixel with the spherical particles in the discrete element model includes:
[0015] Each pixel in the image data is projected into the discrete element model through spatial mapping.
[0016] The grayscale data of each pixel is accumulated into the spherical particle in the discrete element model based on the neighborhood search algorithm, and the average grayscale value of the spherical particle is calculated based on the number of hits of the spherical particle.
[0017] The average gray value is used to match the gray value threshold range corresponding to various components of the spherical particles.
[0018] Furthermore, in this embodiment, projecting each pixel in the image data into the discrete element model via spatial mapping includes:
[0019] Construct a coordinate system for the image data, and convert the position of each pixel in the image data into coordinates in the coordinate system. Combine the coordinates of each pixel and the corresponding grayscale data to form a triplet data (X, Y, grayscale).
[0020] Align the coordinate system with the discrete element model, and map the triplet data values into the discrete element model.
[0021] Furthermore, in this embodiment, establishing the rock composition analysis model includes:
[0022] The physical parameters of the rock components are matched based on the rock component data; and the rock component analysis model is established based on the grouping of the spherical particles in the discrete model.
[0023] Furthermore, in this embodiment, image data of the rock is acquired using a camera.
[0024] Secondly, embodiments of this application provide a computer-readable storage medium, which is a non-volatile or non-transient storage medium, on which a computer program is stored. When the computer program is run by a processor, it executes the steps of the modeling method for the rock composition analysis model based on image recognition described above.
[0025] Thirdly, embodiments of this application provide a computer program product, including a computer program / instruction, which, when executed by a processor, implements the steps of the modeling method for rock composition analysis model based on image recognition as described above.
[0026] Fourthly, embodiments of this application provide an image recognition-based rock composition analysis model, including a memory and a processor. The memory stores a computer program that can run on the processor. When the processor runs the computer program, it executes the steps of the modeling method for the image recognition-based rock composition analysis model described above.
[0027] Beneficial Effects: This invention establishes a rock composition modeling method based on image recognition by combining X-ray diffraction experimental results with image grayscale distribution information. By integrating spatial coordinate mapping and grayscale assignment methods from the discrete element method, it achieves automatic grouping of rock models at the particle level. This method not only reflects the actual microscopic composition characteristics of multi-mineral rocks but also possesses good adaptability and scalability, making it widely applicable to numerical simulations of different rock types and engineering backgrounds. Compared to traditional modeling methods that rely on manual grouping and parameter setting, this invention improves the intelligence level and structural fidelity of model construction, providing a more realistic and reliable numerical foundation for multi-scale fracture evolution simulation and rock mass engineering response analysis.
[0028] The above description is only an overview of the technical solution of this application. In order to better understand the technical means of this application and to implement it in accordance with the contents of the specification, and to make the above and other objects, features and advantages of this application more obvious and understandable, the following are specific embodiments of this application. Attached Figure Description
[0029] To more clearly illustrate the technical solution of this application, the accompanying drawings used in this application will be briefly described below. Obviously, the drawings described below are merely some embodiments of this application. For those skilled in the art, other drawings can be obtained from these drawings without any creative effort.
[0030] Figure 1 The flowchart of a rock composition modeling method based on image recognition is provided for an embodiment of this application. Detailed Implementation
[0031] The embodiments of the technical solution of this application will now be described in detail with reference to the accompanying drawings. These embodiments are only used to more clearly illustrate the technical solution of this application and are therefore merely examples, and should not be used to limit the scope of protection of this application.
[0032] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application pertains; the terminology used herein is for the purpose of describing particular embodiments only and is not intended to limit the application; the terms “comprising” and “having”, and any variations thereof, in the specification, claims, and foregoing description of the drawings are intended to cover non-exclusive inclusion.
[0033] In the description of the embodiments of this application, technical terms such as "first" and "second" are used only to distinguish different objects and should not be construed as indicating or implying relative importance or implicitly specifying the number, specific order, or primary and secondary relationship of the indicated technical features. In the description of the embodiments of this application, "multiple" means two or more, unless otherwise explicitly defined.
[0034] In this document, the term "embodiment" means that a particular feature, structure, or characteristic described in connection with an embodiment may be included in at least one embodiment of this application. The appearance of this phrase in various places throughout the specification does not necessarily refer to the same embodiment, nor is it a separate or alternative embodiment mutually exclusive with other embodiments. It will be explicitly and implicitly understood by those skilled in the art that the embodiments described herein can be combined with other embodiments.
[0035] In the description of the embodiments in this application, the term "and / or" is merely a description of the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A existing alone, A and B existing simultaneously, and B existing alone. Additionally, the character " / " in this document generally indicates that the preceding and following related objects have an "or" relationship.
[0036] In the description of the embodiments of this application, the term "multiple" refers to two or more (including two), similarly, "multiple sets" refers to two or more (including two sets), and "multiple pieces" refers to two or more (including two pieces).
[0037] In the description of the embodiments of this application, the technical terms "center," "longitudinal," "lateral," "length," "width," "thickness," "upper," "lower," "front," "rear," "left," "right," "vertical," "horizontal," "top," "bottom," "inner," "outer," "clockwise," "counterclockwise," "axial," "radial," and "circumferential" indicate the orientation or positional relationship based on the orientation or positional relationship shown in the accompanying drawings. They are only for the convenience of describing the embodiments of this application and simplifying the description, and are not intended to indicate or imply that the device or element referred to must have a specific orientation, or be constructed and operated in a specific orientation. Therefore, they should not be construed as limitations on the embodiments of this application.
[0038] In the description of the embodiments of this application, unless otherwise expressly specified and limited, technical terms such as "installation," "connection," "joining," and "fixing" should be interpreted broadly. For example, they can refer to a fixed connection, a detachable connection, or an integral part; they can refer to a mechanical connection or an electrical connection; they can refer to a direct connection or an indirect connection through an intermediate medium; they can refer to the internal communication of two components or the interaction between two components. For those skilled in the art, the specific meaning of the above terms in the embodiments of this application can be understood according to the specific circumstances.
[0039] In the fields of rock mechanics and microstructure modeling, mineral identification methods are often used to numerically model samples. However, existing methods lack a correlation with the actual mineral composition and cannot achieve accurate mapping from image pixels to mineral categories.
[0040] To address the technical problem that existing methods lack correlation with real mineral composition and cannot achieve accurate mapping from image pixels to mineral categories, this application provides a rock composition modeling method based on image recognition. This method integrates XRD mineral recognition and image grayscale recognition for granite modeling, and combines PFC software for particle modeling, effectively improving the accuracy and automation level of microstructure modeling.
[0041] This application provides a rock composition modeling method based on image recognition, specifically including the following steps:
[0042] S1. Acquire image data and rock composition data of the rock;
[0043] S2. Perform grayscale processing on the image data and obtain the grayscale data corresponding to each pixel in the image data;
[0044] S3. Based on the rock composition data and the grayscale data corresponding to each pixel, the grayscale threshold range corresponding to various components in the rock is derived.
[0045] S4. Establish a discrete element model and associate the grayscale data corresponding to each pixel with the spherical particles in the discrete element model;
[0046] S5. Based on the grayscale threshold range corresponding to various components, the spherical particles in the discrete model are grouped to establish a rock component analysis model.
[0047] Specifically, in this embodiment, an image acquisition device and a rock composition analysis device are used to acquire images and analyze the composition of rock samples, thereby obtaining image data and rock composition data of the rock samples. The image data is then converted to grayscale to obtain the grayscale data corresponding to each pixel in the image data. Based on the rock composition data and the grayscale data corresponding to each pixel, the grayscale threshold ranges corresponding to various components in the rock are derived. A discrete element model is established, and the grayscale data corresponding to each pixel is associated with the spherical particles in the discrete element model. Based on the grayscale threshold ranges corresponding to various components, the spherical particles in the discrete model are grouped to establish a rock composition analysis model. In this embodiment, by combining the image data and rock composition data of the rock, an image recognition mechanism for automatically back-calculating grayscale thresholds is established. Combined with the spatial coordinate mapping and grayscale assignment method in the discrete element method, automatic grouping of rock modeling at the particle level is realized. This mechanism can reflect the actual microscopic composition characteristics of multi-mineral rocks such as granite, and has good adaptability and scalability. It can be widely applied to numerical simulations of different rock types and engineering backgrounds, providing a more realistic and reliable numerical basis for multi-scale fracture evolution simulation of rocks and rock mass engineering response analysis.
[0048] like Figure 1 As shown, Figure 1 This application provides a flowchart of a rock composition modeling method based on image recognition, which specifically includes the following steps:
[0049] S1. Acquire image data and rock composition data of the rock;
[0050] For example, in this embodiment, a high-definition digital camera is used to photograph the rock sample to obtain high-resolution rock image data;
[0051] When obtaining rock composition data, X-ray diffraction (XRD) analysis can be used to analyze the rock sample composition, thereby obtaining rock composition data such as rock components and rock component proportions. For example, after XRD analysis, a rock sample was confirmed to be mainly composed of Mica, Quartz, and Feldspar, with Mica accounting for 6.6%, Quartz accounting for 23.8%, and Feldspar accounting for 69.6%.
[0052] S2. Perform grayscale processing on the image data and obtain the grayscale data corresponding to each pixel in the image data;
[0053] For example, the image data acquired by a high-definition digital camera is generally a color image. In this embodiment, the image data RGB color space is mapped to a single-channel grayscale value by means of averaging or weighting, and then the image is grayscale processed. The grayscale processed image is then split into pixels to obtain the grayscale data corresponding to each pixel in the image data.
[0054] S3. Based on the rock composition data and the grayscale data corresponding to each pixel, the grayscale threshold range corresponding to various components in the rock is derived.
[0055] For example, in this embodiment, the grayscale data corresponding to each pixel in the image data is statistically analyzed to construct a complete grayscale histogram with a grayscale value range of 0 to 255, so as to reflect the number of pixels corresponding to each grayscale level.
[0056] By summing the grayscale histograms one by one, we obtain the Cumulative Distribution Function (CDF), which represents the proportion of pixels with grayscale values less than or equal to a certain value. To facilitate calculation and delimitation, the CDF is normalized so that its value range is limited to between 0 and 1.
[0057] The cumulative distribution function is matched with the rock component data. The position in the cumulative distribution function that is first greater than or equal to the target proportion is searched. The gray value corresponding to the position is determined as the boundary threshold, and then the gray value threshold range corresponding to various components in the rock is derived.
[0058] S4. Establish a discrete element model and associate the grayscale data corresponding to each pixel with the spherical particles in the discrete element model;
[0059] For example, in this embodiment, step S4 specifically includes the following steps:
[0060] S41. Establish a discrete element model. In this implementation, a discrete element model can be established using PFC (Particle Flow Code) software. In the PFC modeling environment, define the spatial range of the modeling domain and particle parameters, set random particles, and generate the model boundary wall. At the same time, distribute spherical particles within the specified box area according to the target porosity and particle radius range. Assign density and damping coefficients to all spheres, initialize the material constitutive relation to a linear contact model, set Young's modulus, and the ratio of normal to tangential stiffness to establish the discrete element model.
[0061] S42. Project each pixel in the image data into the discrete element model through spatial mapping;
[0062] Specifically, the image resolution is obtained to determine the height and width of the image. The XY physical space coordinate system of the image data is constructed with the image center as the origin. The position of each pixel in the image data and the number of image pixels are used to generate corresponding coordinate points. Then, the coordinates of each pixel in the image are obtained in two-dimensional space. The coordinates of each pixel and the corresponding grayscale data are combined to form a triplet data (X, Y, grayscale).
[0063] Align the coordinate system with the discrete element model to map the triplet data into the discrete element model, ensuring that the physical coordinates of the image pixels are consistent with the spatial range of the discrete element model, and avoiding data misalignment due to coordinate system or scale errors.
[0064] S43. Based on the neighborhood search algorithm, the grayscale data of each pixel is accumulated into the spherical particles in the discrete element model, and the average grayscale value of the grayscale threshold range corresponding to the various components is calculated according to the number of hits of the spherical particles.
[0065] Specifically, after projecting each pixel in the image data into the discrete element model through spatial mapping, spheres are matched based on spatial proximity. Each coordinate point of each pixel is associated with the nearest sphere. When a sphere particle matches a pixel, the gray value of the pixel is matched into the sphere, and the number of matching times of the sphere is recorded. The average gray value of each sphere is recorded by gray value accumulation and counting.
[0066] S5. Based on the grayscale threshold range corresponding to various components, the spherical particles in the discrete model are grouped to establish a rock component analysis model.
[0067] Specifically, in this embodiment, based on the grayscale threshold range obtained by the aforementioned reverse calculation, spheres in different grayscale ranges are divided into corresponding mineral category groups and labeled and grouped. The physical parameters of the rock components are matched according to the rock component data, thereby assigning different contact models, friction coefficients, fracture strengths and other physical property parameters to different sphere particles, thereby establishing a rock component analysis model.
[0068] For example, this embodiment, combined with Python code, provides a detailed description of the specific implementation of the rock image grayscale value extraction and coordinate mapping process in this invention:
[0069] Import the image processing library OpenCV (cv2), the scientific computing library NumPy (np), and the data structure library Pandas (pd) to provide a foundation for subsequent image reading, matrix operations, and data export;
[0070] The cv2.imread() function reads a granite image named granite.jpg, specifies that it is imported in grayscale mode, and converts it into a single-channel grayscale image.
[0071] Obtain the height and width of the image for subsequent coordinate system construction;
[0072] Define the actual range of the image mapping in physical space, where the X-axis range is ±0.025 and the Y-axis range is ±0.5. The unit length can be adjusted according to the actual modeling size.
[0073] Generate corresponding coordinate points in the X and Y directions according to the number of image pixels, so that each pixel of the image has corresponding coordinates in two-dimensional space;
[0074] Use np.meshgrid() to construct the X and Y coordinate matrices, and at the same time convert the image gray values into a floating-point Z matrix to represent the gray intensity;
[0075] The three-dimensional data (X, Y, grayscale Z) is unfolded into one dimension and constructed into a structured DataFrame format;
[0076] Export the processed data to an Excel file, which will then be used as input for importing into the PFC software. The final output format is three columns (X, Y, grayscale), with each row representing the physical location and grayscale value of a pixel in the modeling space.
[0077] In the PFC modeling environment, the spatial extent of the modeling domain and particle parameters are first defined. The model geometry is set using the following FISH script, which defines the upper and lower limits of the particle radius and the target porosity.
[0078] Set a random seed and generate the model boundary wall, while distributing spherical particles within a specified box area according to the target porosity and particle radius range;
[0079] All spheres are assigned density and damping coefficients, and the material constitutive relations are initialized as a linear contact model, with Young's modulus and the ratio of normal to tangential stiffness set.
[0080] The system is initially relaxed by a short cycle (calm), then the density scaling method is used to reduce the time step to accelerate convergence, and finally the equilibrium state is sought by solve aratio 1e-4.
[0081] To ensure good contact between subsequent particles, a function is called to perform micro-magnification processing on "suspended particles" with a contact number of less than 3;
[0082] In the PFC software, the contents of the above file are read, and the grayscale values are spatially matched and accumulated.
[0083] Extract the X and Y coordinates and grayscale values of each line from the file, and call the ball.near() function to search for the nearest sphere near the coordinate position;
[0084] If the search is successful, initialize the grayscale and counting slots, and add the grayscale value to ball.extra(1), and record the cumulative count in ball.extra(2);
[0085] For all spheres, calculate their average gray value and save it to ball.extra(3);
[0086] Using the dynamic grayscale threshold obtained in step two based on the XRD components and image CDF, the average grayscale values are classified. Spheres are automatically grouped according to the range to which their grayscale values belong.
[0087] Those with an average gray level in the first range (e.g., 0 to A) are grouped as "Mica";
[0088] Those with an average gray level in the second interval (e.g., A to B) are grouped as "Quartz";
[0089] Those with an average gray level in the third interval (e.g., B~255) are grouped as "Feldspar";
[0090] Call the ball.group() function to add group labels to each particle, establishing the spatial distribution identifier of mineral components in the model;
[0091] Subsequently, different contact models, friction coefficients, fracture strengths and other physical property parameters can be assigned to different particles based on the grouping information to simulate the rock mechanical response behavior under different mineral compositions, including crack propagation, stress concentration and fracture process;
[0092] Secondly, embodiments of this application provide a computer-readable storage medium, which is a non-volatile or non-transient storage medium, storing a computer program thereon. When the computer program is run by a processor, it executes the steps of the modeling method for the rock composition analysis model based on image recognition described above.
[0093] Thirdly, embodiments of this application provide a computer program product, including a computer program / instruction, wherein when the computer program / instruction is executed by a processor, it implements the steps of the modeling method for the image recognition-based rock composition analysis model described above.
[0094] Fourthly, embodiments of this application provide an image recognition-based rock composition analysis model, including a memory and a processor. The memory stores a computer program that can run on the processor. When the processor runs the computer program, it executes the steps of the image recognition-based rock composition analysis model model described above.
[0095] It should be noted that this application is not limited to the above-described embodiments. The above embodiments are merely examples, and any embodiments with the same structure and effect as the technical concept within the scope of this application are included in the technical scope of this application. Furthermore, various modifications that can be conceived by those skilled in the art to the embodiments, and other ways of constructing by combining some of the constituent elements of the embodiments, without departing from the spirit of this application, are also included in the scope of this application.
Claims
1. A modeling method for rock composition analysis based on image recognition, characterized in that, Includes the following steps: Acquire image data of the rock and rock composition data of the rock; The image data is converted to grayscale to obtain the grayscale data corresponding to each pixel in the image data; Based on the rock composition data and the grayscale data corresponding to each pixel, the grayscale threshold ranges corresponding to various components in the rock are derived. A discrete element model is established, and the grayscale data corresponding to each pixel is associated with the spherical particles in the discrete element model; Based on the gray-level threshold ranges corresponding to various components, the spherical particles in the discrete element model are grouped to establish a rock composition analysis model. The step of associating the grayscale data corresponding to each pixel with the spherical particles in the discrete element model includes: Each pixel in the image data is projected into the discrete element model through spatial mapping. The grayscale data of each pixel is accumulated into the spherical particle in the discrete element model based on the neighborhood search algorithm, and the average grayscale value of the spherical particle is calculated based on the number of hits of the spherical particle. The average gray value is used to match the gray value threshold range corresponding to various components of the spherical particles.
2. The modeling method for rock composition analysis based on image recognition according to claim 1, characterized in that, The rock composition data includes the rock components and their proportions, which are obtained based on X-ray diffraction experiments.
3. The modeling method for rock composition analysis based on image recognition according to claim 1, characterized in that, The step of deriving the grayscale threshold ranges corresponding to various components in the rock based on the rock component data and the grayscale data corresponding to each pixel includes: constructing a histogram based on the grayscale data corresponding to each pixel, and calculating the cumulative distribution function by accumulating each item; The cumulative distribution function is normalized and matched with rock component data to derive the grayscale threshold ranges corresponding to various components in the rock.
4. The modeling method for rock composition analysis based on image recognition according to claim 1, characterized in that, The step of projecting each pixel in the image data into the discrete element model through spatial mapping includes: constructing a coordinate system for the image data, converting the position of each pixel in the image data into coordinates in the coordinate system, and combining the coordinates of each pixel and the corresponding grayscale data to form a triplet data (X, Y, grayscale). Align the coordinate system with the discrete element model, and map the triplet data into the discrete element model.
5. The modeling method for rock composition analysis based on image recognition according to claim 1, characterized in that, The establishment of the rock composition analysis model includes: matching the physical parameters of the rock composition based on the rock composition data; and establishing the rock composition analysis model based on the grouping of the spherical particles in the discrete element model.
6. The modeling method for rock composition analysis based on image recognition according to claim 1, characterized in that, Image data of the rocks is acquired using a camera.
7. A computer-readable storage medium, wherein the computer-readable storage medium is a non-volatile storage medium or a non-transient storage medium, and a computer program is stored thereon, characterized in that, When the computer program is run by the processor, it executes the steps of the modeling method for the rock composition analysis model based on image recognition as described in any one of claims 1 to 6.
8. A computer program product comprising a computer program / instructions, characterized in that, When the computer program / instructions are executed by the processor, they implement the steps of the modeling method for the rock composition analysis model based on image recognition as described in any one of claims 1 to 6.
9. A rock composition analysis model based on image recognition, comprising a memory and a processor, wherein the memory stores a computer program executable on the processor, characterized in that, When the processor runs the computer program, it performs the steps of the modeling method for rock composition analysis model based on image recognition as described in any one of claims 1 to 6.
Citation Information
Patent Citations
Building method of discrete element module of true aggregate particles based on X-ray CT image
CN104599321A
Mineral recognition technology-based lozenge surface rock modeling method and system
CN115618700A