A visual inspection method for the mixing uniformity of raw materials in water-soluble fertilizer production

By combining gray-level hierarchical clustering and texture hierarchical clustering, the problem of low detection accuracy of mixing uniformity of raw materials for water-soluble fertilizer production was solved, and higher accuracy of mixing uniformity detection was achieved. The detection effect was improved by optimizing the window size of the gray-level co-occurrence matrix.

CN120635006BActive Publication Date: 2025-10-31AKSU JIABANG FERTILIZER CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

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

AI Technical Summary

Technical Problem

In existing technologies, 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 gray-scale co-occurrence matrix, resulting in insufficient detection accuracy.

Method used

A method combining gray-level hierarchical clustering and texture hierarchical clustering is adopted. By acquiring the gray-level image of the mixed image, hierarchical clustering is performed to determine the gray-level value and texture value of the pixel, construct the target hierarchical clustering tree, calculate the window size of the gray-level co-occurrence matrix, and perform mixing uniformity detection.

Benefits of technology

It improves the accuracy and precision of detecting the mixing uniformity of raw materials for water-soluble fertilizer production. By combining grayscale and texture information, it accurately determines the mixing uniformity, overcoming the shortcomings of empirical value selection for grayscale co-occurrence matrix window size.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120635006B_ABST
    Figure CN120635006B_ABST
Patent Text Reader

Abstract

This invention relates to the field of image analysis technology, specifically to a visual detection method for the mixing uniformity of raw materials used in water-soluble fertilizer production. The method acquires a grayscale image of the mixture and determines the corresponding grayscale hierarchical clustering tree and texture hierarchical clustering tree. It analyzes these trees to determine the target layer of the texture hierarchical clustering tree and, based on the texture values ​​of the corresponding pixels in the grayscale image for each category in the target layer, determines the window size of the grayscale co-occurrence matrix. Finally, it performs mixing uniformity detection based on the window size of the grayscale co-occurrence matrix and the grayscale image. This invention effectively improves the accuracy of detecting the mixing uniformity of raw materials used in water-soluble fertilizer production by adaptively determining the window size of the grayscale co-occurrence matrix.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of image analysis technology, and specifically to a visual detection method for the mixing uniformity of raw materials used in water-soluble fertilizer production. Background Technology

[0002] Water-soluble fertilizer is a multi-element compound fertilizer that can completely dissolve in water. It can effectively promote crop growth and development and can be used for foliar spraying, soilless cultivation, drip irrigation, etc. During the production of water-soluble fertilizer, different types of raw materials need to be mixed evenly. Since the degree of uniformity in mixing directly affects the production quality of water-soluble fertilizer, it is necessary to test the degree of uniformity in the mixing of raw materials during the production process.

[0003] Since most raw materials for water-soluble fertilizer production are white, it is difficult to check the mixing uniformity by color when different raw materials are mixed. Therefore, texture information is often used to detect mixing uniformity. In existing technologies, gray-level co-occurrence matrices are often used to detect the mixing uniformity of different water-soluble fertilizer raw materials. However, since the window size for calculating the gray-level co-occurrence matrix is ​​often set by empirical values, it is difficult to adapt well to actual conditions, resulting in low accuracy in uniformity detection. Summary of the Invention

[0004] The purpose of this invention is to provide a visual inspection method for the uniformity of mixing of raw materials in water-soluble fertilizer production, which solves the problem of low accuracy in the existing detection of the uniformity of mixing of raw materials in water-soluble fertilizer production.

[0005] To address the aforementioned technical problems, this invention provides a visual inspection method for the mixing uniformity of raw materials used in water-soluble fertilizer production, comprising the following steps:

[0006] A grayscale image of a mixture image is obtained, and the grayscale values ​​of the pixels in the grayscale image are hierarchically clustered to obtain a grayscale hierarchical clustering tree. The texture values ​​of the pixels in the grayscale image are determined, and the texture values ​​of the pixels in the grayscale image are hierarchically clustered to obtain a texture hierarchical clustering tree.

[0007] Both the gray-level clustering tree and the texture-level clustering tree are used as a target hierarchical clustering tree. Based on the position of the corresponding pixel in the gray-level image for each category in each layer of the target hierarchical clustering tree, the uniformity of the position point distribution of each category in each layer of the target hierarchical clustering tree is determined.

[0008] The uniformity of the location points of each category in each layer of the gray-level hierarchical clustering tree is grouped to obtain multiple uniformity groups. Based on the number of uniformity groups corresponding to each layer of the gray-level hierarchical clustering tree and the number of each category in each layer of the texture hierarchical clustering tree, each layer of the gray-level hierarchical clustering tree is matched with each layer of the texture hierarchical clustering tree to obtain multiple matching layer pairs of gray-level hierarchical clustering tree and texture hierarchical clustering tree.

[0009] 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, the selectivity index of each matching layer pair is determined. Based on the selectivity index, the target layer of the texture hierarchy clustering tree is determined. Based on the texture value of the corresponding pixel point of each category in the target layer of the texture hierarchy clustering tree in the grayscale image, the window size of the gray-level co-occurrence matrix is ​​determined. Based on the window size of the gray-level co-occurrence matrix and the grayscale image, mixing uniformity detection is performed.

