Visual inspection method for mixing uniformity of production raw materials of water-soluble fertilizer

By combining grayscale hierarchical clustering and texture hierarchical clustering, the detection of mixing uniformity of raw materials for water-soluble fertilizer production is optimized, which solves the problem of insufficient detection accuracy in the existing technology and achieves higher detection accuracy and precision.

CN120635006AActive Publication Date: 2025-09-12AKSU JIABANG FERTILIZER CO LTD
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
CN202510722038.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-05-30
Publication Date
2025-09-12
Estimated Expiration
2045-05-30

AI Technical Summary

Technical Problem

In the existing technology, the detection accuracy of the mixing uniformity of raw materials for water-soluble fertilizer production is low, and it is difficult to adapt to the actual situation through the gray-level co-occurrence matrix, resulting in insufficient detection accuracy.

Method used

A method combining grayscale hierarchical clustering and texture hierarchical clustering is adopted. By obtaining the grayscale image of the mixture image, hierarchical clustering of pixels is performed to determine the grayscale and texture values, and the window size of the grayscale co-occurrence matrix is ​​calculated. The triangulated network structure and the selectivity index of the matching layer pair are combined to optimize the mixture uniformity detection.

Benefits of technology

The accuracy and precision of the mixing uniformity detection of raw materials for water-soluble fertilizer production are improved, and more accurate mixing uniformity detection is achieved through gray-level co-occurrence matrix calculation under the optimal texture scale.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120635006A_ABST
    Figure CN120635006A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of image analysis, in particular to a water-soluble fertilizer production raw material mixing uniformity visual detection method, which comprises the following steps: acquiring a gray level image of a mixture image, and determining a gray level clustering tree and a texture level clustering tree corresponding to the gray level image; analyzing the gray level clustering tree and the texture level clustering tree, determining a target layer of the texture level clustering tree, and determining a window size of a gray level co-occurrence matrix according to texture values of corresponding pixel points of each category in the target layer of the texture level clustering tree in the gray level image; and performing mixing uniformity detection according to the window size of the gray level co-occurrence matrix and the gray level image. According to the method, the window size of the gray-level co-occurrence matrix is determined in a self-adaptive manner, so that the precision of mixing uniformity detection of the water-soluble fertilizer production raw materials is effectively improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of image analysis, and in particular to a method for visually detecting mixing uniformity of raw materials for producing water-soluble fertilizers. Background Art

[0002] Water-soluble fertilizer is a fully water-soluble, multi-component compound fertilizer that effectively promotes crop growth and development. It can be used for foliar spraying, soilless cultivation, and drip irrigation. During the production of water-soluble fertilizer, different types of raw materials must be evenly mixed. Because the degree of raw material mixing directly affects the production quality of water-soluble fertilizer, it is necessary to test the uniformity of raw material mixing during the production process.

[0003] Because most water-soluble fertilizer raw materials are white, it's difficult to verify mixing uniformity by color. Therefore, texture information is often used to detect mixing uniformity. Prior art often uses a gray-level co-occurrence matrix to detect mixing uniformity. However, the window size used to calculate the gray-level co-occurrence matrix is ​​often set based on empirical values, making it difficult to adapt to actual conditions. This results in low uniformity detection accuracy. Summary of the Invention

[0004] The object of the present invention is to provide a method for visually detecting the mixing uniformity of raw materials for producing water-soluble fertilizers, so as to solve the problem of low accuracy in the existing detection of the mixing uniformity of raw materials for producing water-soluble fertilizers.

[0005] To solve the above technical problems, the present invention provides a method for visually detecting the mixing uniformity of raw materials for water-soluble fertilizer production, comprising the following steps:

[0006] Obtaining a grayscale image of the mixture image, performing hierarchical clustering on the grayscale values ​​of pixels in the grayscale image to obtain a grayscale hierarchical clustering tree, and determining texture values ​​of the pixels in the grayscale image, performing hierarchical clustering on the texture values ​​of the pixels in the grayscale image to obtain a texture hierarchical clustering tree;

[0007] The grayscale hierarchical clustering tree and the texture hierarchical clustering tree are both used as a target hierarchical clustering tree, and according to the position of the corresponding pixel point of each category in each layer of the target hierarchical clustering tree in the grayscale image, the uniformity of the position point distribution of each category in each layer of the target hierarchical clustering tree is determined;

[0008] The distribution uniformity of the position points of each category in each layer of the grayscale hierarchical clustering tree is grouped to obtain a plurality of distribution uniformity groups, and according to the number of distribution uniformity groups corresponding to each layer of the grayscale hierarchical clustering tree and the number of each category in each layer of the texture hierarchical clustering tree, each layer of the grayscale hierarchical clustering tree is matched with each layer of the texture hierarchical clustering tree to obtain a plurality of matching layer pairs of the grayscale hierarchical clustering tree and the texture hierarchical clustering tree;

[0009] According to the uniformity of the position point distribution of each category in each layer of each matching layer pair and the position distribution of the corresponding pixel points of each category in the grayscale image, the selectivity index of each matching layer pair is determined, and based on the selectivity index, the target layer of the texture hierarchical clustering tree is determined, and based on the texture values ​​of the corresponding pixel points of each category in the target layer of the texture hierarchical clustering tree in the grayscale image, the window size of the grayscale co-occurrence matrix is ​​determined, and based on the window size of the grayscale co-occurrence matrix and the grayscale image, a mixing uniformity test is performed.

[0010] Furthermore, the uniformity of the distribution of the location points of each category in each layer of the target hierarchical clustering tree is determined, including:

[0011] Determine a triangulated network structure according to the position of the corresponding pixel point of each category in each layer of the target hierarchical clustering tree in the grayscale image, wherein each node in the triangulated network structure corresponds to a position point corresponding to the position of a pixel point;

[0012] Determining a node density sequence of each node in the triangulated network structure according to the position distribution of each node in the triangulated network structure;

[0013] The similarity index of the node density sequence of any two nodes in the triangulated network graph structure is calculated, and the average value of all the similarity indexes is determined as the position point distribution uniformity of each category in each layer of the target hierarchical clustering tree.

