Disclosure of Invention
The invention aims to solve the technical problem of providing an on-line detection method and device for material mixing uniformity, which can realize accurate and reliable detection of mixing uniformity of different materials.
In order to solve the technical problems, the technical scheme of the invention is as follows:
in a first aspect, a method for online detecting uniformity of material mixing, the method comprising:
acquiring an image of a material to be detected;
thresholding the image of the material to be detected to extract white point particles in the material;
calculating the enveloping area of white dot particles and calculating the area of the whole material image to be detected;
calculating the area ratio of the white point particles according to the enveloping area of the white point particles and the area of the whole material image to be detected, and determining the center point of the image;
calculating the average value and standard deviation of the distances from all white point particles to the center point;
Judging that if the Euclidean distance from the white point particles to the center point is not less than the dynamic threshold value according to the preset dynamic threshold value and the average value and standard deviation of the distances from all the white point particles to the center point, taking the dynamic threshold value as the Euclidean distance of the white point particles, and carrying out weighted average on the adjusted Euclidean distance to obtain an average distance;
and calculating the mixing uniformity of the materials according to the area ratio and the average distance of the white dot particles.
Further, thresholding is carried out on the image of the material to be detected, white point particles in the material are extracted, and the method comprises the following steps:
converting the material image to be detected into a gray image;
calculating the integral pixel value distribution of the gray image and determining the threshold valueT;
Binarizing the gray level image, and making the pixel value not less than threshold valueTIs set to be white, and the pixel value is less than the threshold valueTSetting the pixel point of (2) to be black;
and performing open operation on the binarized image, judging the connected domains of the white pixel points by connecting adjacent pixels, and marking each connected domain as a white dot particle.
Further, calculating the envelope area of the white dot particles and calculating the area of the whole material image to be detected includes:
calculating the outline perimeter of the white point particles according to each extracted white point particle;
Performing convex hull operation on the outline circumferences of all the particles to obtain convex hull outlines of white-point particles;
calculating the area surrounded by the convex hull outline, wherein the area surrounded by the convex hull outline is the enveloping area of the white dot particles;
and accumulating the envelope areas of all the white dot particles to obtain the total envelope area of the white dot particles.
Further, calculating the area occupation ratio of the white dot particles according to the enveloping area of the white dot particles and the area of the whole material image to be detected, and determining the center point of the image, wherein the method comprises the following steps:
processing the original image to obtain a smooth image;
detecting the edge of the smooth image, and carrying out connected domain analysis on the detected edge to obtain each connected region;
calculating convex hulls for each connected region to obtain a plurality of convex hull contours of the image;
calculating all convex hull contour areas, and determining the area of the whole image according to all the convex hull contour areas;
calculating the area of white dot particles according to the area of the whole image;
and calculating weighted average coordinates of the centroids as a center point by using the barycenter coordinates of all the white point particles according to the areas of the white point particles.
Further, calculating the average and standard deviation of all white point particles to center point distances includes:
Clustering all white dot particles;
respectively calculating Euclidean distance from white point particles in each cluster to the centroid of each cluster, and removing outliers for white point particle distances in each cluster;
calculating the average value and standard deviation of the distances of the white point particles in each class after outliers are removed;
calculating the weight of the total number of the white point particles in each type;
and weighting and averaging the average distance and the standard deviation in each class to obtain the average value and the standard deviation of the distances from all white point particles to the center point.
Further, according to a preset dynamic threshold value, and an average value and a standard deviation of distances from all white point particles to a central point, judging that if the Euclidean distance from the white point particles to the central point is not less than the dynamic threshold value, taking the dynamic threshold value as the Euclidean distance of the white point particles, and carrying out weighted average on the adjusted Euclidean distance to obtain an average distance, wherein the method comprises the following steps:
according to the average value of Euclidean distances from all white point particles to a central pointμAnd standard deviation sigma, setting dynamic thresholdT 1 =μ+ k×σ;
According to each white dot particleiEuclidean distance to center pointd i Determining the Euclidean distanced i And dynamic thresholdT 1 If the Euclidean distance is related tod i Not less than dynamic thresholdT 1 Updating the Euclidean distance of the white point particles to be a dynamic threshold value T 1 If Euclidean distanced i <Dynamic thresholdT 1 The original Euclidean distance of the white point particles is kept unchanged;
euclidean distance after updating all white point particlesd i ' byPerforming operation to obtain an adjusted average distanceD',nAs the total number of white point particles,S i is the firstiArea of individual white dot particles.
Further, according to the area ratio and the average distance of the white dot particles, the mixing uniformity of the materials is calculated, and the method comprises the following steps:
according to the area ratio and the average distance of white dot particles, byThe uniformity of the mixture was calculated, wherein,nfor the number of clusters to be counted,R i is the firstiJudging result of each cluster,/>Is the firstiWeights of the clusters, wherein +.>。
In a second aspect, an on-line detection device for mixing uniformity of materials includes:
the acquisition module is used for acquiring an image of the material to be detected; thresholding the image of the material to be detected to extract white point particles in the material; calculating the enveloping area of white dot particles and calculating the area of the whole material image to be detected; calculating the area ratio of the white point particles according to the enveloping area of the white point particles and the area of the whole material image to be detected, and determining the center point of the image;
the processing module is used for calculating the average value and standard deviation of the distances from all white point particles to the center point; judging that if the Euclidean distance from the white point particles to the center point is not less than the dynamic threshold value according to the preset dynamic threshold value and the average value and standard deviation of the distances from all the white point particles to the center point, taking the dynamic threshold value as the Euclidean distance of the white point particles, and carrying out weighted average on the adjusted Euclidean distance to obtain an average distance; and calculating the mixing uniformity of the materials according to the area ratio and the average distance of the white dot particles.
In a third aspect, a computing device includes:
one or more processors;
and a storage device for storing one or more programs which, when executed by the one or more processors, cause the one or more processors to implement the above-described methods.
In a fourth aspect, a computer readable storage medium stores a program that when executed by a processor implements the above method.
The scheme of the invention at least comprises the following beneficial effects:
the scheme of the invention realizes real-time on-line monitoring of the material mixing process, can dynamically detect the mixing uniformity, timely feed back the mixing effect, adjust the process parameters and is beneficial to closed-loop control of the production process; the sample characteristics are extracted through image processing, so that random errors caused by manual sampling are avoided, and the detection accuracy and reliability are improved; the enveloping area of the white dot particles is calculated to effectively reflect the distribution condition of the components, the distance distribution reflects the aggregation degree, and the combination of the two can comprehensively evaluate the mixing uniformity; and the dynamic threshold adjustment distance calculation is set, so that the anti-interference capability of the calculation is improved, and the detection result is more accurate and reliable. The invention realizes the intellectualization and automation of the mixing uniformity detection and greatly improves the detection efficiency.
Detailed Description
Exemplary embodiments of the present disclosure will be described more closely below with reference to the accompanying drawings. While exemplary embodiments of the present disclosure are shown in the drawings, it should be understood that the present disclosure may be embodied in various forms and should not be limited to the embodiments set forth herein. Rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the scope of the disclosure to those skilled in the art.
As shown in fig. 1, an embodiment of the present invention provides an online detection method for mixing uniformity of materials, where the method includes:
step 11, acquiring a material image to be detected;
step 12, thresholding is carried out on the image of the material to be detected, and white dot particles in the material are extracted;
step 13, calculating the enveloping area of white dot particles and calculating the area of the whole material image to be detected;
step 14, calculating the area occupation ratio of the white point particles according to the enveloping area of the white point particles and the area of the whole material image to be detected, and determining the center point of the image;
Step 15, calculating the average value and standard deviation of the distances from all white point particles to the center point;
step 16, judging that if the Euclidean distance from the white point particles to the center point is not less than the dynamic threshold value according to the preset dynamic threshold value and the average value and standard deviation of the distances from the white point particles to the center point, taking the dynamic threshold value as the Euclidean distance of the white point particles, and carrying out weighted average on the adjusted Euclidean distance to obtain an average distance;
and step 17, calculating the mixing uniformity of the materials according to the area ratio and the average distance of white dot particles.
In the embodiment of the invention, the real-time on-line monitoring of the material mixing process is realized, the mixing uniformity can be dynamically detected, the mixing effect can be fed back in time, the process parameters can be adjusted, and the closed-loop control of the production process is facilitated; the sample characteristics are extracted through image processing, so that random errors caused by manual sampling are avoided, and the detection accuracy and reliability are improved; the enveloping area of the white dot particles is calculated to effectively reflect the distribution condition of the components, the distance distribution reflects the aggregation degree, and the combination of the two can comprehensively evaluate the mixing uniformity; and the dynamic threshold adjustment distance calculation is set, so that the anti-interference capability of the calculation is improved, and the detection result is more accurate and reliable. The invention realizes the intellectualization and automation of the mixing uniformity detection and greatly improves the detection efficiency.
In a preferred embodiment of the present invention, the step 12 may include:
step 121, converting the material image to be detected into a gray image;
step 122, calculating the overall pixel value distribution of the gray image, and determining the threshold valueT;
Step 123, binarizing the gray level image, and making the pixel value not less than the threshold valueTIs set to be white, and the pixel value is less than the threshold valueTSetting the pixel point of (2) to be black;
and 124, performing an open operation on the binarized image, judging connected domains of the white pixel points by connecting adjacent pixels, and marking each connected domain as a white dot particle.
In the embodiment of the invention, the color image is converted into the gray image, so that the color interference can be reduced, and the image processing is simpler and more reliable. And calculating pixel value distribution to determine a proper threshold value, realizing self-adaptive threshold segmentation and improving the accuracy of white point particle extraction. The binarization process can effectively extract white dot particles and background. The open operation can smooth the target, remove small noise points, and enable the extraction result to be more accurate. The connected domain analysis can effectively judge each independent white dot particle, lays a foundation for calculating particle characteristic parameters, improves the reliability and accuracy of white dot particle extraction, ensures that a mixing uniformity detection algorithm is more perfect and intelligent, and improves detection performance. Through detailed splitting of the steps, the effect of each image processing module is improved, and finally, accurate detection of the mixing uniformity can be better realized.
In another preferred embodiment of the present invention, the step 121 may include: and reading an input color image, calculating the numerical values of three channels of red R, green G and blue B of each pixel point of the image, calculating the gray value of each pixel according to the formula gray=0.299R+0.587G+0.114×B, and forming a new gray image by using all the gray values of the pixels. The step 122 may include: and counting the histogram distribution of gray values of all pixels of the image, analyzing the histogram, and determining the gray value corresponding to the peak value as a first threshold value. The step 123 may include: and traversing all pixel points of the image, setting 255 (white) if the gray value of the current pixel is larger than or equal to a first threshold value, setting 0 (black) if the gray value of the current pixel is smaller than the first threshold value, and storing the processed binary image. The step 124 may include: and (3) performing open operation on the binary image by using 3X 3 square frame structural elements, analyzing connectivity of adjacent pixels, marking different connected domains by different numbers, and calculating the number of pixels of each connected domain to serve as the size of white dot particles.
In a preferred embodiment of the present invention, the step 13 may include:
step 131, calculating the outline perimeter of the white point particles according to each extracted white point particle;
Step 132, performing convex hull operation on the outline circumferences of all particles to obtain convex hull outlines of white-point particles;
step 133, calculating an area surrounded by the convex hull outline, wherein the area surrounded by the convex hull outline is the enveloping area of the white dot particles;
and step 134, accumulating the envelope areas of all the white point particles to obtain the total envelope area of the white point particles.
In the embodiment of the invention, the outline perimeter of each white dot particle is calculated, so that the boundary information of the particle can be accurately obtained; small protrusions of the grain boundary can be eliminated by performing convex hull operation, so that the envelope area is more accurate; the envelope area is calculated by utilizing the convex hull outline, so that the area size can be automatically and efficiently obtained. The envelope areas of all particles are accumulated, and the total white point particle envelope area can be correctly counted. The accuracy of envelope area calculation is improved, and effective support is provided for subsequent area analysis based mixing uniformity. The mixing uniformity detection system is more intelligent and automatic in the aspect of calculating the envelope area, and is beneficial to optimizing and debugging algorithms so as to improve detection performance. Through step splitting, each detail of envelope area calculation is defined, so that more accurate and reliable characteristics can be obtained, and the overall effect of mixing uniformity detection is improved.
In another preferred embodiment of the present invention, the step 131 may include: by passing throughCalculating outline perimeter of white dot particlesL i Wherein->Is a dynamic weight that is based on the weight of the model,the method is a contour point, and the weight can be determined according to the curvature of the contour point, so that the calculation is more accurate. The step 132 may include: the convex bag is provided withn 2 Multiple verticesv i By->Calculating the convex hull contour perimeter of the white dot particles>Wherein, the method comprises the steps of, wherein,a i is a dynamic weight coefficient. The step 133 may include: according to the outline perimeter of convex hull of white dot particlesBy->Calculating the area surrounded by the outline of the convex hullWherein->Is a dynamic weight. The step 134 may include: by->Calculate the sum of all white point particle envelope areas +.>Wherein->Is the firstiDynamic weight of the individual white dot particles, +.>Indicating the total number of white dot particles.
In a preferred embodiment of the present invention, the step 14 may include:
step 141, processing the original image to obtain a smooth image;
step 142, detecting the edge of the smooth image, and performing connected domain analysis on the detected edge to obtain each connected region;
step 143, calculating convex hulls for each connected region to obtain a plurality of convex hull contours of the image;
Step 144, calculating all the convex hull outline areas, and determining the area of the whole image according to all the convex hull outline areas;
step 145, calculating the area of white point particles according to the area of the whole image;
and 146, calculating weighted average coordinates of the centroids as a center point by using the barycenter coordinates of all the white point particles according to the areas of the white point particles.
In the embodiment of the invention, the image noise can be removed by processing the image, so that the edge detection is more reliable; the connected domain analysis and the computation of the convex hull can effectively acquire the whole outline area of the image; calculating the outline area of the convex hull and taking the maximum value, and automatically acquiring the total area of the image; the calculation of the area occupation ratio can be realized by combining the calculation proportion of the areas of white point particles; calculating a weighted center point by using the barycenter coordinates, so that the center point determination is more robust; the accuracy and the reliability of area and center point calculation are improved; the mixing uniformity detection system is more intelligent in calculating key characteristics. Through the clear calculation step, more accurate area and center point characteristics can be obtained, so that the effect of detecting the mixing uniformity is improved.
In another preferred embodiment of the present invention, the step 141 may include: by passing through To the original imageI(x,y) Gaussian filtering is carried out to obtain a smooth imageI′(x,y) Wherein->Is the standard deviation of the gaussian kernel. The step 142 may include: detecting the smoothed imageI′(x,y) The detected edge point set is set as {x i ,y i ) Performing connected domain marking to obtain connected domainΩ k . The step 143 may include: for each communication regionΩ k Calculating convex hulls and passingCalculating outline area +_>Wherein->Represent the firstqThe number of the convex hulls of the connected areas,qan index indicating the connected region is provided,qirepresent the firstqThe first connecting area is arranged on the convex hulliA point. The step 144 may include: according to the outline area ∈>By->Calculating the total area +.>,Representing the total number of convex hull contours. The step 145 may include: from calculating the total area of the imageS 3 And the number of white dot particles +.>The white point particles are distributed uniformly, the area of each white point particle is approximately the same, wherein the area of each white point particle can be estimated as +.>,/>The method comprises the steps of carrying out a first treatment on the surface of the Wherein,S i is the firstiArea of individual white dot particles. The step 146 may include: calculating the center point coordinates from the area of each white dot particle>Wherein, the method comprises the steps of, wherein,,/>,x i is the firstiOf particles of white spotsxThe coordinates of the two points of the coordinate system, y i Is the firstiOf particles of white spotsyCoordinates.
In a preferred embodiment of the present invention, the step 15 may include:
step 151, clustering all white dot particles;
step 152, respectively calculating the Euclidean distance from the white point particles in the class to the centroid of the class for each cluster, and removing outliers for the white point particle distance in each class;
step 153, calculating an intra-class distance average value and a standard deviation for each class of white point particle distances after outliers are removed;
step 154, calculating the weight of the total number of the white point particles in each type;
step 155, the average distance and standard deviation in each class are weighted and averaged to obtain the average value and standard deviation of the distances from all white point particles to the center point.
In the embodiment of the invention, all white point particles are clustered, and the white point particles can be grouped according to the distribution condition of the white point particles, so that statistics is more targeted; the distance statistics inside each cluster is calculated, so that the influence of individual outliers on the overall statistics can be reduced; the outlier distance inside the clusters is removed, so that the interference of abnormal data can be removed; different weights are given to clusters according to the number of samples, so that the statistical result can be more objective and accurate; the invention improves the anti-interference capability and reliability of distance distribution statistics, and can obtain more accurate and reliable distance distribution characteristics through grouping statistics and multistage processing, thereby improving the effect of detecting the mixing uniformity.
In another preferred embodiment of the present invention, the step 151 may include: step 151: particle aggregation of white spotsClustering, setting the clustering number asK 3 ThenWherein->Representing parameters->Is the firstk 3 Mixing coefficients of classes, < >>And->Respectively the firstk 3 Mean vector and covariance matrix of classes. The steps are as above152, may include: for the firstk 3 Class, calculate each samplex i To class center->Distance of->Wherein->The distance is truncated to obtain a truncated distance +.>. The step 153 may include: first->Average value of distance after class truncation->And standard deviation->Wherein->,/>. The step 154 may include: by->Calculate->The weight of the class. The step 155 may include: by->Calculating the overall average distance of the weighted average +.>And byCalculate the total standard deviation of the weighted average +.>。
In a preferred embodiment of the present invention, the step 16 may include:
step 161, according to the average value of Euclidean distances from all white point particles to the center pointμAnd standard deviation sigma, setting dynamic thresholdT 1 =μ+ k×σ;
Step 162, according to each white point particleiEuclidean distance to center pointd i Determining the Euclidean distanced i And dynamic thresholdT 1 If the Euclidean distance is related to d i Not less than dynamic thresholdT 1 Updating the Euclidean distance of the white point particles to be a dynamic threshold valueT 1 If Euclidean distanced i <Dynamic thresholdT 1 The original Euclidean distance of the white point particles is kept unchanged;
step 163, updated Euclidean distance for all white point particlesd i ' byPerforming operation to obtain an adjusted average distanceD',nAs the total number of white point particles,S i is the firstiArea of individual white dot particles.
In the embodiment of the invention, the dynamic threshold is set according to the overall distance distribution condition, so that the dynamic threshold is set more adaptively, the distances exceeding the dynamic threshold are truncated, the influence of individual outliers on the result can be effectively inhibited, the original distances which do not exceed the dynamic threshold are reserved, and the effective information is kept to the greatest extent. The processed distances are weighted and averaged, so that the result is more reliable, the anti-interference capability of distance distribution statistics on abnormal values is improved, and the mixing uniformity detection system has more intelligent and anti-interference capability in distance calculation. By setting dynamic threshold regulation distance calculation, more accurate and reliable distance characteristics can be obtained, so that the effect of detecting the mixing uniformity is improved.
In a preferred embodiment of the present invention, the step 17 may include:
Step 171, according to the area ratio and average distance of the white point particles, passingThe uniformity of the mixture was calculated, wherein,nfor the number of clusters to be counted,R i is the firstiJudging result of each cluster,/>Is the firstiWeights of the clusters, wherein +.>。
In the embodiment of the invention, the local information of different clusters is utilized for comprehensive judgment, so that the result is more comprehensive and accurate, independent judgment standards are set for each cluster, the flexibility is improved, different weights are given according to the number of the clustered samples, the judgment is more objective and reliable, the area occupation ratio reflects the dispersion degree, the distance reflects the aggregation degree, the combination of the two can well evaluate the mixing uniformity, the intelligent level of the mixing uniformity calculation is improved, the mixing uniformity detection is more sensitive to the component distribution change, the key factors influencing the mixing uniformity are beneficial to finding, and the process improvement is guided.
In another preferred embodiment of the present invention, after the step 17, the method further includes:
step 18, establishing a mixing uniformity evaluation model, which specifically comprises the following steps: sample images under different mixing proportions and raw material group distribution schemes are obtained, mixing uniformity marking data of the sample images are obtained, a convolutional neural network deep learning model is used, the mixing uniformity marking is used as a label by taking the area ratio and the average distance as characteristics, a mixing uniformity evaluation model is trained, a mixing uniformity prediction model is obtained, characteristics of a new sample can be input, and mixing uniformity prediction is output.
Step 19, closed loop control, specifically including: setting a target value of mixing uniformity, detecting real-time mixing uniformity on line, comparing the detected value with the target value, designing a PID or self-adaptive controller, and regulating the operation parameters (rotating speed, stirring force and the like) of the mixer in real time according to the control quantity output by the controller to realize closed-loop feedback control of the mixing uniformity; the result evaluation specifically comprises: comparing the mixing uniformity detection results under different process parameters, evaluating the influence of the parameters on the mixing uniformity, determining key process parameters of the mixing uniformity, analyzing the correlation between the mixing uniformity and the quality of the product, establishing a quality prediction model, and comprehensively determining the optimal mixing process scheme with excellent quality and low energy consumption.
In another preferred embodiment of the present invention, the step 18 may include:
step 181, acquiring material sample images acquired at different moments in the mixing process as data sets, wherein the number of the material sample images is at least 500; independently scoring the mixing uniformity of each sample image, wherein the scoring standard is 1-5 minutes, and 5 minutes indicates that the mixing is most uniform; taking the grading average value of each image as the mixing uniformity of the image; calculating the area occupation ratio and the average distance of each image as feature vectors; constructing a convolutional neural network model, wherein the convolutional neural network model comprises a convolutional layer, a pooling layer and a full-connection layer, the input is a feature vector, the output is a predicted value of the mixing uniformity, the mean square error is used as a loss function, and an Adam optimizer is adopted to train the network model; the network structure and the super parameters are determined through cross verification, a mixing uniformity prediction model is obtained, and the mixing uniformity can be predicted by inputting a feature vector to a new sample; conversion of the output value to 1-5 bins represents the predicted blend uniformity rating.
In another preferred embodiment of the present invention, the step 19 may include:
step 191, determining a target value of the mixing uniformity according to the product quality requirement, for example, setting to be 4 minutes; in the mixing process, an image of the current mixed material is acquired by an online detection system at regular time intervals (for example, 1 minute), and the mixing uniformity is detected; comparing the detected current mixing uniformity value with a target value; calculating the control quantity output by the controller according to a preset PID controller, and sending a control instruction according to the control quantity to adjust parameters such as the rotating speed, stirring force and the like of the mixer, so that closed-loop feedback control is formed, and the mixing uniformity is converged to a target value; the method comprises the steps of obtaining detection data under parameters of different stirring speeds and stirring time, analyzing the influence of the parameters on uniformity through an analysis of variance method, finding out the most critical parameters, determining the relation between the mixing uniformity and the product quality index through correlation analysis and the like, establishing a quality prediction model, predicting the product quality by given uniformity, comprehensively considering quality requirements and energy consumption indexes, and determining the optimal parameter combination.
In another preferred embodiment of the invention, the control quantity output by the controller is calculated according to a preset PID controller, and the parameters such as the rotating speed, stirring force and the like of the mixer are regulated according to the control quantity transmission control instruction, so that closed-loop feedback control is formed, and the mixing uniformity is converged to the target value; obtaining detection data under parameters of different stirring speeds and stirring time, analyzing the influence of the parameters on uniformity by a variance analysis method, finding out the most critical parameters, determining the relation between the mixing uniformity and a product quality index by utilizing correlation analysis and the like, establishing a quality prediction model, predicting the product quality by given uniformity, comprehensively considering quality requirements and energy consumption indexes, and determining the optimal parameter combination, wherein the method comprises the following steps of:
Acquiring mixing uniformity data under different process parameter combinations as a training set of closed-loop control, wherein the training set comprises parameters such as stirring speed, stirring time, raw material proportion and the like; using PID controller class in Python, according to training set data training to determine proportion, integral and differential coefficient of PID controller; in the mixing process, the current mixing uniformity is obtained at regular intervals and is used as a feedback signal to be input into a PID controller; the PID controller calculates the control quantity, sends a control instruction to adjust the stirring speed, enables the mixing uniformity to be converged to a set target value, obtains the product quality data after the mixing is finished, and establishes a linear regression model between the mixing uniformity and the product quality; calculating a required mixing uniformity target value through a regression model according to the product quality requirement; analyzing the influence of each technological parameter on uniformity by using an analysis of variance method, and determining 2-3 most critical parameters; on the premise of meeting the quality requirement, comprehensively considering the energy consumption index, and determining the optimal parameter combination by using methods such as linear programming and the like; and verifying whether the optimal parameter combination can obtain expected product quality and minimum energy consumption.
As shown in fig. 2, an embodiment of the present invention further provides an on-line detecting device 20 for material mixing uniformity, including:
An acquisition module 21, configured to acquire an image of a material to be detected; thresholding the image of the material to be detected to extract white point particles in the material; calculating the enveloping area of white dot particles and calculating the area of the whole material image to be detected; calculating the area ratio of the white point particles according to the enveloping area of the white point particles and the area of the whole material image to be detected, and determining the center point of the image;
a processing module 22 for calculating the average and standard deviation of the distances from all white point particles to the center point; judging that if the Euclidean distance from the white point particles to the center point is not less than the dynamic threshold value according to the preset dynamic threshold value and the average value and standard deviation of the distances from all the white point particles to the center point, taking the dynamic threshold value as the Euclidean distance of the white point particles, and carrying out weighted average on the adjusted Euclidean distance to obtain an average distance; and calculating the mixing uniformity of the materials according to the area ratio and the average distance of the white dot particles.
Optionally, thresholding is performed on the image of the material to be detected, and white point particles in the material are extracted, including:
converting the material image to be detected into a gray image;
calculating the integral pixel value distribution of the gray image and determining the threshold value T;
Binarizing the gray level image, and making the pixel value not less than threshold valueTIs set to be white, and the pixel value is less than the threshold valueTSetting the pixel point of (2) to be black;
and performing open operation on the binarized image, judging the connected domains of the white pixel points by connecting adjacent pixels, and marking each connected domain as a white dot particle.
Optionally, calculating an envelope area of the white dot particles and calculating an area of the whole material image to be detected includes:
calculating the outline perimeter of the white point particles according to each extracted white point particle;
performing convex hull operation on the outline circumferences of all the particles to obtain convex hull outlines of white-point particles;
calculating the area surrounded by the convex hull outline, wherein the area surrounded by the convex hull outline is the enveloping area of the white dot particles;
and accumulating the envelope areas of all the white dot particles to obtain the total envelope area of the white dot particles.
Optionally, calculating the area occupation ratio of the white dot particles according to the enveloping area of the white dot particles and the area of the whole material image to be detected, and determining the center point of the image, including:
processing the original image to obtain a smooth image;
detecting the edge of the smooth image, and carrying out connected domain analysis on the detected edge to obtain each connected region;
Calculating convex hulls for each connected region to obtain a plurality of convex hull contours of the image;
calculating all convex hull contour areas, and determining the area of the whole image according to all the convex hull contour areas;
calculating the area of white dot particles according to the area of the whole image;
and calculating weighted average coordinates of the centroids as a center point by using the barycenter coordinates of all the white point particles according to the areas of the white point particles.
Optionally, calculating an average value and standard deviation of all white point particles to center point distances includes:
clustering all white dot particles;
respectively calculating Euclidean distance from white point particles in each cluster to the centroid of each cluster, and removing outliers for white point particle distances in each cluster;
calculating the average value and standard deviation of the distances of the white point particles in each class after outliers are removed;
calculating the weight of the total number of the white point particles in each type;
and weighting and averaging the average distance and the standard deviation in each class to obtain the average value and the standard deviation of the distances from all white point particles to the center point.
Optionally, according to a preset dynamic threshold value, and an average value and a standard deviation of distances from all white point particles to a center point, judging that if the Euclidean distance from the white point particles to the center point is not less than the dynamic threshold value, taking the dynamic threshold value as the Euclidean distance of the white point particles, and performing weighted average on the adjusted Euclidean distance to obtain an average distance, including:
According to the average value of Euclidean distances from all white point particles to a central pointμAnd standard deviation sigma, setting dynamic thresholdT 1 =μ+ k×σ;
According to each white dot particleiEuclidean distance to center pointd i Determining the Euclidean distanced i And dynamic thresholdT 1 If the Euclidean distance is related tod i Not less than dynamic thresholdT 1 Updating the Euclidean distance of the white point particles to be a dynamic threshold valueT 1 If Euclidean distanced i <Dynamic thresholdT 1 The original Euclidean distance of the white point particles is kept unchanged;
euclidean distance after updating all white point particlesd i ' byPerforming operation to obtain an adjusted average distanceD',nAs the total number of white point particles,S i is the firstiArea of individual white dot particles.
Optionally, calculating the mixing uniformity of the materials according to the area ratio and the average distance of the white dot particles, including:
according to the area ratio and the average distance of white dot particles, byThe uniformity of the mixture was calculated, wherein,nfor the number of clusters to be counted,R i is the firstiJudging result of each cluster,/>Is the firstiThe weight of the clusters, wherein,。
it should be noted that the apparatus is an apparatus corresponding to the above method, and all implementation manners in the above method embodiment are applicable to this embodiment, so that the same technical effects can be achieved.
Embodiments of the present invention also provide a computing device comprising: a processor, a memory storing a computer program which, when executed by the processor, performs the method as described above. All the implementation manners in the method embodiment are applicable to the embodiment, and the same technical effect can be achieved.
Embodiments of the present invention also provide a computer-readable storage medium storing instructions that, when executed on a computer, cause the computer to perform a method as described above. All the implementation manners in the method embodiment are applicable to the embodiment, and the same technical effect can be achieved.
Those of ordinary skill in the art will appreciate that the various illustrative elements and algorithm steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware, or combinations of computer software and electronic hardware. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the solution. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present invention.
It will be clear to those skilled in the art that, for convenience and brevity of description, specific working procedures of the above-described systems, apparatuses and units may refer to corresponding procedures in the foregoing method embodiments, and are not repeated herein.
In the embodiments provided in the present invention, it should be understood that the disclosed apparatus and method may be implemented in other manners. For example, the apparatus embodiments described above are merely illustrative, e.g., the division of the units is merely a logical function division, and there may be additional divisions when actually implemented, e.g., multiple units or components may be combined or integrated into another system, or some features may be omitted or not performed. Alternatively, the coupling or direct coupling or communication connection shown or discussed with each other may be an indirect coupling or communication connection via some interfaces, devices or units, which may be in electrical, mechanical or other form.
The units described as separate units may or may not be physically separate, and units shown as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
In addition, each functional unit in the embodiments of the present invention may be integrated in one processing unit, or each unit may exist alone physically, or two or more units may be integrated in one unit.
The functions, if implemented in the form of software functional units and sold or used as a stand-alone product, may be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention may be embodied essentially or in a part contributing to the prior art or in a part of the technical solution, in the form of a software product stored in a storage medium, comprising several instructions for causing a computer device (which may be a personal computer, a server, a network device, etc.) to perform all or part of the steps of the method according to the embodiments of the present invention. And the aforementioned storage medium includes: a usb disk, a removable hard disk, a ROM, a RAM, a magnetic disk, or an optical disk, etc.
Furthermore, it should be noted that in the apparatus and method of the present invention, it is apparent that the components or steps may be disassembled and/or assembled. Such decomposition and/or recombination should be considered as equivalent aspects of the present invention. Also, the steps of performing the series of processes described above may naturally be performed in chronological order in the order of description, but are not necessarily performed in chronological order, and some steps may be performed in parallel or independently of each other. It will be appreciated by those of ordinary skill in the art that all or any of the steps or components of the methods and apparatus of the present invention may be implemented in hardware, firmware, software, or a combination thereof in any computing device (including processors, storage media, etc.) or network of computing devices, as would be apparent to one of ordinary skill in the art after reading this description of the invention.
The object of the invention can thus also be achieved by running a program or a set of programs on any computing device. The computing device may be a well-known general purpose device. The object of the invention can thus also be achieved by merely providing a program product containing program code for implementing said method or apparatus. That is, such a program product also constitutes the present invention, and a storage medium storing such a program product also constitutes the present invention. It is apparent that the storage medium may be any known storage medium or any storage medium developed in the future. It should also be noted that in the apparatus and method of the present invention, it is apparent that the components or steps may be disassembled and/or assembled. Such decomposition and/or recombination should be considered as equivalent aspects of the present invention. The steps of executing the series of processes may naturally be executed in chronological order in the order described, but are not necessarily executed in chronological order. Some steps may be performed in parallel or independently of each other.
While the foregoing is directed to the preferred embodiments of the present invention, it will be appreciated by those skilled in the art that various modifications and adaptations can be made without departing from the principles of the present invention, and such modifications and adaptations are intended to be comprehended within the scope of the present invention.