[0010] Furthermore, determining the uniformity of the location point distribution for each category in each layer of the target hierarchical clustering tree includes:

[0011] Based on the position of the corresponding pixel in the grayscale image for each category in each layer of the target hierarchical clustering tree, a triangular network structure is determined, wherein each node in the triangular network structure corresponds to the position point of a pixel.

[0012] Based on the positional distribution of each node in the triangular network structure, determine the node density sequence of each node in the triangular network structure;

[0013] Calculate the similarity index of the node density sequence of any two nodes in the triangular network structure, and determine the average value of all the similarity indices as the uniformity of the location point distribution of each category in each layer of the target hierarchical clustering tree.

[0014] Furthermore, multiple matching layer pairs of gray-level clustering trees and texture-level clustering trees are obtained, including:

[0015] Each layer of the gray-level hierarchical clustering tree is taken as the left node, and the number of distribution uniformity groups corresponding to each layer of the gray-level hierarchical clustering tree is taken as the node value of the corresponding left node.

[0016] Each layer of the texture hierarchy clustering tree is taken as the right node, and the number of each category in each layer of the texture hierarchy clustering tree is taken 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 corresponding two node values.

[0018] Based on the edge value of the connection between any left node and any right node, perform one-to-one matching on all left and right nodes to obtain multiple matching layer pairs of gray-level clustering trees and texture-level clustering trees.

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

[0020] Based on the position of the corresponding pixel in the grayscale image for each category in each layer of the target hierarchical clustering tree, determine the largest convex polygon corresponding to the position.

[0021] Based on the area ratio of the convex polygon corresponding to each category in each layer of the target hierarchical clustering tree in the grayscale image, determine the first influence weight corresponding to each category in each layer of the target hierarchical clustering tree;

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

[0023] Based on the first influence weight, second influence weight, and uniformity of location point distribution for each category in each layer of the target hierarchical clustering tree, determine the uniformity of location point distribution for each layer of the target hierarchical clustering tree.

[0024] The uniformity of the distribution of position points corresponding to each layer of the gray-level clustering tree is taken as the uniformity of gray-level distribution corresponding to each layer of the gray-level clustering tree, and the uniformity of the distribution of position points corresponding to each layer of the texture-level clustering tree is taken as the uniformity of texture distribution corresponding to each layer of the texture-level clustering tree.

[0025] Based on the uniformity of grayscale distribution of the layer corresponding to the grayscale hierarchical clustering tree and the uniformity of texture distribution of the layer corresponding to the texture hierarchical clustering tree in each of the matching layer pairs, the selectability index of each matching layer pair is determined.

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

[0027]

[0028] Where p represents the uniformity of the distribution of location points corresponding to each layer of the target hierarchical clustering tree; a i s represents the first influence weight corresponding to the i-th category in each layer of the target hierarchical clustering tree; i This represents the second influence weight corresponding to the i-th category in each layer of the target hierarchical clustering tree; ji denoted by , 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 the natural constant.

[0029] Furthermore, the selectivity index for each of the matching layer pairs is determined, and the corresponding calculation formula is as follows:

[0030]

[0031] Where P represents the selectivity index of each matching layer pair of gray-level hierarchical clustering tree and texture hierarchical clustering tree; p1 represents the gray-level distribution uniformity of the layer corresponding to the gray-level hierarchical clustering tree in each matching layer pair of gray-level hierarchical clustering tree and 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 gray-level hierarchical clustering tree and texture hierarchical clustering tree; and P0 represents the distribution uniformity threshold.

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

[0033] Determine the maximum selectivity index among the selectivity indices of each matching layer pair, and determine the layer corresponding to the matching layer pair with the maximum selectivity index in the texture hierarchy clustering tree as the target layer of the texture hierarchy clustering tree.

[0034] Further, determining the window size of the gray-level co-occurrence matrix includes:

[0035] The minimum bounding rectangle of each category in the target layer of the texture hierarchy clustering tree corresponding to the pixel in the grayscale image is determined. The texture values ​​of all pixels in the minimum bounding rectangle are subjected to Fourier transform to obtain a spectrum image. The candidate window size of the grayscale co-occurrence matrix corresponding to each category in the target layer of the texture hierarchy clustering tree is determined according to the reciprocal of the frequency corresponding to the point with the maximum grayscale 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 hierarchy clustering tree is used as the window size of the gray-level co-occurrence matrix.

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

[0038] Centered on each pixel in the grayscale image, and with the window size of the grayscale co-occurrence matrix as the window size, a region window for each pixel in the grayscale image is determined. Based on the grayscale values ​​of the pixels in the region window, the grayscale co-occurrence matrix corresponding to the region window at a set angle is determined, and the energy of the grayscale co-occurrence matrix is ​​determined.