[0014] Furthermore, multiple matching layer pairs of the grayscale hierarchical clustering tree and the texture hierarchical clustering tree are obtained, including:

[0015] Each layer of the grayscale hierarchical clustering tree is taken as a left node, and the number of distribution uniformity groups corresponding to each layer of the grayscale hierarchical clustering tree is taken as the node value of the corresponding left node;

[0016] Each layer of the texture hierarchical clustering tree is used as a right node, and the number of categories in each layer of the texture hierarchical clustering tree is used as the node value of the corresponding right node;

[0017] The edge value of the edge connecting any left node and any right node is determined as the ratio of the smaller value to the larger value of the node values ​​of the corresponding two nodes;

[0018] According to the edge value of the connection edge between any left node and any right node, one-to-one matching is performed on all left nodes and right nodes to obtain multiple matching layer pairs of grayscale hierarchical clustering trees and texture hierarchical clustering trees.

[0019] Furthermore, determining the selectivity index of each matching layer pair includes:

[0020] According to the position of the corresponding pixel point of each category in each layer of the target hierarchical clustering tree in the grayscale image, determining the largest convex polygon corresponding to the position point corresponding to the position;

[0021] Determine a first influence weight corresponding to each category in each layer of the target hierarchical clustering tree according to an area ratio of the convex shape corresponding to each category in each layer of the target hierarchical clustering tree in the grayscale image;

[0022] Determine the minimum distance between each convex edge point of the convex polygon corresponding to each category in each layer of the target hierarchical clustering tree and the boundary of the grayscale image, and determine the second influence weight corresponding to each category in each layer of the target hierarchical clustering tree based on the discrete conditions of all the minimum distances;

[0023] Determine the uniformity of the distribution of the position points corresponding to each layer of the target hierarchical clustering tree according to the first influence weight, the second influence weight and the uniformity of the distribution of the position points corresponding to each category in each layer of the target hierarchical clustering tree;

[0024] The distribution uniformity of the position points corresponding to each layer of the grayscale hierarchical clustering tree is used as the grayscale distribution uniformity corresponding to each layer of the grayscale hierarchical clustering tree, and the distribution uniformity of the position points corresponding to each layer of the texture hierarchical clustering tree is used as the texture distribution uniformity corresponding to each layer of the texture hierarchical clustering tree;

[0025] The selectivity index of each matching layer pair is determined according to the grayscale distribution uniformity of the layer corresponding to the grayscale hierarchical clustering tree and the texture distribution uniformity of the layer corresponding to the texture hierarchical clustering tree in each matching layer pair.

[0026] Furthermore, the distribution uniformity of the location points corresponding to each layer of the target hierarchical clustering tree is calculated as follows:

[0027]

[0028] Among them, p represents the uniformity of the distribution of the location points corresponding to each layer of the target hierarchical clustering tree; a i represents the first influence weight corresponding to the i-th category in each layer of the target hierarchical clustering tree; s i represents the second influence weight corresponding to the i-th category in each layer of the target hierarchical clustering tree; ji represents the uniformity of the distribution of the location points corresponding to the i-th category in each layer of the target hierarchical clustering tree; n represents the total number of categories in each layer of the target hierarchical clustering tree; e represents a natural constant.

[0029] Furthermore, the selectivity index of each matching layer pair is determined, and the corresponding calculation formula is:

[0030]

[0031] Among them, P represents the selectivity index of each matching layer pair of the grayscale hierarchical clustering tree and the texture hierarchical clustering tree; p1 represents the grayscale distribution uniformity of the layer corresponding to the grayscale hierarchical clustering tree in each matching layer pair of the grayscale hierarchical clustering tree and the texture hierarchical clustering tree; p2 represents the texture distribution uniformity of the layer corresponding to the texture hierarchical clustering tree in each matching layer pair of the grayscale hierarchical clustering tree and the texture hierarchical clustering tree; P0 represents the distribution uniformity threshold.

[0032] Furthermore, the target layer of the texture hierarchical clustering tree is determined, including:

[0033] The maximum selectivity index among the selectivity indexes of the matching layer pairs is determined, and the layer corresponding to the matching layer pair corresponding to the maximum selectivity index in the texture hierarchical clustering tree is determined as the target layer of the texture hierarchical clustering tree.

[0034] Furthermore, the window size of the gray-level co-occurrence matrix is ​​determined, including:

[0035] Determine the minimum bounding rectangle of the pixel points corresponding to each category in the target layer of the texture hierarchical clustering tree in the grayscale image, perform Fourier transform on the texture values ​​of all pixel points in the minimum bounding rectangle to obtain a spectrum image, and determine the candidate window size of the gray level co-occurrence matrix corresponding to each category in the target layer of the texture hierarchical clustering tree according to the inverse of the frequency corresponding to the point with the maximum gray value in the spectrum image;

[0036] The minimum value among the candidate window sizes of the gray level co-occurrence matrix corresponding to each category in the target layer of the texture hierarchical clustering tree is used as the window size of the gray level co-occurrence matrix.

[0037] Furthermore, a mixing uniformity test is performed, including:

[0038] Determine a regional window for each pixel in the grayscale image with each pixel in the grayscale image as the center and the window size of the grayscale co-occurrence matrix as the window size, and determine the grayscale co-occurrence matrix corresponding to the regional window at a set angle according to the grayscale value of the pixel in the regional window, and determine the energy of the grayscale co-occurrence matrix;

[0039] According to the size and distribution consistency of the energy corresponding to each pixel in the grayscale image, the mixing uniformity index corresponding to the grayscale image is determined. If the mixing uniformity index is less than the mixing uniformity threshold, it is determined that the mixing is not uniform enough; otherwise, it is determined that the mixing is uniform.

[0040] Furthermore, multiple distribution uniformity groups are obtained, including:

[0041] The distribution uniformity of the position points of each category in each layer of the grayscale hierarchical clustering tree is segmented by multiple thresholds to obtain multiple distribution uniformity groups.

