A toothpaste raw material detection method and system
By dynamically adjusting the low threshold and high threshold of the Canny operator, combined with grayscale histogram and gradient values, the problem of Canny edge detection technology dependence on threshold selection is solved, achieving more accurate detection of toothpaste raw material mixing status, and improving the quality of toothpaste .
Patent Information
- Application Number
- CN202411603693.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-12
- Publication Date
- 2025-02-11
- Estimated Expiration
- 2044-11-12
AI Technical Summary
Canny edge detection technology relies too much on the selection of low and high thresholds for edge extraction, and these thresholds usually need to be obtained through the experience and debugging of engineers, resulting in a decrease in the accuracy of the detection results and affecting the quality of the toothpaste.
By generating a grayscale histogram of the real-time image of the liquid level area of the toothpaste raw material, the initial mixing degree is calculated, and the low and high thresholds of the Canny operator are dynamically adjusted according to the initial mixing degree and the gradient values of each pixel point in the image to improve the edges Accuracy of detection.
It realizes more accurate detection of the mixing status of toothpaste raw materials, provides more reliable detection results, reduces manual intervention, improves detection efficiency, and ensures the quality of toothpaste.
Smart Images

Figure CN119131021B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of image processing, and in particular to a toothpaste raw material detection method and system. Background Art
[0002] The production of toothpaste requires a variety of powdered raw materials. During the production process, the various raw materials need to be dissolved, mixed and stirred evenly. If the stirring is not sufficient, the toothpaste composition will be uneven, the local concentration will be different, and the physical properties of the toothpaste will be poor. If the stirring time is too long, some ingredients may decompose and become ineffective, affecting the efficacy of the toothpaste. Figure 1 As shown, since the colors of toothpaste raw materials are not uniform, the parts that are not fully mixed during the dissolution and mixing process of the raw materials will form a certain color difference. Therefore, the color difference in the container can be used to judge whether the toothpaste raw materials are stirred evenly.
[0003] The patent document with announcement number CN115375687B discloses a monitoring and analysis system for the mixing uniformity of plastic raw materials in the production of plastic sheets, including a raw material input information collection module, a raw material input information analysis module, a stirring image collection module, a stirring image analysis module, a plastic sheet image collection module, a plastic sheet color analysis module, a plastic raw material mixing uniformity analysis module, an early warning terminal and a plastic raw material management database. By analyzing the information of the plastic raw materials put into the mixer, the stirring conditions of the put plastic raw materials and the color uniformity of the plastic sheets, and then analyzing the mixing uniformity of the put plastic raw materials, the problems of subjectivity and deviation in the current technology are solved, and the intelligent and automated analysis of the mixing uniformity of the plastic raw materials is realized, thereby ensuring the accuracy and objectivity of the analysis results of the mixing uniformity of the plastic raw materials, and also ensuring the production quality of the plastic sheets.
[0004] However, the above patent document is aimed at the detection of the mixing uniformity of plastic raw materials and is not suitable for the detection of toothpaste raw materials. Therefore, the present invention extracts the edges in the collected toothpaste raw material image through Canny edge detection, and identifies the color difference in the toothpaste raw material caused by insufficient mixing of the toothpaste based on the extracted edges, so as to judge whether the toothpaste raw materials are sufficiently mixed. However, the Canny edge detection technology is highly dependent on the selection of low thresholds and high thresholds for edge extraction, and the low thresholds and high thresholds are usually obtained by combining the experience of engineers and continuous debugging, which has certain inconveniences in use, resulting in reduced accuracy of the detection results and a decrease in the final quality of the toothpaste. Summary of the invention
[0005] In order to solve the problem that the extraction of edges by Canny edge detection technology is highly dependent on the selection of low thresholds and high thresholds, and the low thresholds and high thresholds are usually obtained by combining the experience of engineers and continuous debugging, which has certain inconveniences in use, resulting in reduced accuracy of detection results and reduced quality of final toothpaste, the present invention provides a toothpaste raw material detection method and system.
[0006] In the first aspect, the present invention provides a method for detecting toothpaste raw materials, which adopts the following technical solution:
[0007] A toothpaste raw material detection method comprises: generating a grayscale histogram of an image of a liquid surface area of a toothpaste raw material at each moment acquired in real time; for the image at each moment, acquiring the slope of a line between a maximum column height vertex and other non-zero column height vertices in the grayscale histogram, determining an initial mixing degree of the toothpaste raw material, wherein the initial mixing degree is positively correlated with the ratio of the absolute value of the slope of each connecting line to the absolute value of the slope with the largest absolute value among the slopes, and negatively correlated with the relative size of the non-zero column height in each connecting line; acquiring the gradient value of each pixel point in the image, determining a low threshold value of a Canny operator according to the gradient value of each pixel point and its neighboring pixel points and the initial mixing degree, wherein the low threshold value is proportional to the average gradient value of each pixel point, the average ... The relative difference between the gradient values of the point and the pixels in its neighborhood is positively correlated, and negatively correlated with the initial mixing degree; the high threshold of the Canny operator is determined according to the low threshold and the number of pixels whose gradient values are less than the low threshold, the high threshold is positively correlated with the low threshold, the relative difference between the maximum gradient value in the gradient values of each pixel and the low threshold, and negatively correlated with the proportion of pixels whose gradient values are less than the low threshold in all pixels; the image is detected by the Canny operator according to the low threshold and the high threshold to obtain the edge pixels of the image; in response to the ratio of the edge pixels of the image to all pixels being less than the preset threshold, it is determined that the toothpaste raw material surface area at this moment is stirred evenly, so as to complete the toothpaste raw material detection.
[0008] The beneficial effects are as follows: through grayscale histogram analysis and gradient value calculation, the mixing state of toothpaste raw materials can be detected more accurately, providing more reliable detection results; real-time acquisition is performed to monitor the toothpaste raw materials at each moment, and the mixing process is tracked in real time; the Canny operator is used to automatically detect edge pixels, reducing manual intervention and improving detection efficiency; the low threshold and the high threshold are determined by parameters such as slope value and gradient value, thereby improving the accuracy of the Canny operator in detecting the uniformity of toothpaste raw materials.
[0009] Furthermore, the method for acquiring the image of the toothpaste raw material liquid surface area is: dividing the image in the mixer into a background area and a toothpaste raw material liquid surface area by semantic segmentation, extracting the toothpaste raw material liquid surface area, and obtaining the image of the toothpaste raw material liquid surface area.
[0010] The beneficial effect is that the toothpaste liquid surface area can be accurately separated from the image through semantic segmentation, avoiding background interference and making the detection more accurate.
[0011] Furthermore, the initial mixing degree satisfies the following relationship:
[0012] ; In the formula, is the initial mixing degree of toothpaste raw materials, is the number of non-zero column heights in the grayscale histogram, For the The absolute value of the slope of the connecting line, is the absolute value of the slope with the largest absolute value among the slopes of the connecting lines, For the The non-zero column heights corresponding to the lines, is the maximum column height in the grayscale histogram, is a natural exponential function.
[0013] The beneficial effects are: by combining the slope of the connecting line and the column height, the calculation of the degree of mixing is more comprehensive and accurate; by standardizing and exponentially adjusting the slope and column height, the relative changes of different elements in the mixing process can be reflected, and the mixing effect can be evaluated more realistically.
[0014] Furthermore, the gradient value of each pixel in the image is obtained by using a Sobel operator.
[0015] Furthermore, the low threshold satisfies the following relationship:
[0016] ; In the formula, is the low threshold of the Canny operator, is the mean gradient value of each pixel, is the number of pixels, For the The mean gradient value of the pixel in the neighborhood of pixels, For the The gradient value of a pixel, is the maximum gradient value among the gradient values of each pixel. is the initial mixing degree of toothpaste raw materials, The round-up symbol.
[0017] The beneficial effects are: by combining the mean and relative changes of pixel gradients, dynamic adjustments can be made according to the gradient characteristics of the image, thereby improving the adaptability and accuracy of edge detection; by comparing the mean gradient value in the neighborhood with the gradient value of the current pixel, local gradient changes are taken into account, making the threshold setting more accurate.
[0018] Furthermore, the high threshold satisfies the following relationship:
[0019] ; In the formula, is the high threshold of the Canny operator, is the low threshold of the Canny operator, is the number of pixels whose gradient value is less than the low threshold, is the number of all pixels, is the maximum gradient value among the gradient values of each pixel. is the natural exponential function, The round-up symbol.
[0020] The beneficial effects are: by dynamically adjusting the low threshold, the threshold setting can be automatically optimized according to the gradient distribution, thereby enhancing the adaptability to different image characteristics; introducing the number of pixels with gradient values less than the low threshold as an adjustment factor, so that the high threshold takes into account the distribution of lower gradient areas in the image more, avoiding over-detection or missed detection.
[0021] In a second aspect, the present invention provides a toothpaste raw material detection system, which adopts the following technical solution:
[0022] A toothpaste raw material detection system comprises: a processor and a memory, wherein the memory stores computer program instructions, and when the computer program instructions are executed by the processor, the above-mentioned toothpaste raw material detection method is implemented.
[0023] By adopting the above technical solution, the above-mentioned toothpaste raw material detection method is generated into a computer program and stored in a memory so as to be loaded and executed by a processor, thereby making a terminal device based on the memory and the processor for easy use.
[0024] The present invention has the following technical effects:
[0025] The initial mixing degree of the toothpaste raw materials is calculated according to the grayscale histogram, and the mixing degree of the toothpaste raw materials is measured from the overall liquid surface area of the toothpaste raw materials; the low threshold of the Canny operator is calculated according to the initial mixing degree of the toothpaste raw materials and the gradient value of each pixel in the image, and the high threshold of the Canny operator is finally determined according to the low threshold. The low threshold and high threshold obtained by combining the initial mixing degree of the toothpaste raw materials from the perspective of local features of the image avoid the phenomenon of being unable to detect edges caused by uneven mixing of the toothpaste raw materials due to improper selection of the low threshold and the high threshold, thereby improving the detection accuracy, better judging the state of the toothpaste raw materials, and ensuring the quality of the produced toothpaste. BRIEF DESCRIPTION OF THE DRAWINGS
[0026] By reading the detailed description below with reference to the accompanying drawings, the above and other purposes, features and advantages of the exemplary embodiments of the present invention will become readily understood. In the accompanying drawings, several embodiments of the present invention are shown in an exemplary and non-restrictive manner, and the same or corresponding reference numerals represent the same or corresponding parts.
[0027] Figure 1 It is a schematic diagram of an image of a liquid surface area of a toothpaste raw material that is not fully mixed during the process of dissolving and mixing the raw materials in the background technology of the present invention.
[0028] Figure 2 It is a method flow chart of a toothpaste raw material detection method according to an embodiment of the present invention.
[0029] Figure 3 It is a grayscale histogram of an image of a toothpaste raw material liquid surface area at the current moment in a toothpaste raw material detection method according to an embodiment of the present invention.
[0030] Figure 4 It is a schematic diagram of a Canny operator in a toothpaste raw material detection method according to an embodiment of the present invention performing edge detection on an image based on an artificially set lower high threshold.
[0031] Figure 5 It is a schematic diagram of the Canny operator in a toothpaste raw material detection method according to an embodiment of the present invention performing edge detection on an image based on the low threshold and the high threshold of the present invention. DETAILED DESCRIPTION
[0032] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present invention.
[0033] It should be understood that when the terms "first", "second", etc. are used in the claims, descriptions, and drawings of the present invention, they are only used to distinguish different objects, rather than to describe a specific order. The terms "include" and "comprise" used in the description and claims of the present invention indicate the presence of the described features, wholes, steps, operations, elements, and / or components, but do not exclude the presence or addition of one or more other features, wholes, steps, operations, elements, components, and / or their collections.
[0034] The embodiment of the present invention discloses a toothpaste raw material detection method, referring to Figure 2 , comprising steps S1 to S7:
[0035] S1: Generate a grayscale histogram of the image of the toothpaste raw material liquid surface area at each moment acquired in real time.
[0036] It should be noted that since the mixing of toothpaste raw materials is generally carried out in a large mixer, the collected images will contain parts of the mixer such as the inner wall, baffle and mixing shaft. These parts will affect the judgment of whether the toothpaste raw materials are mixed evenly. Therefore, semantic segmentation is used to obtain the toothpaste raw material liquid surface area in the image to obtain an image of the toothpaste raw material liquid surface area.
[0037] Specifically, the method for acquiring the image of the toothpaste raw material liquid surface area is:
[0038] The image in the blender is divided into a background area and a toothpaste raw material liquid surface area through semantic segmentation, and the toothpaste raw material liquid surface area is extracted to obtain an image of the toothpaste raw material liquid surface area.
[0039] Implementers can select the network structure and loss function of semantic segmentation according to the actual implementation situation. For example, the network structure is the Unet structure, and the loss function is the cross entropy loss function.
[0040] The image of the liquid surface area of the toothpaste raw material is converted into a grayscale image, and a grayscale histogram of the grayscale image is generated.
[0041] S2: Obtain the slope of the line between the maximum column height vertex and other non-zero column height vertices in the grayscale histogram to determine the initial mixing degree of the toothpaste raw materials.
[0042] For each moment of the image, obtain the slope of the line between the maximum column height vertex and other non-zero column height vertices in the grayscale histogram, such as Figure 3 As shown, it is the grayscale histogram of the image of the liquid surface area of the toothpaste raw material at the current moment. The dotted line in the figure is the connection line between the maximum column height vertex and other non-zero column height vertices, which determines the initial mixing degree of the toothpaste raw material.
[0043] It should be noted that during the stirring process of the toothpaste raw materials, when the toothpaste raw materials are in different degrees of mixing, the edges in the image caused by the unevenness of the toothpaste raw materials will also be in different distribution states. For example, when the new raw materials are just added, the mixing degree of the toothpaste raw materials is low, and the edges produced are concentrated, few and strong; as the toothpaste raw materials are continuously stirred, the edges in the image caused by the unevenness of the toothpaste raw materials become more dispersed, numerous and flat; in order to well identify the edges caused by the unevenness of the toothpaste raw materials when the toothpaste raw materials are stirred to different degrees, different thresholds need to be used when the toothpaste raw materials are in different mixing degrees, so it is necessary to calculate the initial mixing degree of the toothpaste raw materials.
[0044] Specifically, the initial mixing degree satisfies the following relationship:
[0045] ;
[0046] In the formula, is the initial mixing degree of toothpaste raw materials, is the number of non-zero column heights in the grayscale histogram, For the The absolute value of the slope of the connecting line, is the absolute value of the slope with the largest absolute value among the slopes of the connecting lines, For the The non-zero column heights corresponding to the lines, is the maximum column height in the grayscale histogram, is a natural exponential function.
[0047] in, For the The relative size of the non-zero column heights corresponding to the lines, when The bigger, The smaller the time, the The gray value corresponding to the non-zero column height corresponding to the line and the maximum column height The smaller the corresponding grayscale value difference is, and the fewer the number of pixels corresponding to the non-zero column height is, the more likely the distribution of the grayscale values of the pixels in the toothpaste raw material surface area is to be concentrated. The corresponding grayscale value, that is, the closer the color of the pixel points in the image of the toothpaste raw material surface area is, the more evenly the toothpaste raw materials are mixed, and the greater the initial mixing degree of the toothpaste raw materials. The smaller, The larger the The gray value corresponding to the non-zero column height corresponding to the line and the maximum column height The larger the corresponding grayscale value difference is, and the more pixels correspond to the non-zero column height, the more the grayscale value of the pixel point in the toothpaste raw material surface area is. The larger the difference between the corresponding grayscale values, the more mixed the colors of the pixels in the image of the toothpaste raw material surface area, the more uneven the toothpaste raw materials are mixed, and the smaller the initial mixing degree of the toothpaste raw materials. The smaller, The smaller the value, the more it means that there is a certain difference between the grayscale value of the pixel in the image of the toothpaste raw material surface area and the grayscale value corresponding to the maximum column height, but the number of pixels with different grayscale values corresponding to the maximum column height is small. At this time, the toothpaste raw material is in a relatively stable but not completely mixed state, indicating that the toothpaste raw material is in a medium mixing state. The bigger, The larger it is, it means that there are a certain number of pixels in the image of the toothpaste raw material liquid surface area whose grayscale values have a small difference with the grayscale value corresponding to the maximum column height. The toothpaste areas corresponding to these pixels may be about to be mixed, but have not yet been completely mixed, indicating that the toothpaste raw materials are in a medium mixing state.
[0048] S3: Get the gradient value of each pixel in the image.
[0049] In one embodiment, the gradient value of each pixel in the image is obtained by using a Sobel operator.
[0050] The Sobel operator is a commonly used detection operator used to calculate the gradient value of pixels in an image. It uses two 3×3 convolution kernels to calculate the gradient value of each pixel in the image in the horizontal and vertical directions. It can efficiently calculate the gradient value of each pixel in the image.
[0051] In another embodiment, the gradient value of each pixel in the image is obtained by using a Prewitt operator, which will not be described in detail here.
[0052] S4: Determine the low threshold of the Canny operator.
[0053] It should be noted that the overall mixing uniformity information of the toothpaste raw materials can be obtained by calculating the initial mixing degree. In order to more finely monitor the mixing process of the toothpaste raw materials, the mixing uniformity information of the toothpaste raw materials needs to be refined. Therefore, it is necessary to extract the refined information on the mixing uniformity of the toothpaste raw materials through edge detection; since Canny edge detection determines whether the pixel is at the edge of a region with color difference based on the gradient of the pixel in the image, when the gradient value of the pixel is less than the low threshold, it is determined that the pixel is not at the edge caused by color difference in the image. When the threshold is too large, the edge caused by uneven mixing of the toothpaste raw materials may not be identified. If the threshold is too small, too many small edges will be identified, affecting the judgment of the uniformity of mixing of the toothpaste raw materials; therefore, the low threshold of edge detection is calculated based on the initial mixing degree of the toothpaste raw materials and the gradient of the liquid surface area of the toothpaste raw materials in the image.
[0054] Specifically, the low threshold satisfies the following relationship:
[0055] ;
[0056] In the formula, is the low threshold of the Canny operator, is the mean gradient value of each pixel, is the number of pixels, For the The mean gradient value of the pixel in the neighborhood of pixels, For the The gradient value of a pixel, is the maximum gradient value among the gradient values of each pixel. is the initial mixing degree of toothpaste raw materials, The round-up symbol.
[0057] in, It is the relative difference in the gradient value of each pixel in the image and the pixel in its neighborhood. The larger the value, the stronger the edge of the toothpaste raw material surface area may be. At this time, the edge of the toothpaste raw material surface area is more likely to be caused by the color difference caused by the incomplete mixing of the toothpaste raw materials. In order to avoid the weak edge caused by the uneven distribution of light sources in the shooting environment, a higher low threshold should be used to judge the uniformity of the mixing of toothpaste raw materials; the smaller the value, the closer the gradient value of the pixel is to the gradient value of the surrounding pixels, indicating that the change in this area is not significant. The gradient difference may be caused by the slight color difference of the raw materials when the toothpaste raw materials are about to be mixed evenly. A lower low threshold should be used to identify the slight color difference. The low threshold value is determined from the perspective of the pixel gradient in the local range. In order to more comprehensively measure the uniformity of the mixing of toothpaste raw materials, it is also necessary to adjust the size of the low threshold value from a global perspective. Therefore, the initial mixing degree of the toothpaste raw materials is measured from a global perspective. right Make corrections when The smaller the value, the more unevenly the toothpaste raw materials may be mixed. In order to avoid the weak edges caused by the uneven distribution of light sources in the shooting environment from judging the uniformity of the mixing of toothpaste raw materials, a higher low threshold should be used. The smaller the right The higher the upward revision, the The larger the value, the lower threshold The less the decrease is on the basis of , the larger the lower threshold is; when The larger the value, the more evenly the toothpaste raw materials are likely to be mixed. In order to identify the weak edge generated when the toothpaste raw materials are about to be mixed evenly, a relatively low threshold should be used. The larger the right The smaller the upward correction, the is relatively small, making the low threshold The more it decreases from the basis of , the smaller the lower threshold is relatively; and then we get and through right Adjust to get a low threshold.
[0058] S5: Determine the high threshold of the Canny operator.
[0059] It should be noted that the Canny operator detection searches for certain edges in the image based on a high threshold, that is, pixels with a gradient greater than the high threshold will be identified as edges, and then the edges can be used to detect whether the toothpaste raw materials are mixed evenly. However, since the toothpaste raw materials have similar colors at different stages of the mixing process, if the high threshold is too high, the edges in the toothpaste raw material image cannot be identified. If the high threshold is too low, such as Figure 4 As shown, too many edges will be identified; therefore, the high threshold for edge detection is calculated based on the low threshold and the gradient histogram.
[0060] The high threshold of the Canny operator is determined according to the low threshold and the number of pixels whose gradient values are less than the low threshold.
[0061] Specifically, the high threshold satisfies the following relationship:
[0062] ;
[0063] In the formula, is the high threshold of the Canny operator, is the low threshold of the Canny operator, is the number of pixels whose gradient value is less than the low threshold, is the number of all pixels, is the maximum gradient value among the gradient values of each pixel. is the natural exponential function, The round-up symbol.
[0064] in, The gradient value in the image of the toothpaste raw material surface area is less than the low threshold The proportion of pixels in all pixels. The larger the value, the more pixels in the image of the toothpaste raw material surface area have relatively small gradient values. The image may lack obvious edges or areas with significant changes. To avoid losing effective edges, the high threshold should be set to a smaller value. The smaller the value, the more pixels in the image of the toothpaste raw material surface area have relatively large gradient values. The image may have more obvious edges or areas with significant changes. To avoid detecting weak edges caused by uneven non-toothpaste raw materials, the high threshold should be set to a larger value. Since the gradients of the pixels in the image may be generally large or generally small, only by At low threshold Calculating the high threshold based on the value of may result in an inappropriate adjustment range and may result in too many edges or too few edges being detected. right Make corrections, The larger the value, the wider the range of gradient values in the image. Obviously higher than the low threshold, in order to make the high threshold ignore the weak edges caused by the unevenness of non-toothpaste raw materials, a larger high threshold should be used. The smaller it is, the more concentrated the distribution of gradient values in the image is, and the maximum gradient value is With low threshold The smaller the gap, the more subtle the edge in the image may be, and the change is not obvious. In order to capture the subtle edge produced when the toothpaste is about to be mixed evenly, a smaller high threshold should be used.
[0065] S6: Detect the image using the Canny operator according to the low threshold and the high threshold to obtain edge pixel points of the image.
[0066] like Figure 5 As shown, it is a schematic diagram of performing edge detection on an image according to the low threshold and the high threshold by using the Canny operator in this embodiment to obtain edge pixels of the image.
[0067] S7: In response to the ratio of the edge pixel points to all the pixel points of the image being less than a preset threshold, it is determined that the toothpaste raw material liquid surface area at that moment is stirred evenly, so as to complete the toothpaste raw material detection.
[0068] Specifically, the toothpaste raw material detection is completed, including:
[0069] In response to the toothpaste raw material liquid surface area being uniformly stirred at multiple consecutive moments, it is determined that the toothpaste raw material is uniformly stirred, and the toothpaste raw material detection is completed.
[0070] The implementer can set the preset threshold and the specific time of multiple consecutive moments according to the actual implementation situation. For example, the preset threshold is 0.003 and the specific time is 15s.
[0071] The embodiment of the present invention further discloses a toothpaste raw material detection system, including a processor and a memory, wherein the memory stores computer program instructions, and when the computer program instructions are executed by the processor, a toothpaste raw material detection method according to the present invention is implemented.
[0072] The above system also includes other components well known to those skilled in the art, such as a communication bus and a communication interface, and their configuration and functions are known in the art, so they will not be described in detail here.
[0073] In the present invention, the aforementioned memory may be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, apparatus, or device. For example, a computer-readable storage medium may be any suitable magnetic storage medium or magneto-optical storage medium, or any other medium that can be used to store the required information and can be accessed by an application, module, or both. Any such computer storage medium may be part of the device or accessible or connectable to the device.
[0074] Although this specification has shown and described a number of embodiments of the present invention, it will be apparent to those skilled in the art that such embodiments are provided by way of example only. Those skilled in the art will conceive of many modifications, changes and alternatives without departing from the ideas and spirit of the present invention. It should be understood that in the practice of the present invention, various alternatives to the embodiments of the present invention described herein may be employed.
[0075] The above are all preferred embodiments of the present invention, and are not intended to limit the protection scope of the present invention. Therefore, any equivalent changes made based on the structure, shape, and principle of the present invention should be included in the protection scope of the present invention.
Claims
1. A method for detecting toothpaste raw materials, characterized in that: include: Generate a grayscale histogram of the image of the toothpaste raw material liquid surface area at each moment acquired in real time; For each image at each moment, the slope of the line between the maximum column height vertex and other non-zero column height vertices in the grayscale histogram is obtained to determine the initial mixing degree of the toothpaste raw materials. The initial mixing degree is positively correlated with the ratio of the absolute value of the slope of each connecting line to the absolute value of the slope with the largest absolute value among the slopes, and negatively correlated with the relative size of the non-zero column height in each connecting line. The initial mixing degree of the toothpaste raw materials satisfy: , is the number of non-zero column heights in the grayscale histogram, For the The absolute value of the slope of the connecting line, is the absolute value of the slope with the largest absolute value among the slopes of the connecting lines, For the The non-zero column heights corresponding to the lines, is the maximum column height in the grayscale histogram, is a natural exponential function; the gradient value of each pixel in the image is obtained, and the low threshold of the Canny operator is determined according to the gradient value of each pixel and its neighboring pixel and the initial mixing degree. The low threshold is positively correlated with the mean gradient value of each pixel and the relative difference between the gradient values of each pixel and its neighboring pixel, and negatively correlated with the initial mixing degree. The low threshold of the Canny operator satisfy: , is the mean gradient value of each pixel, is the number of pixels, For the The mean gradient value of the pixel in the neighborhood of pixels, For the The gradient value of a pixel, is the maximum gradient value among the gradient values of each pixel. The symbol for rounding up; the high threshold of the Canny operator is determined according to the low threshold and the number of pixels whose gradient values are less than the low threshold. The high threshold is positively correlated with the low threshold, the relative difference between the maximum gradient value in the gradient values of each pixel and the low threshold, and is negatively correlated with the proportion of pixels whose gradient values are less than the low threshold in all pixels. The high threshold of the Canny operator satisfy: , is the number of pixels whose gradient values are less than the low threshold; the image is detected by the Canny operator according to the low threshold and the high threshold to obtain the edge pixels of the image; In response to the ratio of the edge pixel points to all the pixel points of the image being less than a preset threshold, it is determined that the toothpaste raw material liquid surface area at that moment is stirred evenly, so as to complete the toothpaste raw material detection.
2. A toothpaste raw material detection method according to claim 1, characterized in that: The method for acquiring the image of the toothpaste raw material liquid surface area is: The image in the blender is divided into a background area and a toothpaste raw material liquid surface area through semantic segmentation, and the toothpaste raw material liquid surface area is extracted to obtain an image of the toothpaste raw material liquid surface area.
3. A toothpaste raw material detection method according to claim 1, characterized in that: The gradient value of each pixel in the image is obtained by using the Sobel operator.
4. A toothpaste raw material detection method according to claim 1, characterized in that: The toothpaste raw material testing is completed, including: In response to the toothpaste raw material liquid surface area being uniformly stirred at multiple consecutive moments, it is determined that the toothpaste raw material is uniformly stirred, and the toothpaste raw material detection is completed.
5. A toothpaste raw material detection system, characterized in that: include: A processor and a memory, wherein the memory stores computer program instructions, and when the computer program instructions are executed by the processor, a toothpaste raw material detection method according to any one of claims 1 to 4 is implemented.
Citation Information
Patent Citations
A monitoring and analysis system for the mixing uniformity of plastic raw materials in the production of plastic sheets
CN115375687B
Method for evaluating uniformity of glass fiber partition plate for lead-acid storage battery
CN115205282A
Edge detection method and device based on adaptive gradient threshold canny operator
CN115797300A