[0039] Based on the magnitude 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 uniformity of the location points of each category in each layer of the gray-level clustering tree is segmented by multiple thresholds to obtain multiple distribution uniformity groups.

[0042] This invention offers the following advantages: By acquiring a grayscale image of the mixture to be detected, hierarchical clustering is performed based on the grayscale values ​​of pixels in the grayscale image to differentiate the mixture by color, resulting in a grayscale hierarchical clustering tree. In the grayscale hierarchical clustering tree, if all categories in a certain layer are relatively uniformly distributed, the grayscale distribution uniformity at that scale is relatively high, indicating a high degree of mixing uniformity among different water-soluble fertilizer raw materials. Therefore, to determine the mixing uniformity of different water-soluble fertilizer raw materials, it is necessary to calculate the uniformity of the distribution of position points for each category in each layer of the grayscale hierarchical clustering tree. Considering that different components of the mixture may be similar in color, detecting the uniformity of the mixture based on grayscale may have significant errors when the grayscale distribution is uniform. Only by using the scale information calculated from layers with similar grayscale values ​​and similar texture distribution uniformity as the window size of the grayscale co-occurrence matrix can a more accurate and reliable mixing uniformity be obtained. Therefore, hierarchical clustering is performed based on the texture values ​​of pixels in the grayscale image to obtain a texture hierarchical clustering tree. Simultaneously, the uniformity of the location point distribution of each category in each layer of the texture hierarchical clustering tree is determined. Based on this, the possible texture distribution can be inferred from the categories in each layer of the grayscale hierarchical clustering tree and the uniformity of the location point distribution of each category. Categories with similar location point distribution uniformity in each layer have a higher probability of forming texture in spatial distribution. If the texture distribution uniformity in similar layers obtained from the texture analysis is also high, it indicates that the texture distribution of that layer can describe the texture features well. In this case, using the scale corresponding to that layer as the size of the grayscale co-occurrence matrix to calculate the texture distribution uniformity can yield a more accurate texture distribution uniformity. Therefore, the location 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 each category 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. Based on the uniformity of the position points of each category in the corresponding layers of the gray-level clustering tree and texture-level clustering tree in the matching layer pairs, the gray-level uniformity and texture uniformity of the matching layer pairs are comprehensively considered to obtain the selectivity index of each matching layer pair. Based on the selectivity index, each matching layer pair is filtered to obtain the target layer of the texture-level clustering tree. The texture distribution of the target layer can describe the texture features well. Therefore, based on the texture value of the corresponding pixel in the gray-level image of each category in the target layer, the optimal window size of the gray-level co-occurrence matrix can be determined. Based on the optimal window size of the gray-level co-occurrence matrix, and combined with the gray-level value of the pixel in the gray-level image, the mixing uniformity is detected.This invention obtains gray-level clustering trees and texture-level clustering trees of the gray-level image of the mixture to be detected, and analyzes the gray-level clustering trees and texture-level clustering trees to obtain the optimal texture scale, i.e. the window size of the gray-level co-occurrence matrix. Then, the mixing uniformity is calculated by the gray-level co-occurrence matrix under the optimal texture scale, which greatly improves the detection accuracy and precision of mixing uniformity. Attached Figure Description

[0043] To more clearly illustrate the technical solutions and advantages in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0044] Figure 1 This is a flowchart of a visual inspection method for the mixing uniformity of raw materials in water-soluble fertilizer production, according to an embodiment of the present invention. Detailed Implementation

[0045] To further illustrate the technical means and effects adopted by the present invention to achieve the intended purpose, the specific implementation methods, structures, features, and effects of the technical solution proposed according to the present invention are described in detail below with reference to the accompanying drawings and preferred embodiments. In the following description, different "one embodiment" or "another embodiment" do not necessarily refer to the same embodiment. Furthermore, specific features, structures, or characteristics in one or more embodiments can be combined in any suitable form.

[0046] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this invention pertains. Furthermore, all parameters or indices in the formulas discussed herein are normalized values ​​to eliminate the influence of dimensions.

[0047] To address the issue of low accuracy in detecting the mixing uniformity of raw materials used in water-soluble fertilizer production, this embodiment provides a visual detection method for the mixing uniformity of raw materials used in water-soluble fertilizer production. The corresponding process of this method is as follows: Figure 1 As shown, it includes the following steps:

[0048] Step S1: Obtain the 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, and 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] In the process of water-soluble fertilizer production, a high-resolution camera or imaging device, along with appropriate lighting equipment, is set up to ensure that subtle differences in color and texture can be captured. Images of the surface of the mixture obtained after stirring different water-soluble fertilizer production raw materials are acquired, thereby obtaining clear images of the mixture.

[0050] Considering that most raw materials for water-soluble fertilizer production are white crystals or powders, and are very similar in color, mainly appearing as white or colorless and transparent, differentiating between different types of raw materials requires relying on other characteristics such as shape and texture. Among these, texture can vary significantly between different raw materials, depending on their chemical properties and crystal structure. Some raw materials may have different crystal morphologies or sizes, resulting in different textures when touched or observed; some materials may exhibit a fine crystalline structure, while others may present a blocky or powdery texture. Therefore, this embodiment of the invention, based on color differentiation of different raw materials, also combines their texture information for more precise differentiation, thereby facilitating the accurate determination of the uniformity of mixtures of different raw materials for water-soluble fertilizer production.

