Method and system for detecting grain size in metaldehyde crystallization process based on image recognition
By extracting the α color channel and structural tensor in the CIELab color space to determine the dominant texture direction, and combining local entropy segmentation and asymmetric adjustment factor calculation, the problem of real-time accuracy of grain size detection during the crystallization process of metaldehyde was solved, and stable online grain size detection was achieved.
Patent Information
- Application Number
- CN202511583682.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-10-31
- Publication Date
- 2026-01-27
AI Technical Summary
Existing technologies cannot detect the grain size of metaldehyde in real time and accurately. Traditional methods have biases and cannot meet the dynamic control requirements of industrial production. Existing image recognition technologies have insufficient accuracy in extracting texture features in complex crystal systems, and the detection results are unstable.
By converting the crystallization process image to the CIELab color space, the dominant texture direction is determined using the α color channel components and the structural tensor. A weighted fusion gray-level co-occurrence matrix is then performed, and the second-order similarity is calculated and corrected by combining local entropy segmentation and asymmetric adjustment factors to form a grain size composite representation parameter.
It enables precise online detection of the metaldehyde crystallization process, reduces interference from changes in illumination, improves the accuracy of texture feature extraction and the stability of detection results, and provides comprehensive and reliable grain size information.
Smart Images

Figure CN121414701A_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of image processing technology, specifically relating to a method and system for detecting the grain size of metaldehyde crystallization process based on image recognition. Background Technology
[0002] As an important chemical product with both pesticide and fuel properties, the grain size (average size of crystal particles) of metaldehyde has a decisive influence on its physicochemical properties, directly affecting its stability, solubility, and efficacy in practical applications. Therefore, it has become a core indicator for evaluating the quality of metaldehyde products. In industrial production, real-time monitoring and precise control of the grain size during the metaldehyde crystallization process are crucial for ensuring batch-to-batch consistency and improving production efficiency.
[0003] Traditional methods for grain size detection include sieving and offline measurement with laser particle size analyzers. While these methods can achieve high-precision detection in a laboratory environment, they have significant limitations: these methods require sampling from the crystallization system for offline analysis. Not only can they not provide real-time feedback on grain size changes during the crystallization process, but the sampling process may also damage the original state of the crystal, leading to deviations between the test results and the actual working conditions. This makes it difficult to meet the needs of industrial production for dynamic control of the crystallization process.
[0004] To overcome the bottleneck of offline detection, online detection technology based on image recognition has gradually become a research hotspot. This technology acquires real-time images of the crystallization process and uses image processing algorithms to extract feature parameters related to grain size, such as crystal area and texture features, to achieve non-contact, real-time grain size monitoring. Among these methods, the Gray-Level Co-occurrence Matrix (GLCM) method based on texture analysis is the most widely used. GLCM quantifies image texture features by statistically analyzing the distribution patterns of pixels at different gray levels in an image at specific directions and distances, and then correlates these features with grain size information.
[0005] However, the complexity of the metaldehyde crystallization system presents multiple challenges to existing image recognition technologies. During the growth process, metaldehyde crystals are affected by process parameters such as temperature, concentration, and stirring rate, resulting in diverse crystal alignment directions and complex anisotropic textures. Traditional GLCM methods typically calculate texture features only in 1-4 fixed directions or perform simple averaging of multi-directional features, failing to capture the dominant texture direction in the crystallization system. This leads to insufficient texture feature extraction accuracy and difficulty in accurately reflecting crystallite size differences. Furthermore, in the later stages of crystallization, the increased crystal concentration causes crystals to overlap and adhere, blurring the boundary between the crystal region and the mother liquor background in the image. Existing segmentation algorithms struggle to effectively distinguish overlapping crystals from the background, resulting in incomplete crystal region extraction and directly affecting the accuracy of subsequent crystallite size feature parameter calculations. Moreover, existing technologies relying solely on single parameters such as texture features or crystal area ratio often fail to reflect the true crystallite size state and are easily affected by factors such as illumination changes and image noise, impacting the reliability of the detection results. Summary of the Invention
[0006] Therefore, the purpose of this invention is to propose a method and system for detecting the grain size of metaldehyde crystallization process based on image recognition, so as to solve the technical problem of low detection accuracy of existing detection methods.
[0007] To address the above problems, the technical solution of the image recognition-based method for detecting the grain size of metaldehyde crystallization is as follows: A method for detecting grain size in the metaldehyde crystallization process based on image recognition includes the following steps: Acquire real-time images of the metaldehyde crystallization process, convert the real-time images from the RGB color space to the CIELab color space, and extract the a color channel component as a reference image; calculate the structure tensor of the reference image to determine the dominant texture direction set, and calculate a gray-level co-occurrence matrix based on each direction in the dominant texture direction set; The multiple gray-level co-occurrence matrices corresponding to the dominant texture direction set are weighted and fused to obtain a fused gray-level co-occurrence matrix. The weight coefficient of each direction in the fused gray-level co-occurrence matrix is determined by the proportion of the gradient energy of that direction to the total gradient energy of all dominant directions. The local entropy of each pixel in the reference image is calculated to form a local entropy image. A threshold segmentation method is applied to the local entropy image to segment it into a high-entropy crystallization region and a low-entropy background region. A corrected second-order similarity is calculated using the fused gray-level co-occurrence matrix, which is obtained by summing the computational terms of all gray-level pairs. The area ratio of the high-entropy crystalline region to the total area of the reference image is statistically analyzed, and the corrected second-order similarity is weighted and summed with the area ratio to obtain a grain size composite representation parameter; the grain size of the current metaldehyde is determined according to the grain size composite representation parameter and the preset calibration relationship.
[0008] Furthermore, the method for determining the dominant texture direction set includes: For each pixel in the reference image, a neighborhood window of fixed size is used to calculate the value of that pixel in the reference image. direction and Gradient of direction; Constructing from pixels The square of the directional gradient, the pixel in The square of the directional gradient and the pixel in direction and The structure tensor matrix is composed of the product of the directional gradients, and the structure tensor matrix is decomposed into eigenvalues. The eigenvector direction corresponding to the larger eigenvalue is taken as the local texture direction of the pixel. The local texture orientations of all pixels are counted, and an orientation histogram containing 36 partitions is generated. The directions corresponding to the four partitions with the highest count values in the direction histogram are selected as the dominant texture direction set.
[0009] Furthermore, the method for obtaining the fused gray-level co-occurrence matrix includes: For each dominant texture direction, its gradient energy is calculated. The gradient energy is obtained by accumulating the gradient magnitudes of all pixels whose angle with the dominant texture direction is less than a set angle threshold. Calculate the proportion of the gradient energy of each dominant texture direction to the sum of the gradient energies of all dominant directions to obtain the weight coefficient of that dominant texture direction; Multiply the gray-level co-occurrence matrix of each dominant texture direction by the weight coefficient corresponding to that gray-level co-occurrence matrix, and sum the corresponding elements in all weighted gray-level co-occurrence matrices to obtain the fused gray-level co-occurrence matrix.
[0010] Furthermore, the method for obtaining the local entropy image includes: Set a sliding window of a specific initial size and iterate through every pixel in the baseline image; For the set of pixels covered by the sliding window, statistical analysis of the pixel grayscale histogram is performed, and the probability of each grayscale level occurring is calculated. Calculate the local entropy of the center pixel of the sliding window according to the formula for calculating information entropy; The calculated local entropy value is assigned to the corresponding pixel in the new image to form a complete local entropy image.
[0011] Furthermore, the process of applying a threshold segmentation method to the local entropy image includes: Set a second local threshold window of a specific size, and use the Sauvola threshold segmentation algorithm to calculate the mean entropy and standard deviation of each pixel in the local entropy image within the local threshold window. The segmentation threshold of the pixel is calculated using a preset formula based on the mean entropy and the standard deviation of entropy. If the local entropy value of the pixel is greater than the segmentation threshold, the pixel at the corresponding position in the reference image is marked as a high-entropy crystalline region, and vice versa, it is marked as a low-entropy background region.
[0012] Furthermore, grayscale pairs are defined as The calculation term for gray level pairs is ,in, To merge the elements of the gray-level co-occurrence matrix, It is an asymmetric adjustment factor; the value of the asymmetric adjustment factor is determined by a linear function of the difference in average gray value between the high-entropy crystallization region and the low-entropy background region.
[0013] Furthermore, the method for obtaining the grain size composite representation parameter includes: The corrected second-order similarity is multiplied by a preset first weight coefficient to obtain a first product; the area ratio of the high-entropy crystallization region to the total area of the reference image is multiplied by a preset second weight coefficient to obtain a second product; the sum of the first weight coefficient and the second weight coefficient is 1. Adding the first product to the second product yields the grain size composite representation parameter.
[0014] Furthermore, the calibration relationship is preset through the following steps: During the experimental phase, images were acquired at different crystallization times and a series of composite grain size representation parameters were calculated; at the same time, samples of the corresponding slurry were taken and the average grain size was measured. Multiple sets of composite characterization parameter values and their corresponding average grain size values are used as datasets. A multinomial regression method is used to fit the functional relationship between the two, which is then used as the preset calibration relationship.
[0015] Furthermore, real-time images of the metaldehyde crystallization process are periodically acquired by a camera installed on the observation window of the crystallization vessel; the process of converting the real-time images from the RGB color space to the CIELab color space includes: first converting the RGB values of the real-time images to XYZ values, and then converting the XYZ values to CIELab values.
[0016] The technical solution of the image recognition-based crystallization process grain size detection system for metaldehyde provided by this invention is as follows: The image recognition-based metaldehyde crystallization process grain size detection system is characterized by comprising a processor and a memory, wherein the memory stores a computer program, and when the computer program is run by the processor, it implements the image recognition-based metaldehyde crystallization process grain size detection method described in any of the above technical solutions.
[0017] The beneficial effects of this invention are as follows: Compared with existing technologies, this invention reduces the interference of illumination changes on the detection results by converting real-time images of the metaldehyde crystallization process to the CIELab color space and utilizing the α color channel component. Based on this, the invention uses the structure tensor to determine the dominant texture direction of the crystal image and performs weighted fusion of the gray-level co-occurrence matrix according to the gradient energy of each direction, enabling the detection of anisotropic texture information of the crystal and improving the accuracy of feature extraction. Furthermore, this invention proposes a modified second-order similarity calculation method, where the asymmetric adjustment factor is set according to the gray-level difference between the crystallized region and the background region in the image, making the texture description more targeted. By weighting and combining this modified texture feature with the area ratio of the crystallized region obtained based on local entropy segmentation, a grain size composite representation parameter is formed. This parameter integrates both texture details and macroscopic morphology information, making the grain size detection results more comprehensive, stable, and reliable. Attached Figure Description
[0018] Figure 1 This is a flowchart of the steps of the image recognition-based method for detecting the crystal size of metaldehyde during crystallization according to the present invention. Figure 2 This is a structural framework diagram of the image recognition-based metaldehyde crystallization process grain size detection system of the present invention. Detailed Implementation
[0019] The technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present invention.
[0020] Specific embodiments of the image recognition-based method for detecting crystallite size during the crystallization process of metaldehyde according to the present invention: S1, acquire a real-time image of the metaldehyde crystallization process, convert the real-time image from the RGB color space to the CIELab color space, and extract the a color channel component as a reference image; calculate the structure tensor of the reference image to determine the dominant texture direction set, and calculate a gray-level co-occurrence matrix based on each direction in the dominant texture direction set.
[0021] Specifically, this step involves periodically acquiring color images of the crystallization process at a resolution of 1920×1080 pixels using a camera installed on the observation window of the crystallizer. Using a standardized color space conversion formula, the RGB values of the real-time images are first converted to XYZ values, and then the XYZ values are converted to CIELab values. Since the a color channel component represents the range from green to red, is sensitive to color differences between the crystals and the mother liquor, and is less sensitive to changes in illumination compared to the L color channel component, the grayscale image of the a color channel component is extracted as the reference image for subsequent processing.
[0022] Methods for determining the dominant texture orientation set include: For each pixel in the reference image, a 5×5 neighborhood window is used to calculate the value of that pixel in the reference image. gradient of direction and in gradient of direction ; Constructing from pixels The square of the directional gradient, the pixel in The square of the directional gradient and the pixel in direction and The structure tensor matrix M, formed by the product of directional gradients, is expressed as follows: Perform eigenvalue decomposition on the structure tensor matrix M, and take the eigenvector direction corresponding to the larger eigenvalue as the local texture direction of the pixel. The local texture orientations of all pixels are counted, and an orientation histogram containing 36 partitions is generated. The directions corresponding to the four partitions with the highest count values in the direction histogram are selected as the dominant texture direction set.
[0023] For example, for a pixel in the reference image located at coordinates (100, 150), consider the 5×5 pixel neighborhood surrounding that pixel. Apply the Sobel operator to calculate the value of this pixel neighborhood. gradient of direction It is 30, in gradient of direction The value is -15. A structure tensor matrix is constructed based on the gradients of all points in the neighborhood of this pixel. Eigenvalue decomposition is performed on the constructed structure tensor matrix to obtain two eigenvalues and their corresponding eigenvectors. The eigenvector corresponding to the larger eigenvalue is (0.866, 0.5). The direction of this eigenvector, calculated as 20° using the arctangent function, is determined as the local texture direction of the pixel at coordinates (100, 150). This process is repeated for each pixel in the baseline image to obtain the local texture direction distribution of the entire image. The local texture directions of all pixels are counted in a direction histogram from 0° to 360°, which is divided into 36 intervals. Statistical results show that the four intervals with the highest count values are 20° to 29°, 80° to 89°, 110° to 119°, and 170° to 179°. Their respective center directions, 25°, 85°, 115°, and 175°, are selected to form the dominant texture direction set.
[0024] S2, perform weighted fusion of multiple gray-level co-occurrence matrices corresponding to the dominant texture direction set to obtain a fused gray-level co-occurrence matrix. The weight coefficient of each direction in the fused gray-level co-occurrence matrix is determined by the proportion of the gradient energy of that direction to the sum of the gradient energies of all dominant directions. Calculate the local entropy of each pixel in the reference image to form a local entropy image. Apply a threshold segmentation method to the local entropy image to segment it into a high-entropy crystallization region and a low-entropy background region.
[0025] For any of the dominant texture directions determined in the previous step, calculate the projected gradient of the reference image in that direction, and sum the squares of the projected gradient magnitudes of all pixels in the entire image to obtain the total gradient energy in that direction. Add the total gradient energies of all dominant texture directions to obtain the sum of gradient energies. Divide the gradient energy of each dominant texture direction by the sum of gradient energies to obtain the weight coefficient corresponding to that dominant texture direction. Multiply the corresponding elements of all gray-level co-occurrence matrices by the weight coefficients and then sum them to obtain the fused gray-level co-occurrence matrix reflecting the anisotropic texture characteristics of the crystal.
[0026] Centered on each pixel in the reference image, a neighborhood window of a specific size is selected. The probability distribution of pixel grayscale values within this window is calculated, and the local entropy value of the central pixel is calculated using the Shannon entropy formula. This process is repeated for all pixels to generate a local entropy image of the same size as the reference image. Because the crystalline region has complex texture and a high local entropy value, while the mother liquor background region is relatively uniform and has a low local entropy value, the Otsu method is applied to the local entropy image to determine an optimal segmentation threshold. This binarizes the local entropy image, thus segmenting the reference image into a high-entropy crystalline region representing the crystalline portion and a low-entropy background region representing the mother liquor portion.
[0027] In an optional embodiment, the method for obtaining the fused gray-level co-occurrence matrix is as follows: For each dominant texture direction, its gradient energy is calculated. This gradient energy is obtained by accumulating the gradient magnitudes of all pixels whose local texture directions have an angle of less than 5° with the dominant texture direction. Calculate the proportion of the gradient energy of each dominant texture direction to the sum of the gradient energies of all dominant directions to obtain the weight coefficient of that dominant texture direction; Multiply the gray-level co-occurrence matrix of each dominant texture direction by the weight coefficient corresponding to that gray-level co-occurrence matrix, and sum the corresponding elements in all weighted gray-level co-occurrence matrices to obtain the fused gray-level co-occurrence matrix.
[0028] In an optional embodiment, the process of calculating the local entropy of each pixel in the reference image to form a local entropy image includes: Set a 9×9 pixel sliding window and iterate through every pixel in the baseline image; For the 81 pixels covered by the sliding window, the pixel gray-level histogram is plotted, and the probability of each gray level occurring is calculated. ; According to the formula Calculate the local entropy of the center pixel of the window ; The calculated local entropy value is assigned to the corresponding pixel in the new image to form a complete local entropy image.
[0029] In an optional embodiment, the process of applying a threshold segmentation method to the local entropy image includes: The window size for calculating the local threshold is set to 25×25 pixels. The Sauvola threshold segmentation algorithm is used. For each pixel in the local entropy image, the mean entropy m and the standard deviation of entropy s in the 25×25 pixel neighborhood of that pixel are calculated. Use formula Calculate the segmentation threshold of the pixel. ; If the local entropy value of a pixel is greater than the segmentation threshold If the pixel at the corresponding position in the reference image is high-entropy crystallization region, then it will be marked as a low-entropy background region.
[0030] S3, calculate a modified second-order similarity using the fused gray-level co-occurrence matrix, the second-order similarity being obtained by summing the computational terms of all gray-level pairs.
[0031] Define gray level pairs as The calculation term for gray level pairs is ,in, To merge the elements of the gray-level co-occurrence matrix, It is an asymmetric regulating factor.
[0032] This step utilizes the binary masks of the high-entropy crystalline region and the low-entropy background region obtained from the previous segmentation to calculate the average gray values of these two regions in the reference image, and then calculates the absolute value of the difference between the two average gray values, denoted as the gray difference D; asymmetric adjustment factor Through a pre-defined linear function =0.1×D+0.5 is used to determine that this linear function results in a higher contrast between the crystal and the background. The larger the value, the greater the penalty is imposed on pixel pairs with large grayscale differences when calculating similarity. The calculated value... Substitute the values into the modified second-order similarity formula, and utilize the elements of the fused gray-level co-occurrence matrix. Perform a summation operation to obtain the texture feature values.
[0033] S4, calculate the area ratio of the high-entropy crystallization region to the total area of the reference image, and perform a weighted summation of the corrected second-order similarity and the area ratio to obtain a grain size composite representation parameter; determine the current grain size of metaldehyde based on the grain size composite representation parameter and the preset calibration relationship.
[0034] Specifically, the area ratio of the high-entropy crystalline region is obtained by counting the number of pixels with a value of 1 in the binary mask of the high-entropy crystalline region and then dividing it by the total number of pixels in the reference image. Weighting coefficients for the corrected second-order similarity and the area ratio are set. The corrected second-order similarity value is multiplied by its weighting coefficient, and the area ratio value is multiplied by its weighting coefficient to obtain a composite grain size representation parameter that comprehensively reflects both the details and macroscopic distribution information of the crystal texture.
[0035] During the experimental phase, images were acquired at different crystallization times, and a series of composite grain size representation parameters were calculated. Simultaneously, samples of the corresponding slurry were taken, and the average grain size was measured using standard methods such as a laser grain size analyzer. Multiple sets of composite characterization parameter values and their corresponding average grain size values were used as datasets, and a polynomial regression method was employed to fit the functional relationship between them, i.e., q... ,in, This is a composite parameter, where q is the average grain size. , , These are the coefficients obtained from the fitting; this functional relationship is the preset calibration relationship. In actual online detection, the real-time calculated crystal size composite representation parameters are substituted into this function to solve for the current metaldehyde crystal size.
[0036] In an optional embodiment, the method for obtaining the grain size composite representation parameter includes: The corrected second-order similarity is multiplied by a preset first weight coefficient to obtain a first product; the area ratio of the high-entropy crystallization region to the total area of the reference image is multiplied by a preset second weight coefficient to obtain a second product; the sum of the first weight coefficient and the second weight coefficient is 1. Adding the first product to the second product yields the grain size composite representation parameter. This parameter integrates information from both texture similarity and the proportion of crystalline regions, and is used to evaluate the grain size of the material.
[0037] This patent converts real-time images to the CIELab color space and extracts the α color channel components. Based on the structural tensor, it determines the dominant texture direction and weights and fuses the gray-level co-occurrence matrix. Combining local entropy segmentation and asymmetric adjustment factors, it calculates and corrects the second-order similarity. Finally, it weights the corrected texture features with the area ratio of the crystalline region to obtain the composite representation parameters of the grain size. This effectively reduces the interference of illumination changes, improves the accuracy of anisotropic texture feature extraction of crystals, and makes the grain size detection results more comprehensive, stable, and reliable, achieving accurate online detection of the grain size during the metaldehyde crystallization process.
[0038] Specific embodiments of the image recognition-based metaldehyde crystallization process grain size detection system provided by this invention: like Figure 2 As shown, the image recognition-based metaldehyde crystallization process grain size detection system includes a processor and a memory. The memory stores a computer program. When the computer program is run by the processor, it can realize the image recognition-based metaldehyde crystallization process grain size detection method according to the above embodiments.
[0039] The image recognition-based metaldehyde crystallization process grain size detection system also includes other components well known to those skilled in the art, such as communication buses and communication interfaces. Their settings and functions are known in the art and will not be described in detail here.
[0040] In this invention, the aforementioned memory can be any tangible medium containing or storing a program that can be used or combined with an instruction execution system, apparatus, or device. For example, a computer-readable storage medium can be any suitable magnetic or magneto-optical storage medium, such as Resistive Random Access Memory (RRAM), Dynamic Random Access Memory (DRAM), Static Random Access Memory (SRAM), Enhanced Dynamic Random Access Memory (EDRAM), High-Bandwidth Memory (HBM), Hybrid Memory Cube (HMC), etc., or any other medium that can be used to store desired information and can be accessed by an application, module, or both. Any such computer storage medium can be part of a device or accessible to or connected to a device. Any application or module described in this invention can be implemented by computer-readable / executable instructions stored or otherwise maintained on such a computer-readable medium.
[0041] While various embodiments of the invention have been shown and described in this specification, it will be apparent to those skilled in the art that such embodiments are provided by way of example only. Many modifications, alterations, and alternatives will occur to those skilled in the art without departing from the spirit and essence of the invention.
Claims
1. A method for detecting grain size in the crystallization process of metaldehyde based on image recognition, characterized in that, Includes the following steps: Acquire real-time images of the metaldehyde crystallization process, convert the real-time images from the RGB color space to the CIELab color space, and extract the a color channel component as a reference image; The structure tensor of the reference image is calculated to determine the dominant texture direction set, and a gray-level co-occurrence matrix is calculated based on each direction in the dominant texture direction set; The multiple gray-level co-occurrence matrices corresponding to the dominant texture direction set are weighted and fused to obtain a fused gray-level co-occurrence matrix. The weight coefficient of each direction in the fused gray-level co-occurrence matrix is determined by the proportion of the gradient energy of that direction to the total gradient energy of all dominant directions. The local entropy of each pixel in the reference image is calculated to form a local entropy image. A threshold segmentation method is applied to the local entropy image to segment it into a high-entropy crystallization region and a low-entropy background region. A corrected second-order similarity is calculated using the fused gray-level co-occurrence matrix, which is obtained by summing the computational terms of all gray-level pairs. The area ratio of the high-entropy crystalline region to the total area of the reference image is statistically analyzed, and the corrected second-order similarity is weighted and summed with the area ratio to obtain a grain size composite representation parameter; the grain size of the current metaldehyde is determined according to the grain size composite representation parameter and the preset calibration relationship.
2. The method for detecting crystallite size in the tetraacetaldehyde crystallization process based on image recognition according to claim 1, characterized in that, The method for determining the dominant texture direction set includes: For each pixel in the reference image, a neighborhood window of fixed size is used to calculate the value of that pixel in the reference image. direction and Gradient of direction; Constructing from pixels The square of the directional gradient, the pixel in The square of the directional gradient and the pixel in direction and The structure tensor matrix is composed of the product of the directional gradients, and the structure tensor matrix is decomposed into eigenvalues. The eigenvector direction corresponding to the larger eigenvalue is taken as the local texture direction of the pixel. The local texture orientations of all pixels are counted, and an orientation histogram containing 36 partitions is generated. The directions corresponding to the four partitions with the highest count values in the direction histogram are selected as the dominant texture direction set.
3. The method for detecting crystallite size in the tetraacetaldehyde crystallization process based on image recognition according to claim 2, characterized in that, The method for obtaining the fused gray-level co-occurrence matrix includes: For each dominant texture direction, its gradient energy is calculated. The gradient energy is obtained by accumulating the gradient magnitudes of all pixels whose angle with the dominant texture direction is less than a set angle threshold. Calculate the proportion of the gradient energy of each dominant texture direction to the sum of the gradient energies of all dominant directions to obtain the weight coefficient of that dominant texture direction; Multiply the gray-level co-occurrence matrix of each dominant texture direction by the weight coefficient corresponding to that gray-level co-occurrence matrix, and sum the corresponding elements in all weighted gray-level co-occurrence matrices to obtain the fused gray-level co-occurrence matrix.
4. The method for detecting grain size in the metaldehyde crystallization process based on image recognition according to claim 1, characterized in that, The method for obtaining the local entropy image includes: Set a sliding window of a specific initial size and iterate through every pixel in the baseline image; For the set of pixels covered by the sliding window, statistical analysis of the pixel grayscale histogram is performed, and the probability of each grayscale level occurring is calculated. Calculate the local entropy of the center pixel of the sliding window according to the formula for calculating information entropy; The calculated local entropy value is assigned to the corresponding pixel in the new image to form a complete local entropy image.
5. The method for detecting grain size in the tetraacetaldehyde crystallization process based on image recognition according to claim 4, characterized in that, The process of applying a threshold segmentation method to the local entropy image includes: Set a second local threshold window of a specific size, and use the Sauvola threshold segmentation algorithm to calculate the mean entropy and standard deviation of each pixel in the local entropy image within the local threshold window. The segmentation threshold of the pixel is calculated using a preset formula based on the mean entropy and the standard deviation of entropy. If the local entropy value of the pixel is greater than the segmentation threshold, the pixel at the corresponding position in the reference image is marked as a high-entropy crystalline region, and vice versa, it is marked as a low-entropy background region.
6. The method for detecting grain size in the metaldehyde crystallization process based on image recognition according to claim 1, characterized in that, Define gray level pairs as The calculation term for gray level pairs is ,in, To merge the elements of the gray-level co-occurrence matrix, It is an asymmetric adjustment factor; the value of the asymmetric adjustment factor is determined by a linear function of the difference in average gray value between the high-entropy crystallization region and the low-entropy background region.
7. The method for detecting grain size in the metaldehyde crystallization process based on image recognition according to claim 1, characterized in that, The method for obtaining the grain size composite representation parameter includes: The corrected second-order similarity is multiplied by a preset first weight coefficient to obtain a first product; the area ratio of the high-entropy crystallization region to the total area of the reference image is multiplied by a preset second weight coefficient to obtain a second product; the sum of the first weight coefficient and the second weight coefficient is 1. Adding the first product to the second product yields the grain size composite representation parameter.
8. The method for detecting grain size in the metaldehyde crystallization process based on image recognition according to claim 1, characterized in that, The calibration relationship is preset through the following steps: During the experimental phase, images were acquired at different crystallization times and a series of composite grain size representation parameters were calculated; at the same time, samples of the corresponding slurry were taken and the average grain size was measured. Multiple sets of composite characterization parameter values and their corresponding average grain size values are used as datasets. A multinomial regression method is used to fit the functional relationship between the two, which is then used as the preset calibration relationship.
9. The method for detecting grain size in the metaldehyde crystallization process based on image recognition according to claim 1, characterized in that, Real-time images of the metaldehyde crystallization process are collected periodically by a camera installed on the observation window of the crystallizer. The process of converting a real-time image from the RGB color space to the CIELab color space includes: first converting the RGB values of the real-time image to XYZ values, and then converting the XYZ values to CIELab values.
10. A grain size detection system for the metaldehyde crystallization process based on image recognition, characterized in that, It includes a processor and a memory, the memory storing a computer program, which, when run by the processor, implements the image recognition-based method for detecting the crystal size of the tetraacetaldehyde crystallization process as described in any one of claims 1-9.