[0042] The present invention has the following beneficial effects: by obtaining a grayscale image of a mixture to be detected, hierarchical clustering is performed according to the grayscale values ​​of the pixels in the grayscale image in order to distinguish the mixture in color, and a grayscale hierarchical clustering tree is obtained. In the grayscale hierarchical clustering tree, if all categories in a certain layer are distributed relatively evenly, the grayscale distribution uniformity at this scale is relatively large, that is, the mixing uniformity of different water-soluble fertilizer production raw materials is relatively large. Therefore, in order to determine the mixing uniformity of different water-soluble fertilizer production raw materials, it is necessary to calculate the position point distribution uniformity of each category in each layer of the grayscale hierarchical clustering tree. Taking into account that different components of the mixture may be relatively similar in color, when the grayscale distribution is uniform, there may be large errors in the mixture uniformity detection based on grayscale. On the basis of a layer with similar grayscale, the texture distribution uniformity is also relatively similar. The scale information calculated by this layer is used as the window size of the grayscale co-occurrence matrix to obtain a more accurate and reliable mixing uniformity. Therefore, hierarchical clustering is performed based on the texture values ​​of the pixels in the grayscale image to obtain a texture hierarchical clustering tree. The uniformity of the position point distribution for each category in each layer of the texture hierarchical clustering tree is also determined. Based on this, the possible texture distribution can be inferred based on the categories in each layer of the grayscale hierarchical clustering tree and the uniformity of the position point distribution for each category. Categories with similar uniformity of position point distribution in each layer have a greater probability of forming texture in spatial distribution. If the texture distribution uniformity in similar layers is also large, it indicates that the texture distribution of this layer can better describe the texture features. In this case, the scale corresponding to this layer is used as the size of the gray-level co-occurrence matrix to calculate the texture distribution uniformity, which can obtain a more accurate texture distribution uniformity. Therefore, the position point distribution uniformity of each category in each layer of the grayscale hierarchical clustering tree is grouped. Then, based on the number of distribution uniformity groups in each layer of the grayscale hierarchical clustering tree and the number of categories in each layer of the texture hierarchical clustering tree, layer matching is performed between the grayscale hierarchical clustering tree and the texture hierarchical clustering tree, resulting in multiple matching layer pairs. According to the uniformity of the position point distribution of each category in the matching layer pair in the corresponding layers of the grayscale hierarchical clustering tree and the texture hierarchical clustering tree, the grayscale uniformity and texture uniformity corresponding to the matching layer pair are comprehensively considered to obtain the selectivity index of each matching layer pair. Based on the selectivity index, each matching layer pair is screened to obtain the target layer of the texture hierarchical clustering tree. The texture distribution of the target layer can better describe the texture features. Therefore, according to the texture values ​​of the corresponding pixel points of each category in the target layer in the grayscale image, the optimal window size of the grayscale co-occurrence matrix can be determined, and based on the window size of the optimal grayscale co-occurrence matrix, combined with the grayscale values ​​of the pixel points in the grayscale image, mixed uniformity detection is performed.The present invention obtains the grayscale hierarchical clustering tree and the texture hierarchical clustering tree of the grayscale image of the mixture to be detected, and analyzes the grayscale hierarchical clustering tree and the texture hierarchical clustering tree to obtain the optimal texture scale, that is, the window size of the grayscale co-occurrence matrix. Then, the mixing uniformity is calculated through the grayscale co-occurrence matrix under the optimal texture scale, which greatly improves the detection accuracy and precision of the mixing uniformity. BRIEF DESCRIPTION OF THE DRAWINGS

[0043] In order to more clearly illustrate the technical solutions and advantages of the embodiments of the present invention or the prior art, the following briefly introduces the drawings required for use in the embodiments or the prior art descriptions. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.

[0044] Figure 1 The present invention provides a flow chart of a method for visually inspecting the mixing uniformity of raw materials for producing water-soluble fertilizers. DETAILED DESCRIPTION

[0045] To further illustrate the technical means and effects employed by the present invention to achieve its intended objectives, the following, in conjunction with the accompanying drawings and preferred embodiments, describes in detail the specific implementations, structures, features, and effects of the technical solutions proposed by the present invention. In the following description, references to different "one embodiment" or "another embodiment" do not necessarily refer to the same embodiment. Furthermore, specific features, structures, or characteristics of one or more embodiments may be combined in any suitable manner.

[0046] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by those skilled in the art to which the present invention pertains. In addition, all parameters or indices in the formulas herein are normalized values ​​to eliminate dimension effects.

[0047] In order to solve the problem of low accuracy in detecting the mixing uniformity of raw materials for water-soluble fertilizer production, this embodiment provides a method for visually detecting the mixing uniformity of raw materials for water-soluble fertilizer production. The corresponding process of the method is as follows: Figure 1 As shown, the following steps are included:

[0048] Step S1: Obtain a grayscale image of the mixture image, perform hierarchical clustering on the grayscale values ​​of the pixels in the grayscale image to obtain a grayscale hierarchical clustering tree, determine the texture values ​​of the pixels in the grayscale image, perform hierarchical clustering on the texture values ​​of the pixels in the grayscale image to obtain a texture hierarchical clustering tree.

[0049] During the water-soluble fertilizer production process, a high-resolution camera or imaging device, along with appropriate lighting equipment, is set up to ensure that subtle color and texture differences can be captured. The surface of the mixture obtained by stirring different water-soluble fertilizer production raw materials is imaged to obtain a clear image of the mixture.

[0050] Taking into account that most of the different water-soluble fertilizer production raw materials are white crystals or powders, and are very similar in color, mainly appearing in a white or colorless transparent state, in order to distinguish different types of water-soluble fertilizer production raw materials, it is also necessary to rely on other characteristics of the water-soluble fertilizer production raw materials, such as shape, texture, etc. Among them, in terms of texture, different water-soluble fertilizer production raw materials may have large differences, which depends on their chemical properties and crystal structure. Some water-soluble fertilizer production raw materials may have different crystal forms or crystal sizes, which will cause their texture to be different when touched or observed; some raw materials may present a delicate crystalline structure, while others may present a block or powder texture. Therefore, the embodiment of the present invention, based on the color differentiation of different water-soluble fertilizer production raw materials, combines them with texture information for more accurate differentiation, so as to facilitate the final accurate uniformity of the mixture of different water-soluble fertilizer production raw materials.