[0051] Considering that when performing uniformity detection on mixtures of different water-soluble fertilizer production raw materials based on texture information, the conventional method is to calculate the mixing uniformity using a 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 well to the actual situation. Therefore, in this embodiment of the invention, a suitable texture scale information is calculated to obtain a more accurate mixing uniformity.

[0052] To achieve the above objectives, considering that the mixture image is an RGB image, a grayscale conversion is performed on the mixture image to facilitate subsequent calculations, thus obtaining a grayscale image of the mixture image. The grayscale values ​​of all pixels in the grayscale image are statistically obtained, and a bottom-up hierarchical clustering method is used to cluster the grayscale values ​​hierarchically, resulting in a hierarchical clustering tree, which is referred to here as the grayscale hierarchical clustering tree. This 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 pixels of all grayscale values ​​in that category on the grayscale image can be obtained, denoted as category position points. In the grayscale hierarchical clustering tree, if all categories in a certain layer are relatively evenly distributed, the grayscale distribution uniformity at that 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 subsequently calculate the uniformity of the position point distribution of each category in each layer of the grayscale hierarchical clustering tree.

[0053] Considering that even with uniform grayscale distribution, the colors of different water-soluble fertilizer raw materials are similar, leading to significant grayscale errors, a layer with similar texture uniformity is needed. The scale information calculated from this layer is used as the window size of the grayscale co-occurrence matrix to obtain a more accurate and reliable mixing uniformity. Therefore, based on the grayscale values ​​of pixels in the grayscale image, an LBP (Local Binary Patterns) descriptor is calculated for each pixel. This LBP descriptor represents the texture information of that pixel and can be called a texture value. However, since the LBP descriptor is rotation-insensitive, it lacks information about the positional distribution of data points within the texture; each pixel's LBP descriptor is a scalar. Using the LBP descriptor (texture value) of each pixel in the grayscale image as the basic element of hierarchical clustering, a bottom-up hierarchical clustering method is employed to perform hierarchical clustering on the texture values, resulting in a hierarchical clustering tree, which is referred to here as a texture hierarchical clustering tree. This texture hierarchy 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 hierarchy clustering tree, the position points formed by the positions of all texture values ​​in that category on the grayscale image can also be obtained, and these are also denoted as category position points.

[0054] Step S2: Treat both the grayscale hierarchical clustering tree and the texture hierarchical clustering tree as a target hierarchical clustering tree. Based on the position of the corresponding pixel in the grayscale image for each category in each layer of the target hierarchical clustering tree, determine the uniformity of the position point distribution for each category in each layer of the target hierarchical clustering tree.

[0055] Using a gray-level hierarchical clustering tree as a target hierarchical clustering tree, and taking any category in any layer of this target hierarchical clustering tree as an example, the positions of all gray values ​​in that category on the gray-level image are taken as input. The Delaunay triangulation algorithm is used to obtain a triangular network structure, thus revealing the connections between the positions. Each node in the triangular network structure corresponds to a position. The Euclidean distance between two nodes corresponding to a connecting edge in the triangular network structure is denoted as the edge value. The node density of the 1-N neighborhood of each node in the triangular network structure is calculated as follows:

[0056] Taking any node 'a' in a triangular network graph as an example, nodes directly connected to node 'a' are designated as 1-neighbor nodes, 2-neighbor nodes, 3-neighbor nodes, and so on, up to the 'i'-th neighbor node. Each node can only be considered one neighbor node. The shortest path between the 'i'-th neighbor node and node 'a' is denoted as the 'i'-neighbor distance. This shortest path can be calculated using Dijkstra's algorithm, yielding multiple 'i'-neighbor distances. The average of these distances is denoted as the node density of the 'i'-th neighbor.

[0057] In this way, the node density of the first neighboring region, the node density of the second neighboring region, ..., the node density of the i-th neighboring region, ..., the node density of the N-th neighboring region of node a can be calculated, thus forming a node density sequence. This node density sequence can represent the change in distance between node a and its surrounding nodes as the range expands.

[0058] Similarly, the node density sequence of each node in the triangular network structure can be obtained, and the cosine similarity between any two node density sequences can be calculated. This cosine similarity is called the similarity index between any two nodes, and the mean of all similarity indices is recorded as the uniformity of the position point distribution of the corresponding category in the triangular network structure. It should be understood that when calculating the cosine similarity between any two node density sequences, if the lengths of the two node density sequences are inconsistent, zeros are padded to the end of the last element of the shorter node density sequence to make the lengths of the two node density sequences the same. Furthermore, as another implementation method, other methods can be used to quantify the similarity between the node density sequences of any two nodes to obtain the similarity index between any two nodes; this is not limited here.

