Method and equipment for detecting liquid level of bottled liquid and storage medium
Through ray signal acquisition and image processing technology, the longitudinal midline pixel points of the bottled liquid are extracted, differential calculations are performed, and the edge points of the liquid level segment are accurately identified, solving the problem of insufficient accuracy and flexibility of the existing liquid level detection methods, and achieving efficient and accurate liquid level detection.
Patent Information
- Application Number
- CN202411358420.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-27
- Publication Date
- 2025-05-06
- Estimated Expiration
- 2044-09-27
AI Technical Summary
The existing liquid level detection methods rely on precise identification of the bottle head position as the reference position, neglecting the height difference between different bottles, resulting in insufficient flexibility and versatility of detection accuracy and automated processing.
By collecting the ray signal of the bottled liquid, converting it into a target image, extracting pixel points on the longitudinal center line, performing differential calculations, determining the liquid level segment with the largest change in pixel value, accurately positioning the upper and lower edge points of the liquid level segment, and identifying the liquid level height.
It realizes efficient and accurate identification of the liquid level height of bottled liquids, avoids error accumulation, improves detection accuracy and flexibility and versatility of automated processing.
Smart Images

Figure CN119941609A_ABST
Abstract
Description
Technical Field
[0001] The present application generally relates to the field of liquid level detection technology. More specifically, the present application relates to a method, device and computer-readable storage medium for detecting the liquid level of a bottled liquid. Background Art
[0002] In the production process of liquid products such as bottled water, beverages, and medicines, liquid level control is an important link to ensure product quality. Traditional manual detection methods are not only inefficient, but also difficult to ensure the accuracy and consistency of detection. With the development of automation and intelligent technology, image-based detection methods have gradually attracted attention. Existing image detection technology is affected by multiple factors such as lighting conditions, bottle shape, and liquid color, which may lead to insufficient detection accuracy and stability.
[0003] At present, although there are methods to improve the accuracy of image detection technology. For example, by threshold segmentation of the captured image to obtain a binary image, the reference position in the vertical direction of the top of the bottle head and the reference position in the horizontal direction on both sides of the bottle head are determined in the binary image. Based on the aforementioned reference position, the reference point and the liquid level search area are determined, and the target and background in the liquid level search area are projected vertically respectively, and searched from top to bottom to find the position of the lowest point of the liquid level. Further, whether the liquid level meets the requirements is determined based on the difference between the reference point and the position of the lowest point of the liquid level. However, this method relies on the accurate identification of the bottle head position as the reference position. The accuracy of this step directly determines the accuracy of the subsequent downward movement area. Once the bottle head positioning error occurs, the entire process may fall into the dilemma of error accumulation. By determining the subsequent reference point and liquid level search area based on the fixed position of the bottle head, the height difference between different bottles is ignored, so that the distance parameters need to be manually adjusted for each bottle in the detection process, which reduces the flexibility and versatility of automated processing. In addition, the above method also relies on the first maximum pixel point (lower edge liquid level) on the midline of the area when determining the liquid level search area. In actual liquid level detection, the bottle liquid level will change dynamically due to movement. A slight shake of the liquid level can cause a significant change in the edge of the determination area, thereby introducing measurement errors, which is difficult to meet the current high-precision detection needs.
[0004] In view of this, there is an urgent need to provide a solution for detecting the liquid level of bottled liquid, so as to efficiently and accurately identify the liquid level height of the bottled liquid. Summary of the invention
[0005] In order to at least solve one or more of the technical problems mentioned above, the present application proposes solutions for detecting the liquid level of bottled liquid in multiple aspects.
[0006] In a first aspect, the present application provides a method for detecting the liquid level of a bottled liquid, comprising: collecting a radiation signal of the bottled liquid and converting the radiation signal into a target image; extracting pixel points on a longitudinal centerline of the bottled liquid based on the target image; performing differential calculation on the pixel points on the longitudinal centerline to determine a liquid level segment with the largest pixel value change; determining a first upper edge point and a first lower edge point of the liquid level segment; and determining the liquid level position based on the first upper edge point and the first lower edge point to identify the liquid level height, so as to detect the liquid level of the bottled liquid.
[0007] In some embodiments, extracting pixel points on the longitudinal centerline of the bottled liquid based on the target image includes: binarizing the target image to obtain a binarized image; extracting a circumscribed rectangle of the bottled liquid in the binarized image; and extracting pixel points on the longitudinal centerline of the bottled liquid based on the longitudinal centerline of the circumscribed rectangle.
[0008] In other embodiments, performing differential calculation on the pixel points on the longitudinal center line to determine the liquid level segment with the largest pixel value change includes: performing differential calculation on the pixel points on the longitudinal center line to obtain a target segment with continuous and monotonous pixel value changes; and screening the target segment to determine the liquid level segment with the largest pixel value change.
[0009] In some other embodiments, differential calculation is performed on the pixel points on the longitudinal center line to obtain a target segment with continuous and monotonically changing pixel values, which includes: respectively calculating a first value before differential and a second value after differential corresponding to the pixel points on the longitudinal center line; determining a differential value based on the first value and the second value; and obtaining the target segment with continuous and monotonically changing pixel values based on the differential value.
[0010] In some further embodiments, before performing differential calculation on the pixel points on the longitudinal center line to determine the liquid level segment with the largest pixel value change, the method further includes: performing a median filtering operation on the pixel points on the longitudinal center line.
[0011] In some further embodiments, the first upper edge point and the first lower edge point of the liquid level segment are determined by the following operation: obtaining the corresponding positions of the minimum pixel value and the maximum pixel value in the liquid level segment to correspondingly determine the first upper edge point and the first lower edge point of the liquid level segment.
[0012] In some other embodiments, determining the liquid level position based on the first upper edge point and the first lower edge point to identify the liquid level height so as to detect the bottled liquid level includes: calculating the midpoint between the first upper edge point and the first lower edge point to determine the liquid level position; and identifying the liquid level height based on the height between the liquid level position and a reference position so as to detect the bottled liquid level.
[0013] In some other embodiments, it also includes: determining the liquid area based on the intersection area of the horizontal line drawn based on the longitudinal coordinates of the first upper edge point and the first lower edge point and the circumscribed rectangle of the liquid segment; limiting the liquid area along the transverse center line; extracting multiple new liquid level segments in the longitudinal direction within the limited liquid area to determine multiple second upper edge points and multiple second lower edge points; and calculating the longitudinal mean of the multiple second upper edge points and the multiple second lower edge points to determine the liquid level position to identify the liquid level height.
[0014] In a second aspect, the present application provides a device for detecting the liquid level of bottled liquid, comprising: a processor; and a memory, in which program instructions for detecting the liquid level of bottled liquid are stored, and when the program instructions are executed by the processor, the device implements one or more embodiments of the aforementioned first aspect.
[0015] In a third aspect, the present application provides a computer-readable storage medium having stored thereon computer-readable instructions for detecting a liquid level in a bottle, wherein when the computer-readable instructions are executed by one or more processors, one or more embodiments of the aforementioned first aspect are implemented.
[0016] Through the scheme for detecting the liquid level of bottled liquid provided above, the embodiment of the present application utilizes the penetrability of rays to accurately identify the liquid level area, and converts the ray signal into a target grayscale image, thereby extracting the pixel points on the longitudinal centerline of the bottled liquid based on the target image. Then, the pixel points on the longitudinal centerline are subjected to differential calculation, and the change of pixel values can be accurately identified through differential calculation. By determining the segment with the largest pixel value change as the liquid level segment, the first upper edge point and the first lower edge point of the liquid level segment can be accurately located, thereby efficiently and accurately identifying the liquid level height of the bottled liquid, and realizing the detection of the bottled liquid level. Furthermore, the embodiment of the present application can also extract multiple second upper edge points and second lower edge points, and determine the liquid level position based on the longitudinal mean of the second upper edge point and the second lower edge point, so as to more accurately locate the liquid level position and obtain a more accurate liquid level height. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] 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 application will become easy to understand. In the accompanying drawings, several embodiments of the present application are shown in an exemplary and non-limiting manner, and the same or corresponding reference numerals represent the same or corresponding parts, wherein:
[0018] Figure 1 is an exemplary schematic diagram showing an existing liquid level detection;
[0019] Figure 2 is an exemplary schematic diagram showing the collection of ray signals of bottled liquid according to an embodiment of the present application;
[0020] Figure 3 is an exemplary flow chart showing a method for detecting a liquid level in a bottle according to an embodiment of the present application;
[0021] Figure 4 is an exemplary schematic diagram showing a target image of a bottled liquid according to an embodiment of the present application;
[0022] Figure 5 is an exemplary schematic diagram showing a binary image of a bottled liquid according to an embodiment of the present application;
[0023] Figure 6 is an exemplary schematic diagram showing the distribution of pixels on a longitudinal midline according to an embodiment of the present application;
[0024] Figure 7 is an exemplary schematic diagram showing the identification of liquid level height according to an embodiment of the present application;
[0025] Figure 8 is another exemplary schematic diagram showing the identification of liquid level height according to an embodiment of the present application;
[0026] Fig. 9 is an exemplary schematic diagram showing the position of the split liquid level according to an embodiment of the present application;
[0027] Fig.10 is an exemplary structural block diagram showing a device for detecting the liquid level of bottled liquid according to an embodiment of the present application. DETAILED DESCRIPTION
[0028] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present application.
[0029] It should be understood that the terms "include" and "comprising" used in the specification and claims of the present application indicate the presence of 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 collections thereof.
[0030] It should also be understood that the terms used in this application specification are only for the purpose of describing specific embodiments and are not intended to limit the present application. As used in this application specification and claims, unless the context clearly indicates otherwise, the singular forms of "a", "an" and "the" are intended to include plural forms. It should also be further understood that the term "and / or" used in this application specification and claims refers to any combination of one or more of the associated listed items and all possible combinations, and includes these combinations.
[0031] As used in this specification and claims, the term "if" may be interpreted as "when" or "upon" or "in response to determining" or "in response to detecting," depending on the context. Similarly, the phrase "if it is determined" or "if [described condition or event] is detected" may be interpreted as meaning "upon determination" or "in response to determining" or "upon detection of [described condition or event]" or "in response to detecting [described condition or event]," depending on the context.
[0032] Figure 1 FIG. 1 is an exemplary schematic diagram showing the existing liquid level detection. Figure 1 As shown in , the existing liquid level detection method is to use the top of the bottle head as the reference position G. Based on the reference position G, the reference point and the liquid level search area are determined, and the target and background in the liquid level search area are projected vertically, respectively, and searched from top to bottom to find the lowest point position Q of the liquid level. As an example, assume that the figure shows, from left to right, bottled liquids in a stationary state, bottled liquids in a state of left-right shaking, and bottled liquids in a state of front-back shaking. It can be seen from the figure that the arcs of the liquid surface of the bottled liquid in a stationary state are relatively symmetrical; the liquid surface of the bottled liquid in a state of left-right shaking becomes lower on the left and higher on the right; the liquid surface area of the bottled liquid in a state of front-back shaking becomes wider. In this scenario, using the existing liquid level detection method, only measuring the lowest point position (that is, the lower edge liquid level) Q at the midline will result in deviations, resulting in inaccurate measurements.
[0033] As can be seen from the above background technology description, the existing method still relies on the accurate identification of the bottle head position as the reference position, ignoring the height difference between different bottles, so that the distance parameter needs to be manually adjusted for each bottle in the detection process, reducing the flexibility and versatility of the automated processing. In addition, once the bottle head positioning error occurs, it will lead to the accumulation of errors in the liquid level detection, reducing the accuracy of the liquid level detection.
[0034] Based on this, the present application provides a solution for detecting the liquid level of bottled liquid. By utilizing the penetrability of rays, the liquid level area is accurately identified, and by performing differential calculations on the pixel points on the longitudinal center line, the liquid level segment with the largest monotonic change in pixel value is determined, thereby accurately determining the upper and lower edge points, thereby efficiently and accurately identifying the liquid level height of the bottled liquid.
[0035] The specific implementation of the present application is described in detail below with reference to the accompanying drawings.
[0036] Figure 2 FIG. 1 is an exemplary schematic diagram showing the collection of ray signals of bottled liquid according to an embodiment of the present application. Figure 2 As shown in , a ray source (such as X-rays, gamma rays, etc.) is shown at point O, the middle rectangular frame 201 represents the bottled liquid to be detected, and the rectangular frame 202 on the right represents the ray detector. In the actual liquid level detection scenario, the distance between the center position of the bottled liquid and the ray source and the ray detector remains unchanged, and the distance between the ray source and the ray detector is also fixed. In this scenario, when the ray from the ray source at point O is emitted, it passes through the two liquid level points A and B, and then projects to points C and D in the ray detector. In this way, the ray signal of the bottled liquid can be acquired. It can be understood that the thicker the liquid thickness, the smaller the grayscale value after ray acquisition imaging (i.e., the darker the brightness); the smaller the liquid thickness, the larger the grayscale value after ray acquisition imaging (i.e., the brighter the brightness). As an example, assuming that the brightness after projection at the liquid level A in the figure is the brightest, and the brightness after projection at the liquid level B in the figure is the darkest, they correspond to the upper edge point and the lower edge point of the liquid level, respectively. In some embodiments, at least the midpoint between the upper and lower edge points can be used as the liquid level position, and the liquid level position corresponds to the midpoint of CD after projection. When the height from the midpoint of the CD to the top of the radiation detector is recorded as h, then h is the relative value of the liquid level height. When the liquid level height decreases, h will become larger. In the embodiment of the present application, the aforementioned liquid level position can be determined to achieve the detection of the bottled liquid level.
[0037] Figure 3 FIG. 3 is an exemplary flow chart showing a method 300 for detecting the level of a bottled liquid according to an embodiment of the present application. Figure 3 As shown in FIG. 3 , at step S301, the ray signal of the bottled liquid is collected and converted into a target image. Figure 2The ray signal of the bottled liquid is collected. Based on the collected ray signal, by mapping it to grayscale levels, a target grayscale image reflecting the internal structure of the bottled liquid can be generated (for example Figure 4 After obtaining the target image, at step S302, the pixel points on the longitudinal midline of the bottled liquid are extracted based on the target image. In some embodiments, the target image may be firstly binarized to obtain a binarized image, and then the bounding rectangle of the bottled liquid in the binarized image is extracted to extract the pixel points on the longitudinal midline of the bottled liquid based on the longitudinal midline of the bounding rectangle. Figure 5-Figure 6 Detailed description of extracting pixel points on the longitudinal center line of the bottled liquid.
[0038] Next, at step S303, the pixel points on the longitudinal midline are differentially calculated to determine the liquid level segment with the largest pixel value change. In some embodiments, before differentially calculating the pixel points on the longitudinal midline to determine the liquid level segment with the largest pixel value change, a median filtering operation may be performed on the pixel points on the longitudinal midline to remove image noise and improve the accuracy of subsequent calculations. For determining the liquid level segment with the largest pixel value change, in some embodiments, differentially calculating the pixel points on the longitudinal midline may be performed to obtain a target segment with a continuous monotonous change in pixel value, and then the target segment may be screened to determine the liquid level segment with the largest pixel value change.
[0039] According to the foregoing, the thicker the liquid, the smaller the grayscale value after the ray collection image (i.e., the darker the brightness); the smaller the liquid, the larger the grayscale value after the ray collection image (i.e., the brighter the brightness). Therefore, the grayscale of the liquid level close to the air part is larger, and the grayscale of the liquid level at the thickest part of the liquid is smaller. Based on this, the embodiment of the present application determines the segment with the largest monotonic change in grayscale through differential calculation, and can accurately identify the liquid level area.
[0040] Specifically, in some embodiments, firstly, the first value before the difference and the second value after the difference corresponding to the pixel point on the longitudinal midline are calculated respectively, and then the difference value is determined according to the first value and the second value, so as to obtain the target segment whose pixel value changes continuously and monotonically based on the difference value. As an example, the first value before the difference corresponding to the pixel point on the longitudinal midline can be recorded as [p0, p1, p2, ..., pn], and the second value after the difference can be recorded as [p1-p0, p2-p1, ..., pn-pn-1]. Then, the target segment whose pixel value changes continuously and monotonically is extracted according to the size of the difference value. Based on the target segment whose pixel value changes continuously and monotonically, the liquid level segment with the largest pixel value change is selected.
[0041] Further, at step S304, the first upper edge point and the first lower edge point of the liquid level segment are determined. In some embodiments, the first upper edge point and the first lower edge point of the liquid level segment can be determined by obtaining the corresponding positions of the minimum pixel value and the maximum pixel value in the liquid level segment. In some embodiments, the grayscale distribution diagram of the pixel points on the longitudinal midline (e.g. Figure 6 As shown) to determine the corresponding positions of the minimum pixel value and the maximum pixel value, and then determine the first upper edge point and the first lower edge point accordingly.
[0042] After obtaining the first upper edge point and the first lower edge point, at step S305, the liquid level position is determined according to the first upper edge point and the first lower edge point to identify the liquid level height, so as to detect the liquid level of the bottled liquid. In some embodiments, the liquid level position is determined by calculating the midpoint between the first upper edge point and the first lower edge point, and the liquid level height is identified according to the height between the liquid level position and the reference position, so as to detect the liquid level of the bottled liquid. In some implementation scenarios, the reference position is the top of the radiation detector. That is, the liquid level height is the height from the liquid point to the top of the radiation detector (e.g. Figure 7 Height H1 shown).
[0043] In combination with the above description, it can be known that the embodiments of the present application can accurately identify the liquid level area by utilizing the penetrability of rays, and by converting the ray signal into a target grayscale image, the pixel points on the longitudinal centerline of the bottled liquid are extracted based on the target image. Next, differential calculation is performed on the pixel points on the longitudinal centerline to accurately identify the liquid level segment with the largest pixel value change, so as to accurately determine the first upper edge point and the first lower edge point of the liquid level segment, so as to efficiently and accurately identify the liquid level height of the bottled liquid and realize the detection of the bottled liquid level. In some implementation scenarios, by comparing the identified liquid level height with the calibrated height threshold, when the identified liquid level height meets the calibrated height threshold, it means that the liquid level meets the standard. Otherwise, the liquid level does not meet the standard.
[0044] In some embodiments, the embodiments of the present application can also determine the liquid area based on the intersection area of the horizontal line made by the ordinates of the first upper edge point and the first lower edge point and the circumscribed rectangle of the liquid segment, and then shrink the liquid area along the transverse center line. Extract multiple new liquid level segments in the longitudinal direction in the shrunk liquid area to determine multiple second upper edge points and multiple second lower edge points, and determine the liquid level position by calculating the longitudinal mean of the multiple second upper edge points and the second lower edge points to identify the liquid level height. In some embodiments, the liquid area can be shrunk to three quarters of the original liquid area along the transverse center line. That is, extract multiple new liquid level segments on both sides of the longitudinal center line in the shrunk liquid area, obtain the upper and lower edge points of each new liquid level segment, and the mean of the upper and lower edge points of each new liquid level segment corresponds to the liquid level position. In some implementation scenarios, the determination of the upper and lower edge points (i.e., the second upper edge point and the second lower edge point) of the aforementioned new liquid level segments can refer to the determination operation of the above-mentioned first upper edge point and the first lower edge point.
[0045] That is, in addition to determining an upper edge point and a lower edge point as described above, the embodiment of the present application can also calculate multiple upper edge points and multiple lower edge points, and determine the liquid level position by the longitudinal average of the multiple upper edge points and the multiple lower edge points. Similarly, the height between the liquid point and the top of the radiation detector is the identified liquid level height. Based on this, the liquid level position is determined by the edge points at multiple positions, which can effectively avoid the deviation caused by shaking during the detection process, thereby more accurately locating the liquid level position and obtaining a more precise liquid level height.
[0046] Figure 4 FIG. 1 is an exemplary schematic diagram showing a target image of a bottled liquid according to an embodiment of the present application. Figure 4 The target grayscale image is shown in FIG. 1 , which is converted into a target grayscale image by collecting a ray signal of a bottled liquid. In some embodiments, the target grayscale image can be obtained by mapping the ray signal to a grayscale.
[0047] Figure 5 is an exemplary schematic diagram showing a binary image of a bottled liquid according to an embodiment of the present application. Figure 5 The binary image of the bottled liquid is shown in FIG. In some embodiments, the target image is binarized to obtain the binary image. Next, the circumscribed rectangle 501 of the bottled liquid in the binary image is extracted. The pixel points on the longitudinal midline L of the circumscribed rectangle are extracted.
[0048] Figure 6 FIG. 1 is an exemplary schematic diagram showing the distribution of pixels on the longitudinal midline according to an embodiment of the present application. Figure 6As shown in , the horizontal coordinate represents the position of the pixel point on the longitudinal midline, and the vertical coordinate represents the grayscale value. Among them, the horizontal coordinate corresponds to the position from the top of the ray detector to the bottom of the bottle from left to right. In the implementation scenario, the distribution of pixels on the longitudinal midline can be obtained by drawing the grayscale values at different positions. As mentioned above, by performing differential calculations on the pixel points on the longitudinal midline, the liquid level segment with the largest pixel value change can be determined, and then the corresponding positions of the minimum pixel value and the maximum pixel value in the liquid level segment are obtained to determine the first upper edge point and the first lower edge point of the liquid level segment. For example, point a and point b shown in the figure correspond to the first upper edge point and the first lower edge point of the liquid level segment, respectively, and the positions corresponding to the target image are, for example, Figure 7 as shown in .
[0049] Figure 7 is an exemplary schematic diagram showing the identification of the liquid level height according to an embodiment of the present application. Figure 7 The area encircled by an ellipse in the target image is the liquid level area, where point a and point b correspond to the first upper edge point and the first lower edge point of the liquid level area, respectively. In some embodiments, the liquid level position (such as point M1 in the figure) is determined by calculating the midpoint between the first upper edge point and the first lower edge point. Further, the liquid level height is identified based on the liquid level position M1 and the reference position (top of the ray detector), such as the liquid level height H1 shown in the figure.
[0050] In some embodiments, the embodiments of the present application can also calculate multiple second upper edge points and multiple second lower edge points to determine the liquid level position through the longitudinal average of the multiple upper edge points and the multiple lower edge points, thereby identifying the liquid level height. Figure 8 The aforementioned operation of identifying the liquid level height is described in detail.
[0051] Figure 8 FIG. 2 is another exemplary schematic diagram showing the identification of the liquid level according to an embodiment of the present application. Figure 8 As shown in , horizontal lines l1 and l2 are drawn based on the vertical coordinates of the first upper edge point a and the first lower edge point b. Then, the liquid area is constricted along the transverse midline to extract multiple new liquid level segments in the longitudinal direction within the constricted liquid area, such as shown by the four vertical lines in the liquid area in the figure. Similar to the first upper and lower edge points mentioned above, the second upper and lower edge points of each new liquid level segment can be obtained, such as the second upper edge points s1, s2, s3, s4 and the second lower edge points s5, s6, s7, s8. Furthermore, by calculating the mean of all the second upper and lower edge points, the corresponding liquid level position can be obtained, such as the transverse line segment l shown in the figure. The height between the liquid level position and the reference position (the top of the ray detector) is identified as the liquid level height, such as the liquid level height H2 shown in the figure.
[0052] In some implementation scenarios, the target image can be input into a network model such as machine learning or deep learning to obtain the above-mentioned liquid level position through semantic segmentation. In some implementation scenarios, the liquid level target can be firstly identified through the target detection model, and based on the identified liquid level target, semantic segmentation can be performed using, for example, a semantic segmentation model to obtain the liquid level position. The upper and lower edge lines of the area through semantic segmentation are the upper and lower edge lines of the liquid level position.
[0053] Fig. 9 is an exemplary schematic diagram showing the position of the split liquid level according to an embodiment of the present application. Fig. 9 The left side of the figure shows a liquid level target recognition diagram for performing liquid level target recognition through, for example, a target detection model, wherein the rectangular frame is the detected target area. Fig. 9 The right side of the figure shows the liquid level position obtained after semantic segmentation. The liquid level height can be identified by comparing the liquid level position with the reference position.
[0054] Fig.10 FIG. 1 is an exemplary structural block diagram showing a device 1000 for detecting the level of a bottled liquid according to an embodiment of the present application. Fig.10 As shown in , the device 1000 of the present application may include a processor 1001 and a memory 1002, wherein the processor 1001 and the memory 1002 communicate with each other via a bus. The memory 1002 stores program instructions for detecting the liquid level of the bottled liquid. When the program instructions are executed by the processor 801, the method steps described in the above text in combination with the accompanying drawings are implemented: collecting the ray signal of the bottled liquid and converting the ray signal into a target image; extracting the pixel points on the longitudinal center line of the bottled liquid based on the target image; performing differential calculation on the pixel points on the longitudinal center line to determine the liquid level segment with the largest pixel value change; determining the first upper edge point and the first lower edge point of the liquid level segment; and determining the liquid level position according to the first upper edge point and the first lower edge point to identify the liquid level height, so as to detect the liquid level of the bottled liquid.
[0055] According to the above description in combination with the accompanying drawings, those skilled in the art can also understand that the embodiments of the present application can also be implemented by software programs. Therefore, the present application also provides a computer-readable storage medium. The computer-readable storage medium stores computer-readable instructions for detecting the liquid level of the bottled liquid. When the computer-readable instructions are executed by one or more processors, the present application in combination with the accompanying drawings can be implemented. Figure 1 A method for detecting the fill level of a bottled liquid is described.
[0056] Through the description of the above implementation methods, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus a necessary general hardware platform, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solution is essentially or the part that contributes to the prior art can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments.
[0057] It should be noted that although the operations of the method of the present application are described in a specific order in the accompanying drawings, this does not require or imply that the operations must be performed in this specific order, or that all the operations shown must be performed to achieve the desired results. On the contrary, the steps depicted in the flow chart can be performed in a different order. Additionally or alternatively, some steps can be omitted, multiple steps can be combined into one step, and / or one step can be decomposed into multiple steps.
[0058] It should be understood that when the terms "first", "second", "third" and "fourth" are used in the claims, the specification and the drawings of the present application, they are only used to distinguish different objects, rather than to describe a specific order. The terms "include" and "comprise" used in the specification and claims of the present application 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.
[0059] It should also be understood that the terms used in this application specification are only for the purpose of describing specific embodiments and are not intended to limit the present application. As used in this application specification and claims, unless the context clearly indicates otherwise, the singular forms of "a", "an" and "the" are intended to include plural forms. It should also be further understood that the term "and / or" used in this application specification and claims refers to any combination of one or more of the associated listed items and all possible combinations, and includes these combinations.
[0060] Although the implementation methods of the present application are as above, the contents described are only examples adopted to facilitate the understanding of the present application, and are not intended to limit the scope and application scenarios of the present application. Any technician in the technical field described in the present application can make any modifications and changes in the form and details of the implementation without departing from the spirit and scope disclosed in the present application, but the scope of patent protection of the present application shall still be subject to the scope defined in the attached claims.
[0061] In addition, the collection and acquisition of various data in this application complies with relevant laws and regulations and is authorized by the data provider. Any organization or individual that needs to obtain external data must obtain authorization in accordance with the law and ensure data security. It is not allowed to illegally collect, use, process, or transmit unauthorized or unprotected data, or illegally buy, sell, provide, or disclose unauthorized or unprotected data.
Claims
1. A method for detecting the level of a bottled liquid, comprising: Collecting radiation signals of the bottled liquid and converting the radiation signals into a target image; Extracting pixel points on the longitudinal centerline of the bottled liquid based on the target image; Performing differential calculation on the pixel points on the longitudinal midline to determine the liquid level segment with the largest pixel value change; determining a first upper edge point and a first lower edge point of the liquid level segment; and The liquid level position is determined according to the first upper edge point and the first lower edge point to identify the liquid level height, so as to detect the liquid level of the bottled liquid.
2. The method according to claim 1, wherein extracting pixel points on the longitudinal centerline of the bottled liquid based on the target image comprises: Binarizing the target image to obtain a binary image; Extracting the circumscribed rectangle of the bottled liquid in the binary image; as well as Pixel points on the longitudinal center line of the bottled liquid are extracted based on the longitudinal center line of the circumscribed rectangle.
3. The method according to claim 1, wherein performing differential calculation on the pixel points on the longitudinal midline to determine the liquid level segment with the largest pixel value change comprises: Performing differential calculation on the pixel points on the longitudinal midline to obtain a target segment with a continuous and monotonically changing pixel value; as well as The target segments are screened to determine the liquid level segment with the largest pixel value change.
4. The method according to claim 3, wherein performing differential calculation on the pixel points on the longitudinal midline to obtain the target segment with continuous and monotonically changing pixel values comprises: Respectively calculating a first value before difference and a second value after difference corresponding to the pixel point on the longitudinal midline; determining a difference value according to the first value and the second value; as well as The target segment whose pixel values continuously and monotonically change is obtained based on the differential value.
5. The method according to claim 3 or 4, wherein before performing differential calculation on the pixel points on the longitudinal midline to determine the liquid level segment with the largest pixel value change, it also includes: A median filtering operation is performed on the pixel points on the longitudinal midline.
6. The method according to claim 1, wherein the first upper edge point and the first lower edge point of the liquid level segment are determined by: The positions of the minimum pixel value and the maximum pixel value in the liquid level segment are obtained to correspondingly determine the first upper edge point and the first lower edge point of the liquid level segment.
7. The method according to claim 6, wherein determining the liquid level position according to the first upper edge point and the first lower edge point to identify the liquid level height so as to detect the liquid level of the bottled liquid comprises: Calculating a midpoint between the first upper edge point and the first lower edge point to determine the liquid level position; as well as The liquid level height is identified according to the height between the liquid level position and the reference position, so as to detect the liquid level of the bottled liquid.
8. The method according to claim 6, further comprising: Determine the liquid area based on the intersection area of the horizontal line drawn by the longitudinal coordinates of the first upper edge point and the first lower edge point and the circumscribed rectangle of the liquid segment; Constricting the liquid area along the transverse midline; Extracting a plurality of new liquid level segments in the longitudinal direction in the constricted liquid area to determine a plurality of second upper edge points and a plurality of second lower edge points; as well as The liquid level position is determined by calculating the longitudinal average of the plurality of second upper edge points and the plurality of second lower edge points to identify the liquid level height.
9. A device for detecting the level of a bottled liquid, comprising: processor; as well as A memory storing program instructions for detecting the liquid level of bottled liquid, wherein when the program instructions are executed by the processor, the device implements the method according to any one of claims 1-8.
10. A computer-readable storage medium having stored thereon computer-readable instructions for detecting a liquid level in a bottle, wherein when the computer-readable instructions are executed by one or more processors, the method according to any one of claims 1 to 8 is implemented.
Citation Information
Patent Citations
Liquid level measuring method and device based on isosceles right triangular prism
CN101782419A
Method and device for detecting liquid level of PET bottle based on machine vision
CN106052792A
Liquid level detection method and system for bottled liquid and storage medium
CN112509039A
Liquid level detecting device
JP1997318418A
Measuring method of liquid level
JP2008261696A