[0051] Considering that when uniformity detection of different water-soluble fertilizer production raw material mixtures is performed based on texture information, the conventional method is to calculate the mixing uniformity through the gray-level co-occurrence matrix. However, since the size of the gray-level co-occurrence matrix is ​​usually selected based on empirical values, it is difficult to adapt to the actual situation. Therefore, in the embodiment of the present invention, a more accurate mixing uniformity is obtained by calculating a suitable texture scale information.

[0052] To achieve the above objectives, considering that the mixture image is an RGB image, in order to facilitate subsequent calculations, the mixture image is grayscale converted to obtain a grayscale image of the mixture image. The grayscale values ​​of all pixels on the grayscale image are statistically obtained, and the grayscale values ​​are hierarchically clustered using a bottom-up hierarchical clustering method to obtain a hierarchical clustering tree, which is referred to herein as a grayscale hierarchical clustering tree. The grayscale hierarchical clustering tree includes multiple layers, each layer includes multiple categories, and each category includes multiple grayscale values. For each category in each layer of the grayscale hierarchical clustering tree, the position points corresponding to the positions of the pixels corresponding to all grayscale values ​​in the category on the grayscale image can be obtained, which are recorded as category position points. In the grayscale hierarchical clustering tree, if all categories in a certain layer are distributed relatively evenly, the grayscale distribution uniformity at this scale is greater, that is, the mixing uniformity of different water-soluble fertilizer production raw materials is greater. Therefore, in order to determine the mixing uniformity of different water-soluble fertilizer production raw materials, it is necessary to subsequently calculate the distribution uniformity of the position points of each category in each layer of the grayscale hierarchical clustering tree.

[0053] Considering that in the case of uniform grayscale distribution, due to the close colors of different water-soluble fertilizer raw materials, there is a large error in grayscale, therefore on the basis that grayscale is close, the distribution uniformity of texture is also relatively close layer, the scale information calculated by this layer is used as the window size of grayscale co-occurrence matrix, so as to obtain a more accurate, more reliable mixed uniformity. Therefore, according to the grayscale value of pixel in grayscale image, LBP (Local Binary Patterns, local binary pattern) descriptor of each pixel is calculated, this LBP descriptor can represent the texture information of this pixel, therefore this LBP descriptor can be referred to as texture value, but because LBP descriptor is a rotation-insensitive descriptor, therefore there is no positional distribution information of data points in texture, the LBP descriptor of each pixel is a scalar. Using the LBP descriptor of each pixel in grayscale image, that is, texture value, as the basic element of hierarchical clustering, adopt hierarchical clustering method from bottom to top equally to carry out hierarchical clustering to texture value, thus obtain a hierarchical clustering tree, here this hierarchical clustering tree is referred to as texture hierarchical clustering tree. The texture hierarchical clustering tree also includes multiple layers, each layer includes multiple categories, and each category includes multiple texture values. For each category in each layer of the texture hierarchical clustering tree, a position point formed by the positions of the pixels corresponding to all texture values ​​in the category on the grayscale image can also be obtained, which is also recorded as a category position point.

[0054] Step S2: The grayscale hierarchical clustering tree and the texture hierarchical clustering tree are both taken as a target hierarchical clustering tree, and the uniformity of the position point distribution of each category in each layer of the target hierarchical clustering tree is determined according to the position of the corresponding pixel point of each category in each layer of the target hierarchical clustering tree in the grayscale image.

[0055] The grayscale hierarchical clustering tree is used as a target hierarchical clustering tree. Taking any category in any layer of the target hierarchical clustering tree as an example, the position points of all grayscale values ​​in the category on the grayscale image are used as input. The triangulated network structure is obtained through the Delaunay triangulation algorithm, that is, the connection relationship between the position points is obtained. Each node in the triangulated network structure corresponds to a position point. The Euclidean distance between the two nodes corresponding to the connecting edge in the triangulated network structure is recorded as the edge value. The node density of the 1-N neighborhood of each node in the triangulated network structure is calculated as follows:

[0056] Taking any node a in a triangulated network as an example, the nodes directly connected to node a in the triangulated network are denoted as the 1st neighbor node, the nodes directly connected to the 1st neighbor node are denoted as the 2nd neighbor node, the nodes directly connected to the 2nd neighbor node are denoted as the 3rd neighbor node, and so on, up to the i-th neighbor node. A node can only be considered as one of the i-th neighbor nodes. The shortest path between the i-th neighbor node and node a is denoted as the i-th neighbor distance. The shortest path between the i-th neighbor node and node a can be calculated using the Dijkstra algorithm. Multiple i-th neighbor distances can be obtained, and the average of all i-th neighbor distances is denoted as the node density of the i-th neighborhood.

[0057] In this way, the node density of the first neighborhood of node a, the node density of the second neighborhood, ... the node density of the i-th neighborhood, ..., the node density of the N-th neighborhood can be calculated, thereby forming a node density sequence, which can represent the change in the distance between node a and the surrounding nodes during the process of range expansion.

[0058] Similarly, the node density sequence of each node in the triangulated network graph structure can be obtained, and the cosine similarity of the node density sequences of any two nodes can be calculated. The cosine similarity is called the similarity index of any two nodes, and the mean of all similarity indexes is recorded as the uniformity of the position point distribution of the corresponding category of the triangulated network graph structure. It should be understood that when calculating the cosine similarity of any two node density sequences, if the lengths of the two node density sequences are inconsistent, the last element of the node density sequence with the shorter length is padded with 0 to make the lengths of the two node density sequences the same. In addition, as other implementation methods, other methods can also be used to quantify the similarity of the node density sequences of any two nodes, thereby obtaining the similarity index of any two nodes, which is not limited here.

[0059] For each category in each layer of the target hierarchical clustering tree, the larger the range of the category position points corresponding to the category, the greater the influence of the uniformity of the distribution of the category's position points on the uniformity of the distribution of the position points of the layer; the closer the distribution of the category position points corresponding to the category is to the center of the image, the greater the uniformity of the distribution of the position points of the layer. This is because if the distribution uniformity of the position points of a certain category is large, but it is located in a corner area of ​​the image, the uniformity of the distribution of the position points of the layer as a whole is also small. Therefore, while the distribution uniformity is large, the closer the category position points corresponding to the category are to the center of the image, the greater the influence weight of the category should be.