[0059] For each category in each layer of the target hierarchical clustering tree, the larger the range of the category's corresponding location points, the greater the impact of the uniformity of the category's location point distribution on the uniformity of the layer's location point distribution. The closer the category's corresponding location points are to the image center, the greater the uniformity of the layer's location point distribution. This is because if a category's location point distribution is relatively uniform but located in a corner of the image, the overall uniformity of the layer's location point distribution is also relatively small. Therefore, while having a relatively large distribution uniformity, the closer the category's corresponding location points are to the image center, the greater the influence weight of that category should be.

[0060] Therefore, based on the distribution of the corresponding category location points in the grayscale image for each category in each layer of the target hierarchical clustering tree, the Graham scan algorithm is used to calculate the largest convex polygon corresponding to all category location points for that category. Then, the ratio of the convex polygon area to the grayscale image area is 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 edge points (i.e., the endpoints on the convex polygon) of the convex polygon corresponding to each category in each layer of the target hierarchical clustering tree are determined. For each convex edge point, the minimum distance *d* between that convex edge point and the grayscale image boundary is calculated. Multiple minimum distances *d* are 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 edge points of the convex polygon corresponding to that category and the grayscale image boundary. The more uniform the distribution of that category is, the closer it is to a uniform distribution around the image center point. Therefore, the more uniform the location point distribution of that layer is, the greater the influence weight needs to be assigned.

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

[0062]

[0063] Where p represents the uniformity of the distribution of location points corresponding to each layer of the target hierarchical clustering tree; a i s represents the first influence weight corresponding to the i-th category in each layer of the target hierarchical clustering tree; i This represents the second influence weight corresponding to the i-th category in each layer of the target hierarchical clustering tree; j i denoted by , 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 the natural constant.

[0064] In the above formula for calculating the uniformity of location point distribution, in each layer of the target hierarchical clustering tree, a larger first influence weight for a certain category indicates a larger distribution range of the category's location points in the grayscale image, and a greater influence on the calculation of the uniformity of location point distribution for that layer. Conversely, a smaller second influence weight indicates a greater consistency in the distance between all convex edge points of the convex polygon corresponding to that category and the grayscale image boundary, and a higher degree of uniformity in the distribution of the category's location points close to the image center, further increasing its influence on the calculation of the uniformity of location point distribution for that layer. By utilizing the uniformity of location point distribution for each category in each layer of the target hierarchical clustering tree, and using the product of the first and second influence weights for each category as the comprehensive weight for the uniformity of location point distribution for each category, the uniformity of location point distribution for each layer of the target hierarchical clustering tree is finally obtained.

[0065] The above method uses the grayscale hierarchical clustering tree as the target hierarchical clustering tree to determine the uniformity of the position point distribution in each layer of the grayscale hierarchical clustering tree. This uniformity characterizes the degree of uniformity of grayscale distribution among corresponding pixels in each layer of the grayscale hierarchical clustering tree; therefore, this uniformity of position point distribution is referred to as grayscale distribution uniformity. Similarly, by using the texture hierarchical clustering tree as the target hierarchical clustering tree, the uniformity of the position point distribution in each layer of the texture hierarchical clustering tree can be obtained. This uniformity characterizes the degree of uniformity of texture distribution among corresponding pixels in each layer of the texture hierarchical clustering tree; therefore, this uniformity of position point distribution is referred to as texture distribution uniformity.

[0066] Step S3: Group the uniformity of the location points of each category in each layer of the gray-level clustering tree to obtain multiple uniformity groups. Based on the number of uniformity groups corresponding to each layer of the gray-level clustering tree and the number of each category in each layer of the texture clustering tree, match each layer of the gray-level clustering tree with each layer of the texture clustering tree to obtain multiple matching layer pairs of the gray-level clustering tree and the texture clustering tree.

[0067] Based on the categories in each layer of the gray-level clustering tree and the uniformity of the distribution of position points in each category, the possible texture distribution can be inferred. Categories with similar uniformity of position point distribution in each layer are more likely to form texture in spatial distribution. If the uniformity of texture distribution in similar layers obtained from the texture is also large, it means that the texture distribution of that layer can describe the texture features well. In this case, using the scale corresponding to the layer as the size of the gray-level co-occurrence matrix to calculate the uniformity of texture distribution can yield a more accurate texture distribution uniformity.

[0068] For each layer of a grayscale hierarchical clustering tree obtained based on the grayscale values ​​of pixels in a grayscale image, each category in that layer corresponds to a uniformity of positional point distribution. The uniformity of positional point distribution for all categories is arranged in ascending order, resulting in an ascending sequence. This ascending sequence is then segmented using the Otsu multi-threshold segmentation method, yielding multiple distribution uniformity groups. Positional point distribution uniformity within the same distribution uniformity group is similar, while the uniformity of positional point distribution in different distribution uniformity groups differs significantly. Distribution uniformity groups with similar positional point distribution uniformity have a higher probability of forming textures. Therefore, the number of distribution uniformity groups is determined, and this number is taken as the number of texture categories corresponding to the grayscale, denoted as N. This number of texture categories represents the number of 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. Based on the number of texture categories corresponding to each layer of the gray-level clustering tree, the corresponding layer is obtained. The texture distribution uniformity of the corresponding layer is then checked. If it is large, the scale information calculated through this layer can better represent the scale of the texture. This scale is then used as the window size of the gray-level co-occurrence matrix to calculate the texture distribution uniformity, which can yield a more accurate texture distribution uniformity.

[0069] Therefore, the matching layer pairs of the gray-level clustering tree and the texture-level clustering tree are calculated using the Kuhn-Munkres Algorithm (KM). Existing KM algorithms calculate one-to-one matching between left and right nodes. In this embodiment, each layer of the gray-level clustering tree is taken as the left node, and the number of texture categories N (i.e., the number of uniform distribution groups) in that layer is taken as the node value. Each layer of the texture-level clustering tree is taken as the right node, and the number of categories in that layer is taken as the node value. Each left node is connected to all right nodes by an edge, and the edge value of each edge is the ratio of the smaller to the larger value of the corresponding two node values. Through KM matching, one-to-one matching between left and right nodes can be obtained. Each one-to-one matching constitutes a matching layer pair, thus obtaining multiple matching layer pairs of the gray-level clustering tree and the texture-level clustering tree.

[0070] Step S4: Based on the uniformity of the distribution of position points 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, determine the selectivity index of each matching layer pair, and based on the selectivity index, determine the target layer of the texture hierarchy clustering tree, and based on the texture value of the corresponding pixel points of each category in the target layer of the texture hierarchy clustering tree in the grayscale image, determine the window size of the gray-level co-occurrence matrix, and perform mixing uniformity detection based on the window size of the gray-level co-occurrence matrix and the grayscale image.

[0071] Based on the uniformity of the location points of each category in each layer of the gray-level clustering tree, the uniformity of the gray-level distribution of each layer of the gray-level clustering tree is determined. Similarly, based on the uniformity of the location points of each category in each layer of the texture-level clustering tree, the uniformity of the texture distribution of each layer of the texture-level clustering tree is determined. Since the steps for determining the uniformity of the gray-level distribution of each layer of the gray-level clustering tree and the uniformity of the texture distribution of each layer of the texture-level clustering tree have already been described in detail in step S2 above, they will not be repeated here.

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

[0073]

[0074] Wherein, P represents the selectivity index of each matching layer pair of gray-level clustering tree and texture-level clustering tree; p1 represents the gray-level distribution uniformity of the corresponding layer of gray-level clustering tree in each matching layer pair of gray-level clustering tree and texture-level clustering tree; p2 represents the texture distribution uniformity of the corresponding layer of texture-level clustering tree in each matching layer pair of gray-level clustering tree and texture-level clustering tree; P0 represents the distribution uniformity threshold, which can be reasonably set as needed. In this embodiment of the invention, P0 = 0.7.

[0075] In the above formula for calculating the selectivity index, when the gray-scale distribution uniformity of the matching layer is large, it may be because the colors of different water-soluble fertilizer production raw materials are similar. In this case, more information needs to be obtained through the texture distribution uniformity to determine the mixing situation. When the gray-scale distribution uniformity is small, it can be directly indicated that the mixing uniformity is poor and further mixing is required. At this time, the corresponding selectivity index is determined by the gray-scale distribution uniformity.

[0076] After determining the selectivity indices of each matching layer pair in the gray-level and texture-level clustering trees using the methods described above, the maximum selectivity index among all matching layer pairs can be determined. This allows us to identify the matching layer pair corresponding to the maximum selectivity index. Since each matching layer pair corresponds to one layer in the gray-level clustering tree and one layer in the texture-level clustering tree, the layer in the texture-level clustering tree corresponding to the matching layer pair with the maximum selectivity index is denoted as the target layer. After obtaining the target layer of the texture-level clustering tree, the window size of the gray-level co-occurrence matrix needs to be determined based on the target layer. This can be obtained from the distribution pattern of the minimum texture category.

[0077] Based on the texture values ​​of pixels in the grayscale image, these texture values ​​are used as the pixel values ​​of the pixels in the image, thus obtaining the texture image. According to each category in the target layer of the texture hierarchy clustering tree, the pixel distribution of each category in the grayscale image can be obtained. The minimum bounding rectangle of the pixels for each category is obtained through a convex hull detection algorithm. The pixel values ​​of the pixels in the texture image for each rectangular region are Fourier transformed to obtain the spectrum image of the corresponding rectangular region. The reciprocal of the frequency corresponding to the point with the maximum grayscale value in the spectrum image is used as the candidate window size of a gray-level co-occurrence matrix (GLCM) for each category in the target layer of the texture hierarchy clustering tree. The minimum value among the candidate GLCM window sizes for each category in the target layer of the texture hierarchy clustering tree is used as the window size of the gray-level co-occurrence matrix. This window size of the gray-level co-occurrence matrix is ​​the optimal texture size.