[0060] Therefore, based on the distribution of the location points for each category in each layer of the target hierarchical clustering tree in the grayscale image, the Graham scan algorithm is used to calculate the largest convex polygon corresponding to all category location points in that category. The ratio of the area of ​​the convex polygon to the area of ​​the grayscale image is then calculated, and this ratio is recorded as the first influence weight for each category in each layer of the target hierarchical clustering tree. Simultaneously, the convex points (i.e., the endpoints on the convex polygon) of each category in each layer of the target hierarchical clustering tree are determined. For each convex point, the minimum distance d between the convex point and the grayscale image boundary is calculated. Multiple minimum distances d are then obtained, and all minimum distances d form a sequence. The variance of this sequence is calculated, and this variance is recorded as the second influence weight for each category in each layer of the target hierarchical clustering tree. The smaller the second influence weight, the greater the consistency of the distances between all convex points of the convex polygon corresponding to that category and the grayscale image boundary. The closer the distribution uniformity of the category is to a uniform distribution around the image center point, the greater the distribution uniformity of the location points in that layer, and therefore, the higher the influence weight should be assigned.

[0061] According to the location point distribution uniformity, the first influence weight and the second influence weight corresponding to each category in each layer of the target hierarchical clustering tree, the location point distribution uniformity corresponding to each layer of the target hierarchical clustering tree is determined. The corresponding calculation formula is:

[0062]

[0063] Among them, p represents the uniformity of the distribution of the location points corresponding to each layer of the target hierarchical clustering tree; a i represents the first influence weight corresponding to the i-th category in each layer of the target hierarchical clustering tree; s i represents the second influence weight corresponding to the i-th category in each layer of the target hierarchical clustering tree; j i represents the uniformity of the distribution of the location points corresponding to the i-th category in each layer of the target hierarchical clustering tree; n represents the total number of categories in each layer of the target hierarchical clustering tree; e represents a natural constant.

[0064] In the above-mentioned calculation formula for the uniformity of the position point distribution, in each layer of the target hierarchical clustering tree, the larger the first influence weight corresponding to a certain category, the larger the distribution range of the category position points corresponding to the category in the grayscale image, and the greater its influence on the calculation of the uniformity of the position point distribution corresponding to the layer; at the same time, the smaller the second influence weight corresponding to the category, the greater the consistency of the distance between all the convex edge points of the convex polygon corresponding to the category and the grayscale image boundary, the higher the degree of uniform distribution of the category position points corresponding to the category near the image center, and the greater its influence on the calculation of the uniformity of the position point distribution corresponding to the layer. By utilizing the uniformity of the position point distribution corresponding to each category in each layer of the target hierarchical clustering tree and taking the product of the first influence weight and the second influence weight corresponding to each category as the comprehensive weight of the uniformity of the position point distribution corresponding to each category, the uniformity of the position point distribution of each layer of the target hierarchical clustering tree is finally obtained.

[0065] By taking the grayscale hierarchical clustering tree as a target hierarchical clustering tree, the position point distribution uniformity of each layer of the grayscale hierarchical clustering tree can be determined. The position point distribution uniformity characterizes the degree of grayscale distribution uniformity of the pixel points corresponding to each layer of the grayscale hierarchical clustering tree. Therefore, the position point distribution uniformity is referred to as grayscale distribution uniformity. In the same way, by taking the texture hierarchical clustering tree as a target hierarchical clustering tree, the position point distribution uniformity of each layer of the texture hierarchical clustering tree can be obtained. The position point distribution uniformity characterizes the degree of texture distribution uniformity of the pixel points corresponding to each layer of the texture hierarchical clustering tree. Therefore, the position point distribution uniformity is referred to as texture distribution uniformity.

[0066] Step S3: Group the distribution uniformity of the position points of each category in each layer of the grayscale hierarchical clustering tree to obtain multiple distribution uniformity groups. According to the number of distribution uniformity groups corresponding to each layer of the grayscale hierarchical clustering tree and the number of each category in each layer of the texture hierarchical clustering tree, match each layer of the grayscale hierarchical clustering tree with each layer of the texture hierarchical clustering tree to obtain multiple matching layer pairs of the grayscale hierarchical clustering tree and the texture hierarchical clustering tree.

[0067] According to the categories in each layer of the grayscale hierarchical clustering tree and the uniformity of the distribution of the position points of each category, the possible texture distribution can be inferred. Categories with similar uniformity of the distribution of position points in each layer will have a greater probability of forming texture in spatial distribution. If the texture distribution uniformity in the similar layers obtained based on the texture is also large, it means that the texture distribution of the layer can better describe the texture features. At this time, the scale corresponding to the layer is used as the size of the grayscale co-occurrence matrix to calculate the texture distribution uniformity, which can obtain a more accurate texture distribution uniformity.

[0068] For each layer of the grayscale hierarchical clustering tree derived from the grayscale values ​​of pixels in the grayscale image, each category in that layer corresponds to a location point distribution uniformity. The location point distribution uniformities of all categories are arranged in ascending order to obtain an ascending sequence. This ascending sequence is segmented using the Otsu multi-threshold segmentation method to obtain multiple distribution uniformity groups. The location points within the same distribution uniformity group have similar distribution uniformities, while the location points within different distribution uniformity groups have significantly different distribution uniformities. Distribution uniformity groups with similar location point distribution uniformities have a higher probability of forming textures. Therefore, the number of distribution uniformity groups is determined and used as the number of texture categories corresponding to the grayscale, denoted as N. This number of texture categories represents the number of possible texture patterns that can be formed at the corresponding scale of that layer. In this way, the number of texture categories corresponding to each layer of the grayscale hierarchical clustering tree can be determined. According to the number of texture categories corresponding to each layer of the grayscale hierarchical clustering tree, the corresponding layer is obtained to see whether the texture distribution uniformity of the corresponding layer is large. If it is large, the scale information calculated by the layer can better represent the scale of the texture, and then the scale is used as the window size of the grayscale co-occurrence matrix to calculate the texture distribution uniformity, which can obtain a more accurate texture distribution uniformity.