[0078] After determining the window size of the gray-level co-occurrence matrix (GLCM), a region window is determined for each pixel in the gray-level image, centered on the window size of the GLCM. Based on the gray values ​​of the pixels within the region window, the corresponding GLCM at a set angle is determined. In this embodiment, the set angle is set to 0°. However, in other implementations, this set angle can be set to 45°, 90°, etc. The energy of the GLCM is calculated. Energy reflects the uniformity of the image's gray-level distribution and the coarseness of its texture. Higher energy indicates a more uniform gray-level distribution, while lower energy indicates a more concentrated gray-level distribution. The energy of the GLCM is used as the feature value of the pixel in the gray-level image corresponding to the region window. This feature value is then used as the pixel value of the pixel in the gray-level image, thus obtaining a feature value image. Based on this feature value image, the mixing uniformity index of the gray-level image can be determined. The corresponding calculation formula is as follows:

[0079]

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

[0081] In the above formula for calculating the uniformity of mixing index, the mean eigenvalue of all pixels in the feature image is calculated. The larger the mean eigenvalue, the more uniform the gray-level distribution in the corresponding gray-level image, and the higher the uniformity of mixing index. Simultaneously, the variance of the eigenvalues ​​of all pixels in the feature image is calculated. This variance reflects the consistency of the eigenvalues; the smaller the variance, the better the consistency of the eigenvalues, and the better the performance of using the mean eigenvalue to represent the uniformity of mixing index.

[0082] A mixing uniformity threshold is preset. The value of the mixing uniformity threshold can be reasonably set as needed. In this embodiment of the invention, the value of the mixing uniformity threshold is set to 0.9. After 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. At this time, stirring needs to continue until the mixing uniformity index is greater than or equal to the mixing uniformity threshold, and then stirring is stopped.

[0083] Compared to existing technologies that calculate the gray-level co-occurrence matrix using a fixed-size window to obtain mixing uniformity, which is difficult to adapt well to actual situations and results in low uniformity detection accuracy, this invention uses gray-level value hierarchical clustering and local window texture feature hierarchical clustering, and analyzes the results of the two clustering methods to obtain the optimal texture scale. Then, it calculates the mixing uniformity using the gray-level 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 embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit them. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of this application, and should all be included within the protection scope of this application.

Claims

1. A visual inspection method for the mixing uniformity of raw materials in water-soluble fertilizer production, characterized in that, Includes the following steps: A grayscale image of a mixture image is obtained, and the grayscale values ​​of the pixels in the grayscale image are hierarchically clustered to obtain a grayscale hierarchical clustering tree. The texture values ​​of the pixels in the grayscale image are determined, and the texture values ​​of the pixels in the grayscale image are hierarchically clustered to obtain a texture hierarchical clustering tree. Both the gray-level clustering tree and the texture-level clustering tree are used as a target hierarchical clustering tree. Based on the position of the corresponding pixel in the gray-level image for each category in each layer of the target hierarchical clustering tree, the uniformity of the position point distribution of each category in each layer of the target hierarchical clustering tree is determined. The uniformity of the location points of each category in each layer of the gray-level hierarchical clustering tree is grouped to obtain multiple uniformity groups. Based on the number of uniformity groups corresponding to each layer of the gray-level hierarchical clustering tree and the number of each category in each layer of the texture hierarchical clustering tree, each layer of the gray-level hierarchical clustering tree is matched with each layer of the texture hierarchical clustering tree to obtain multiple matching layer pairs of gray-level hierarchical clustering tree and texture hierarchical clustering tree. 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, the selectivity index of each matching layer pair is determined. Based on the selectivity index, the target layer of the texture hierarchy clustering tree is determined. Based on the texture value of the corresponding pixel point of each category in the target layer of the texture hierarchy clustering tree in the grayscale image, the window size of the gray-level co-occurrence matrix is ​​determined. Based on the window size of the gray-level co-occurrence matrix and the grayscale image, mixing uniformity detection is performed.

2. The visual inspection method for the mixing uniformity of raw materials in water-soluble fertilizer production according to claim 1, characterized in that, Determine the uniformity of the location point distribution for each category in each layer of the target hierarchical clustering tree, including: Based on the position of the corresponding pixel in the grayscale image for each category in each layer of the target hierarchical clustering tree, a triangular network structure is determined, wherein each node in the triangular network structure corresponds to the position point of a pixel. Based on the positional distribution of each node in the triangular network structure, determine the node density sequence of each node in the triangular network structure; Calculate the similarity index of the node density sequence of any two nodes in the triangular network structure, and determine the average value of all the similarity indices as the uniformity of the location point distribution of each category in each layer of the target hierarchical clustering tree.

3. The visual inspection method for the mixing uniformity of raw materials in water-soluble fertilizer production according to claim 1, characterized in that, Multiple matching layer pairs are obtained for the grayscale hierarchical clustering tree and the texture hierarchical clustering tree, including: Each layer of the gray-level hierarchical clustering tree is taken as the left node, and the number of distribution uniformity groups corresponding to each layer of the gray-level hierarchical clustering tree is taken as the node value of the corresponding left node. Each layer of the texture hierarchy clustering tree is taken as the right node, and the number of each category in each layer of the texture hierarchy clustering tree is taken 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 corresponding two node values. Based on the edge value of the connection between any left node and any right node, perform one-to-one matching on all left and right nodes to obtain multiple matching layer pairs of gray-level clustering trees and texture-level clustering trees.

4. The visual inspection method for the mixing uniformity of raw materials in water-soluble fertilizer production according to claim 1, characterized in that, Determine the selectivity index for each of the matching layer pairs, including: Based on the position of the corresponding pixel in the grayscale image for each category in each layer of the target hierarchical clustering tree, determine the largest convex polygon corresponding to the position. Based on the area ratio of the convex polygon corresponding to each category in each layer of the target hierarchical clustering tree in the grayscale image, determine the first influence weight corresponding to each category in each layer of the target hierarchical clustering tree; Determine the minimum distance from each convex edge point of the convex polygon corresponding to each category in each layer of the target hierarchical clustering tree to the grayscale image boundary, and determine the second influence weight corresponding to each category in each layer of the target hierarchical clustering tree based on the discreteness of all the minimum distances; Based on the first influence weight, second influence weight, and uniformity of location point distribution for each category in each layer of the target hierarchical clustering tree, determine the uniformity of location point distribution for each layer of the target hierarchical clustering tree. The uniformity of the distribution of position points corresponding to each layer of the gray-level clustering tree is taken as the uniformity of gray-level distribution corresponding to each layer of the gray-level clustering tree, and the uniformity of the distribution of position points corresponding to each layer of the texture-level clustering tree is taken as the uniformity of texture distribution corresponding to each layer of the texture-level clustering tree. Based on the uniformity of grayscale distribution of the layer corresponding to the grayscale hierarchical clustering tree and the uniformity of texture distribution of the layer corresponding to the texture hierarchical clustering tree in each of the matching layer pairs, the selectability index of each matching layer pair is determined.

5. The visual inspection method for the mixing uniformity of raw materials in water-soluble fertilizer production according to claim 4, characterized in that, The formula for calculating the uniformity of the location points at each level of the target hierarchical clustering tree is as follows: Where p represents the uniformity of the distribution of location points corresponding to each layer of the target hierarchical clustering tree; a i s represents the first influence weight corresponding to the i-th category in each layer of the target hierarchical clustering tree; i This represents the second influence weight corresponding to the i-th category in each layer of the target hierarchical clustering tree; j i denoted by , 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 the natural constant.

6. The visual inspection method for the mixing uniformity of raw materials in water-soluble fertilizer production according to claim 4, characterized in that, The selectivity index for each of the matching layer pairs is determined by the following formula: Where P represents the selectivity index of each matching layer pair of gray-level hierarchical clustering tree and texture hierarchical clustering tree; p1 represents the gray-level distribution uniformity of the layer corresponding to the gray-level hierarchical clustering tree in each matching layer pair of gray-level hierarchical clustering tree and 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 gray-level hierarchical clustering tree and texture hierarchical clustering tree; and P0 represents the distribution uniformity threshold.

7. The visual inspection method for the mixing uniformity of raw materials in water-soluble fertilizer production according to claim 1, characterized in that, Determine the target layer of the texture hierarchy clustering tree, including: Determine the maximum selectivity index among the selectivity indices of each matching layer pair, and determine the layer corresponding to the matching layer pair with the maximum selectivity index in the texture hierarchy clustering tree as the target layer of the texture hierarchy clustering tree.

8. The visual inspection method for the mixing uniformity of raw materials in water-soluble fertilizer production according to claim 1, characterized in that, Determine the window size of the gray-level co-occurrence matrix, including: The minimum bounding rectangle of each category in the target layer of the texture hierarchy clustering tree corresponding to the pixel in the grayscale image is determined. The texture values ​​of all pixels in the minimum bounding rectangle are subjected to Fourier transform to obtain a spectrum image. Based on the reciprocal of the frequency corresponding to the point with the maximum grayscale value in the spectrum image, the candidate window size of the grayscale co-occurrence matrix corresponding to each category in the target layer of the texture hierarchy clustering tree is determined. 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 hierarchy clustering tree is used as the window size of the gray-level co-occurrence matrix.

9. The visual inspection method for the mixing uniformity of raw materials in water-soluble fertilizer production according to claim 1, characterized in that, Perform mixing uniformity testing, including: Centered on each pixel in the grayscale image, and with the window size of the grayscale co-occurrence matrix as the window size, a region window for each pixel in the grayscale image is determined. Based on the grayscale values ​​of the pixels in the region window, the grayscale co-occurrence matrix corresponding to the region window at a set angle is determined, and the energy of the grayscale co-occurrence matrix is ​​determined. Based on the magnitude 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 visual inspection method for the mixing uniformity of raw materials in water-soluble fertilizer production according to claim 1, characterized in that, Multiple distribution uniformity groups were obtained, including: The uniformity of the location points of each category in each layer of the gray-level 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