[0069] To this end, the matching layer pairs of the grayscale hierarchical clustering tree and the texture hierarchical clustering tree are calculated by the KM algorithm (Kuhn-Munkres Algorithm). The existing KM algorithm calculates a one-to-one match between the left and right nodes. In the embodiment of the present invention, each layer of the grayscale hierarchical clustering tree is used as the left node, and the number of texture categories N of the layer, that is, the number of distribution uniformity groups, is used as the node value. Each layer of the texture hierarchical clustering tree is used as the right node, and the number of categories of the layer is used as the node value. Each node on the left has a connecting edge with all nodes on the right, and the edge value of each connecting edge is the ratio of the smaller value to the larger value of the corresponding two node values. Through KM matching, a one-to-one match between the left and right nodes can be obtained, and each one-to-one match is a matching layer pair, that is, multiple matching layer pairs of the grayscale hierarchical clustering tree and the texture hierarchical clustering tree are obtained.

[0070] Step S4: Determine the selectivity index of each matching layer pair based on the uniformity of the position point distribution of each category in each layer of each matching layer pair and the position distribution of the corresponding pixel points of each category in the grayscale image, and determine the target layer of the texture hierarchical clustering tree based on the selectivity index, and determine the window size of the grayscale co-occurrence matrix based on the texture values ​​of the corresponding pixel points of each category in the target layer of the texture hierarchical clustering tree in the grayscale image, and perform mixing uniformity detection based on the window size of the grayscale co-occurrence matrix and the grayscale image.

[0071] Based on the uniformity of the position point distribution of each category in each layer of the grayscale hierarchical clustering tree, the uniformity of the grayscale distribution of each layer of the grayscale hierarchical clustering tree is determined, and based on the uniformity of the position point distribution of each category in each layer of the texture hierarchical clustering tree, the uniformity of the texture distribution of each layer of the texture hierarchical clustering tree is determined. Since the steps for determining the uniformity of the grayscale distribution of each layer of the grayscale hierarchical clustering tree and the uniformity of the texture distribution of each layer of the texture hierarchical clustering tree have been described in detail in the above step S2, they will not be repeated here.

[0072] According to the grayscale distribution uniformity of the layer corresponding to the grayscale hierarchical clustering tree and the texture hierarchical clustering tree and the texture distribution uniformity of the layer corresponding to the texture hierarchical clustering tree in each matching layer pair, the selectivity index of each matching layer pair of the grayscale hierarchical clustering tree and the texture hierarchical clustering tree can be determined. The corresponding calculation formula is:

[0073]

[0074] Among them, P represents the optional index of each matching layer pair of the grayscale hierarchical clustering tree and the texture hierarchical clustering tree; p1 represents the grayscale distribution uniformity of the layer corresponding to the grayscale hierarchical clustering tree in each matching layer pair of the grayscale hierarchical clustering tree and the texture hierarchical clustering tree; p2 represents the texture distribution uniformity of the layer corresponding to the texture hierarchical clustering tree in each matching layer pair of the grayscale hierarchical clustering tree and the texture hierarchical clustering tree; P0 represents the distribution uniformity threshold, which can be reasonably set as needed. In the embodiment of the present invention, P0 is set to 0.7.

[0075] In the above-mentioned calculation formula of the selectivity index, when the grayscale distribution uniformity corresponding to the matching layer is large, it may be because the colors of different water-soluble fertilizer production raw materials are similar, and it is necessary to obtain the mixing situation more through texture distribution uniformity. When the grayscale distribution uniformity is small, it can be directly indicated that the mixing uniformity is poor and further mixing is needed. At this time, the corresponding selectivity index is determined by the grayscale distribution uniformity.

[0076] After determining the selectivity index of each matching layer pair of the grayscale hierarchical clustering tree and the texture hierarchical clustering tree in the above manner, the maximum selectivity index among the selectivity indexes of all matching layer pairs can be determined, thereby determining the matching layer pair corresponding to the maximum selectivity index. Since each matching layer pair corresponds to a layer of the grayscale hierarchical clustering tree and a layer of the texture hierarchical clustering tree, the layer corresponding to the matching layer pair with the maximum selectivity index in the texture hierarchical clustering tree is recorded as the target layer. After obtaining the target layer of the texture hierarchical clustering tree, it is necessary to obtain the window size of the grayscale co-occurrence matrix based on the target layer. In this case, it can be obtained based on the distribution pattern of the minimum texture category.

[0077] According to the texture value of the pixel point in the grayscale image, the texture value is used as the pixel value of the pixel point in the image, so that the texture image can be obtained. According to each category in the target layer of the texture hierarchical clustering tree, the pixel point distribution of each category on the grayscale image can be obtained. The minimum circumscribed rectangle of the pixel points of each category is obtained by the convex hull detection algorithm. The pixel values ​​of each rectangular area in the texture image are Fourier transformed to obtain the spectrum image of the corresponding rectangular area. The inverse of the frequency corresponding to the maximum grayscale value point in the spectrum image is used as the candidate window size of a grayscale co-occurrence matrix corresponding to each category in the target layer of the texture hierarchical clustering tree. The minimum value among the candidate window sizes of the grayscale co-occurrence matrix corresponding to each category in the target layer of the texture hierarchical clustering tree is used as the window size of the grayscale co-occurrence matrix. The window size of the grayscale co-occurrence matrix is ​​the optimal texture size.

[0078] After determining the window size of the grayscale co-occurrence matrix, the regional window of each pixel in the grayscale image is determined with each pixel in the grayscale image as the center and the window size of the grayscale co-occurrence matrix as the window size. According to the grayscale value of the pixel in the regional window, the grayscale co-occurrence matrix corresponding to the regional window at a small set angle is determined. In this embodiment, the set angle is set to 0°. Of course, as other implementation methods, the set angle can also be set to 45°, 90°, etc. The energy of the grayscale co-occurrence matrix is ​​calculated. The energy reflects the uniformity of the grayscale distribution and the coarseness of the texture of the image. The greater the energy, the more uniform the grayscale distribution of the image, and vice versa. The more concentrated the grayscale distribution. The energy of the grayscale co-occurrence matrix is ​​used as the eigenvalue of the pixel in the grayscale image corresponding to the regional window, and the eigenvalue is used as the pixel value of the pixel in the grayscale image to obtain the eigenvalue image. Based on the eigenvalue image, the mixing uniformity index of the grayscale image can be determined. The corresponding calculation formula is:

[0079]

[0080] Among them, r represents the mixing uniformity index of the grayscale image; σ 2 The pixel values ​​of all pixels in the eigenvalue image corresponding to the grayscale image are the variance of the eigenvalues; k i represents the pixel value of the i-th pixel in the eigenvalue image corresponding to the grayscale image, i.e., the eigenvalue; m represents the total number of pixels in the eigenvalue image corresponding to the grayscale image; α represents a denominator correction parameter used to prevent the denominator from being zero. In the embodiment of the present invention, α is set to 0.01.

[0081] In the above formula for calculating the mixing uniformity index, the mean eigenvalues ​​of all pixels in the eigenvalue image are calculated. A larger mean eigenvalue indicates a more uniform grayscale distribution in the corresponding grayscale image, and a larger mixing uniformity index is obtained. Simultaneously, the variance of the eigenvalues ​​of all pixels in the eigenvalue image is calculated. This variance reflects the consistency of the eigenvalues. A smaller variance indicates greater consistency of the eigenvalues, and in this case, using the mean eigenvalue to represent the mixing uniformity index is more effective.

[0082] A mixing uniformity threshold is pre-set. The value of the mixing uniformity threshold can be reasonably set as needed. In the embodiment of the present invention, the mixing uniformity threshold is set to 0.9. When determining the mixing uniformity index of the grayscale image, the mixing uniformity index is compared with the mixing uniformity threshold. If the mixing uniformity index is less than the mixing uniformity threshold, it indicates that the raw materials for water-soluble fertilizer production are not mixed uniformly enough. In this case, stirring needs to be continued until the mixing uniformity index is greater than or equal to the mixing uniformity threshold, and then stirring is stopped.

[0083] Compared with the existing technology, which calculates the grayscale co-occurrence matrix through a fixed-size window to obtain mixing uniformity, it is difficult to adapt to the actual situation, resulting in low uniformity detection accuracy. The present invention obtains the optimal texture scale through hierarchical clustering of grayscale values ​​and hierarchical clustering of local window texture features, and analyzes the two clustering results. Then, the mixing uniformity is calculated through the grayscale co-occurrence matrix under the optimal texture scale, which greatly improves the detection accuracy and precision of mixing uniformity.

[0084] It should be noted that the above-described embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. These modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the various embodiments of the present application, and should all be included in the scope of protection of the present application.

Claims

1. A method for visually detecting the mixing uniformity of raw materials for water-soluble fertilizer production, characterized in that: The following steps are involved: Obtaining a grayscale image of the mixture image, performing hierarchical clustering on the grayscale values ​​of pixels in the grayscale image to obtain a grayscale hierarchical clustering tree, and determining texture values ​​of the pixels in the grayscale image, performing hierarchical clustering on the texture values ​​of the pixels in the grayscale image to obtain a texture hierarchical clustering tree; The grayscale hierarchical clustering tree and the texture hierarchical clustering tree are both used as a target hierarchical clustering tree, and according to the position of the corresponding pixel point of each category in each layer of the target hierarchical clustering tree in the grayscale image, the uniformity of the position point distribution of each category in each layer of the target hierarchical clustering tree is determined; The distribution uniformity of the position points of each category in each layer of the grayscale hierarchical clustering tree is grouped to obtain a plurality of distribution uniformity groups, and according to the number of distribution uniformity groups corresponding to each layer of the grayscale hierarchical clustering tree and the number of each category in each layer of the texture hierarchical clustering tree, each layer of the grayscale hierarchical clustering tree is matched with each layer of the texture hierarchical clustering tree to obtain a plurality of matching layer pairs of the grayscale hierarchical clustering tree and the texture hierarchical clustering tree; According to the uniformity of the position point distribution of each category in each layer of each matching layer pair and the position distribution of the corresponding pixel points of each category in the grayscale image, the selectivity index of each matching layer pair is determined, and based on the selectivity index, the target layer of the texture hierarchical clustering tree is determined, and based on the texture values ​​of the corresponding pixel points of each category in the target layer of the texture hierarchical clustering tree in the grayscale image, the window size of the grayscale co-occurrence matrix is ​​determined, and based on the window size of the grayscale co-occurrence matrix and the grayscale image, a mixing uniformity test is performed.

2. A method for visually detecting mixing uniformity of raw materials for water-soluble fertilizer production according to claim 1, characterized in that: Determine the uniformity of the location point distribution for each category at each layer of the target hierarchical clustering tree, including: Determine a triangulated network structure according to the position of the corresponding pixel point of each category in each layer of the target hierarchical clustering tree in the grayscale image, wherein each node in the triangulated network structure corresponds to a position point corresponding to the position of a pixel point; Determining a node density sequence of each node in the triangulated network structure according to the position distribution of each node in the triangulated network structure; The similarity index of the node density sequence of any two nodes in the triangulated network graph structure is calculated, and the average value of all the similarity indexes is determined as the position point distribution uniformity of each category in each layer of the target hierarchical clustering tree.

3. A method for visually detecting mixing uniformity of raw materials for water-soluble fertilizer production according to claim 1, characterized in that: Multiple matching layer pairs of grayscale hierarchical clustering trees and texture hierarchical clustering trees are obtained, including: Each layer of the grayscale hierarchical clustering tree is taken as a left node, and the number of distribution uniformity groups corresponding to each layer of the grayscale hierarchical clustering tree is taken as the node value of the corresponding left node; Each layer of the texture hierarchical clustering tree is used as a right node, and the number of categories of each category in each layer of the texture hierarchical clustering tree is used as the node value of the corresponding right node; The edge value of the edge connecting any left node and any right node is determined as the ratio of the smaller value to the larger value of the node values ​​of the corresponding two nodes; According to the edge value of the connection edge between any left node and any right node, one-to-one matching is performed on all left nodes and right nodes to obtain multiple matching layer pairs of grayscale hierarchical clustering trees and texture hierarchical clustering trees.

4. A method for visually detecting mixing uniformity of raw materials for water-soluble fertilizer production according to claim 1, characterized in that: Determining the selectivity index of each matching layer pair includes: According to the position of the corresponding pixel point of each category in each layer of the target hierarchical clustering tree in the grayscale image, determining the largest convex polygon corresponding to the position point corresponding to the position; Determine a first influence weight corresponding to each category in each layer of the target hierarchical clustering tree according to an area ratio of the convex shape corresponding to each category in each layer of the target hierarchical clustering tree in the grayscale image; Determine the minimum distance between each convex edge point of the convex polygon corresponding to each category in each layer of the target hierarchical clustering tree and the boundary of the grayscale image, and determine the second influence weight corresponding to each category in each layer of the target hierarchical clustering tree based on the discrete conditions of all the minimum distances; Determine the uniformity of the distribution of the position points corresponding to each layer of the target hierarchical clustering tree according to the first influence weight, the second influence weight and the uniformity of the distribution of the position points corresponding to each category in each layer of the target hierarchical clustering tree; The distribution uniformity of the position points corresponding to each layer of the grayscale hierarchical clustering tree is used as the grayscale distribution uniformity corresponding to each layer of the grayscale hierarchical clustering tree, and the distribution uniformity of the position points corresponding to each layer of the texture hierarchical clustering tree is used as the texture distribution uniformity corresponding to each layer of the texture hierarchical clustering tree; The selectivity index of each matching layer pair is determined according to the grayscale distribution uniformity of the layer corresponding to the grayscale hierarchical clustering tree and the texture distribution uniformity of the layer corresponding to the texture hierarchical clustering tree in each matching layer pair.

5. A method for visually detecting mixing uniformity of raw materials for water-soluble fertilizer production according to claim 4, characterized in that: The distribution uniformity of the location points corresponding to each layer of the target hierarchical clustering tree is calculated as follows: Among them, p represents the uniformity of the distribution of the location points corresponding to each layer of the target hierarchical clustering tree; a i represents the first influence weight corresponding to the i-th category in each layer of the target hierarchical clustering tree; s i represents the second influence weight corresponding to the i-th category in each layer of the target hierarchical clustering tree; j i represents the uniformity of the distribution of the location points corresponding to the i-th category in each layer of the target hierarchical clustering tree; n represents the total number of categories in each layer of the target hierarchical clustering tree; e represents a natural constant.

6. A method for visually detecting mixing uniformity of raw materials for water-soluble fertilizer production according to claim 4, characterized in that: Determine the selectivity index of each matching layer pair, and the corresponding calculation formula is: Among them, P represents the selectivity index of each matching layer pair of the grayscale hierarchical clustering tree and the texture hierarchical clustering tree; p1 represents the grayscale distribution uniformity of the layer corresponding to the grayscale hierarchical clustering tree in each matching layer pair of the grayscale hierarchical clustering tree and the texture hierarchical clustering tree; p2 represents the texture distribution uniformity of the layer corresponding to the texture hierarchical clustering tree in each matching layer pair of the grayscale hierarchical clustering tree and the texture hierarchical clustering tree; P0 represents the distribution uniformity threshold.

7. A method for visually detecting mixing uniformity of raw materials for water-soluble fertilizer production according to claim 1, characterized in that: Determine the target layer of the texture hierarchical clustering tree, including: The maximum selectivity index among the selectivity indexes of the matching layer pairs is determined, and the layer corresponding to the matching layer pair corresponding to the maximum selectivity index in the texture hierarchical clustering tree is determined as the target layer of the texture hierarchical clustering tree.

8. A method for visually detecting mixing uniformity of raw materials for water-soluble fertilizer production according to claim 1, characterized in that: Determine the window size of the gray-level co-occurrence matrix, including: Determine the minimum bounding rectangle of the pixel points corresponding to each category in the target layer of the texture hierarchical clustering tree in the grayscale image, perform Fourier transform on the texture values ​​of all pixel points in the minimum bounding rectangle to obtain a spectrum image, and determine the candidate window size of the gray level co-occurrence matrix corresponding to each category in the target layer of the texture hierarchical clustering tree according to the inverse of the frequency corresponding to the point with the maximum gray value in the spectrum image; The minimum value among the candidate window sizes of the gray level co-occurrence matrix corresponding to each category in the target layer of the texture hierarchical clustering tree is used as the window size of the gray level co-occurrence matrix.

9. A method for visually detecting mixing uniformity of raw materials for water-soluble fertilizer production according to claim 1, characterized in that: Perform mixing uniformity testing, including: Determine a regional window for each pixel in the grayscale image with each pixel in the grayscale image as the center and the window size of the grayscale co-occurrence matrix as the window size, and determine the grayscale co-occurrence matrix corresponding to the regional window at a set angle according to the grayscale value of the pixel in the regional window, and determine the energy of the grayscale co-occurrence matrix; According to the size and distribution consistency of the energy corresponding to each pixel in the grayscale image, the mixing uniformity index corresponding to the grayscale image is determined. If the mixing uniformity index is less than the mixing uniformity threshold, it is determined that the mixing is not uniform enough; otherwise, it is determined that the mixing is uniform.

10. The method for visually detecting mixing uniformity of raw materials for producing water-soluble fertilizer according to claim 1, characterized in that: Multiple distribution uniformity groups are obtained, including: The distribution uniformity of the position points of each category in each layer of the grayscale hierarchical clustering tree is segmented by multiple thresholds to obtain multiple distribution uniformity groups.

Citation Information

Patent Citations

  • Rock mass structure homogeneous region automatic partitioning method based on image textures

    CN110135515A

  • Concrete stirring uniformity detection method

    CN116228777A

  • Core-level high resolution petrophysical characterization method

    US20220065096A1

  • Image segmentation method combining super-pixels and multi-scale hierarchical feature recognition

    WO2024021413A1