Device and method for measuring the volume of liquid in a transparent container
By using photoelectric sensors and image processing technology, combined with pixel-object mapping calibration, the problems of accuracy and flexibility in liquid volume measurement in transparent containers were solved, and high-precision liquid volume calculation and 3D model generation were achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- CENT SOUTH UNIV
- Filing Date
- 2024-06-05
- Publication Date
- 2026-05-26
AI Technical Summary
Existing non-contact liquid volume measurement methods suffer from insufficient accuracy and flexibility limitations in transparent containers, especially the inability to accurately calculate liquid volume when measuring liquid level.
By employing photoelectric sensors combined with image processing technology, images of a transparent container are acquired through illumination by a light source. Image information is obtained using image acquisition equipment, and image processing and calculation are performed. Combined with pixel-object mapping calibration, liquid volume and a three-dimensional model are generated.
It achieves high-precision non-contact measurement of liquid volume in transparent containers, accurately calculates liquid volume and generates three-dimensional models, improving the accuracy and convenience of measurement and adapting to the measurement needs of different types of liquids.
Smart Images

Figure CN118485708B_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of measurement technology of optoelectronic instruments, and particularly relates to a liquid volume measuring device and method. Background Technology
[0002] Precise reagent measurement plays a crucial role in various fields. In laboratory applications, accurate reagent measurement is a prerequisite for ensuring experimental accuracy, enabling precise proportions and concentrations of different reagents, thereby ensuring the repeatability and comparability of experimental results. In the medical field, accurate liquid measurement is essential for drug preparation, liquid mixing, and ensuring the correct execution of patient treatment plans. It is worth noting that contact methods in reagent measurement can not only affect accuracy but also potentially lead to reagent contamination. Therefore, non-contact liquid volume measurement technology has become a more feasible and reliable option.
[0003] In the field of liquid measurement, ultrasonic, radar, optical, and capacitive methods are traditional and common non-contact measurement methods. While these traditional methods have achieved non-contact liquid level measurement to some extent, they still have some limitations. Radar and ultrasonic methods typically require measurement at the top of the container, limiting measurement flexibility. Capacitive measurements require customized calculation parameters for different solutions, which increases the complexity of engineering design and implementation. Although these methods are performed outside the container and do not contact the liquid being measured, they still fall short of ideal non-contact liquid measurement.
[0004] When using photoelectric sensors to detect liquids, there is no need to specifically consider the properties of the liquid, and the measurement method is more convenient. Photoelectric measurement methods encompass a variety of approaches, including laser detection and fiber optic measurement. Currently, research on photoelectric measurement mainly focuses on liquid level measurement, while research directly related to liquid volume measurement is relatively limited. Measuring only the liquid level may have some limitations in volume calculation, as liquid level measurement only provides information on the liquid's position in the vertical direction and does not consider its distribution in the horizontal direction. Volume calculation still relies on the detected liquid level and the known inner diameter of the container; therefore, to accurately calculate liquid volume, changes in the container's shape must also be considered.
[0005] Given the limitations and shortcomings of the aforementioned measurement methods, there is currently no suitable non-contact measurement method to directly achieve high-precision liquid volume detection. Summary of the Invention
[0006] With the continuous advancement of camera signal acquisition technology, measurement accuracy has been continuously improved, and the obtained image signals are becoming increasingly precise, sufficient to meet the high environmental standards required by laboratories. The continuous innovation of image processing technology has brought new possibilities to the measurement field of this invention. In view of some defects and limitations of current liquid measurement technology, this invention proposes a device and method for measuring the volume of liquid in a transparent container to overcome the deficiencies and defects mentioned in the background technology above.
[0007] To solve the above-mentioned technical problems, the technical solution proposed by this invention is a device for measuring the volume of liquid in a transparent container, comprising:
[0008] Light source; primarily used to improve the contrast of the target area and reduce shadows and interference;
[0009] A container placement unit is positioned along the light path emitted by a light source; a transparent container can be placed on the container placement unit.
[0010] An image acquisition device for capturing images of transparent containers under illumination; it can be placed behind the container placement unit and is used to capture image information inside the transparent container, providing a data basis for subsequent liquid volume measurement.
[0011] The signal processing unit is used to receive images transmitted by the image acquisition device and perform image processing and calculations;
[0012] A pixel-object mapping relationship calibration unit is installed in the human-computer interaction unit of the container placement unit or the measuring device, and is used to determine the length mapping relationship between the pixels of the image acquisition device and the actual measured object.
[0013] Preferably, in the above-mentioned measuring device, when the pixel-object mapping relationship calibration unit is installed in the container placement unit, it includes a calibration grid disposed in the container placement unit, the distance between the position of the calibration grid and the image acquisition device is equal to the distance from the center of the transparent container to the image acquisition device; and the size of the calibration grid is known in advance;
[0014] When the pixel-object mapping relationship calibration unit is installed in the human-computer interaction unit, it includes a mapping relationship calculation unit, which is used to calculate the pixel length of the object size based on the object size of the transparent container input in the human-computer interaction unit and the acquired transparent container image, so as to confirm the pixel-object mapping relationship.
[0015] Preferably, the image acquisition device of the above-mentioned measuring device includes one or more of the following: visible light camera, infrared camera, polarization camera, ultraviolet camera, terahertz camera, Raman camera, spectral camera, and X-ray camera, and the wavelength of the light source matches the wavelength acquired by the image acquisition device.
[0016] Preferably, in the above-mentioned measuring device, the container placement unit is arranged in a flat or clamping manner, and the container placement unit is equipped with a rotating device (motor-controlled rotation) that can control its rotation. The centers of the light source, the transparent container, and the image acquisition device are located on the same line.
[0017] Preferably, in the aforementioned measuring device, the signal processing unit includes an ARM microprocessor and a data processing module. The ARM microprocessor is connected to the motor and image acquisition device in the container placement unit, and the data processing module receives signals transmitted by the image acquisition device and is connected to the human-machine interface unit. The signal processing unit can obtain the liquid volume in the transparent container and a three-dimensional model of the liquid inside the container. The human-machine interface unit is used to realize information exchange and interaction between the user and the system. Through the collaborative work of input and output devices, it provides a user-friendly interface and operation method to enable the user to control the system and acquire information. The calculated liquid volume data and the corresponding three-dimensional model are transmitted to the human-machine interface unit for display.
[0018] The measuring device of the present invention is a high-precision non-contact transparent container liquid volume measuring device based on image processing. It is designed to accurately measure the volume of liquid in a transparent container and simultaneously measure the liquid level in the container and generate a three-dimensional model of the internal liquid.
[0019] As a general technical concept, the present invention also provides an image processing-based (high-precision non-contact) method for measuring the volume of liquid in a transparent container, comprising the following steps:
[0020] Step a: Acquire the original image of the transparent container filled with liquid by illuminating it with a light source, and preprocess the original image to generate image feature histograms that are correlated with different height positions;
[0021] Step b: Use an unsupervised clustering method to divide the image feature histogram data into an upper part of the image without liquid and a lower part of the image with liquid.
[0022] Step c: Perform image boundary analysis on the portion of the image above that does not contain liquid to obtain the boundary and center position data of the transparent container;
[0023] Step d: Based on the boundary and center position data of the transparent container, and combined with the statistical features of the image of the liquid below, the image is segmented to obtain an image of the meniscus, an image of the pure liquid, and an image of the bottom of the transparent container.
[0024] Step e: Perform image processing on the meniscus image and the bottom image of the transparent container to determine the image boundaries of the meniscus image, the pure liquid image, and the bottom image of the transparent container, and obtain binary images of the meniscus image, the pure liquid image, and the bottom image of the transparent container; slice and stitch the binary images to obtain a binary image of the liquid-containing image portion below.
[0025] Step f: Based on the obtained binary image of the liquid-containing area below, generate a 3D model of the liquid region of the transparent container, and determine the volume of the liquid to be measured based on the pixel-object mapping relationship.
[0026] The above-mentioned measurement method of the present invention successfully identifies the liquid position and boundary by acquiring images and combining image methods such as filtering, binarization, and unsupervised clustering based on the characteristics of the transparent container and the liquid inside the container. Finally, the liquid volume is calculated from the segmented liquid region by integrating the pixel mapping.
[0027] In the above-mentioned transparent container liquid volume measurement method, preferably, step a, the preprocessing of the original image specifically includes: first converting the original image into a grayscale image, then performing tilt correction to align the target object in the original image in the horizontal or vertical direction; then calculating the probability density of each grayscale level, and based on the corresponding threshold, realizing the conversion of the grayscale image into a binary image; finally, generating the image feature histogram by analyzing the number of black pixels in each row of the binary image.
[0028] In the preferred embodiment of the above-mentioned transparent container liquid volume measurement method, step c specifically includes: binarizing and filtering the upper part of the image without liquid, and obtaining the range of the transparent container boundary through edge detection; analyzing each row of boundaries within this range, and finding the extreme value position of the gray value by combining the gray value information of the upper part of the image without liquid within this range, and determining the positions of the left and right boundary positions of the transparent container; and further determining the center position data information of the transparent container through the positions of the left and right boundary positions.
[0029] In the preferred embodiment of the above-mentioned transparent container liquid volume measurement method, step d specifically includes the following image segmentation processing: Based on the obtained boundary and center position data of the transparent container, the liquid-containing image portion below is segmented into left and right image portions; the segmented images are filtered, the sum of gray values in each row is calculated, and normalized to obtain statistical image A; then binarized, and black pixels are counted row by row to obtain statistical image B; using the lowest point in statistical image A as the starting point, the first boundary position of statistical image B is searched downwards to determine the meniscus segmentation boundary; statistical image A is cropped using the meniscus segmentation boundary position to obtain statistical image C; statistical image C is normalized, and using its minimum value position as the starting point, the first boundary position of statistical image B is searched upwards to determine the bottom segmentation boundary of the transparent container; finally, the left and right image portions are segmented into a meniscus image, a pure liquid image, and a transparent container bottom image.
[0030] In the preferred embodiment of the above-mentioned transparent container liquid volume measurement method, step e, the image processing of the meniscus portion image includes: filtering and binarizing the image to obtain the boundary position of the binary image; then performing difference processing, and combining the boundary position and the difference value to find local features in the difference array, thereby determining the final position of the meniscus boundary; considering the discontinuity of the boundary position, selecting boundary points for polynomial fitting to obtain the image boundary of the meniscus portion image.
[0031] In the preferred embodiment of the above-mentioned transparent container liquid volume measurement method, step e involves image processing of the bottom image of the transparent container, including: filtering and binarizing the image, finding boundary positions to determine the vertical and horizontal dividing lines of the bottom image of the transparent container; then binarizing the upper left half of the original image, finding the protruding boundary, removing abnormal data, calculating the protrusion height, and traversing from the inner boundary of the protrusion outward along different height positions, obtaining the side boundary of each row by finding the local features of the difference groups, and finally confirming the protrusion height of the bottom of the transparent container, as well as the image boundaries between the pure liquid portion image and the bottom image of the transparent container.
[0032] In the preferred embodiment of the above-mentioned transparent container liquid volume measurement method, step f specifically includes the following steps: representing the liquid region in the binary image of the liquid-containing image portion below in a Cartesian coordinate system, where one pixel corresponds to one point in the coordinate system; uniformly rotating the image around the y-axis, setting the number of points taken in one rotation, and calculating the corresponding angle, generating the sine value of the corresponding angle using a sine function to ensure coverage of the entire rotation cycle; and generating a three-dimensional model of the liquid region by transforming the coordinates of the points on the two-dimensional plane according to the angle.
[0033] In the above-described method for measuring the liquid volume in a transparent container, preferably, in step f, the pixel-object mapping relationship is calculated through the following steps:
[0034] A pixel object mapping relationship calibration unit is installed in a container placement unit (2), which includes a calibration grid set in the container placement unit. The distance between the position of the calibration grid and the image acquisition device (3) is equal to the distance from the center of the transparent container to the image acquisition device (3); and the size of the calibration grid is known in advance; the pixel object mapping relationship is obtained according to the acquired image and the size of the calibration grid.
[0035] The mapping formula for the pixel-object mapping relationship is as follows:
[0036]
[0037] Where: L pixel L represents the actual mapped length of a pixel. 标 N represents the actual length of the calibration unit. 标 This indicates the number of pixels contained in the calibration unit length of the acquired image.
[0038] In the above-described method for measuring the liquid volume in a transparent container, preferably, in step f, the pixel-object mapping relationship is calculated through the following steps:
[0039] The pixel-object mapping relationship calibration unit is installed in the human-computer interaction unit (6). The real value of the outer diameter of the transparent container is input into the human-computer interaction unit (6). The pixel-object mapping relationship is obtained based on the real value of the outer diameter and the outer diameter pixel width in the acquired transparent container image. The outer diameter pixel width is obtained by statistically analyzing the feature histogram data of the liquid image part below in step b.
[0040] The mapping formula for the pixel-object mapping relationship is as follows:
[0041] In step (1), the mapping formula for the pixel-object mapping relationship is as follows:
[0042]
[0043] Where: L pixel The outer diameter L represents the actual mapped length of a pixel, the outer diameter N represents the length of the transparent container input by the user in the human-computer interaction unit, and the outer diameter N represents the number of pixels corresponding to the measured length of the transparent container in the image.
[0044] In the above-described method for measuring the volume of liquid in a transparent container, preferably, step f involves calculating the volume of the liquid to be measured, which includes the following steps:
[0045] In the binary image containing the liquid below, each column of the image is traversed, and each column corresponds to a liquid height. The volume of the current column is calculated using the formula for the volume of a cylinder, based on the current liquid height and the distance of the current column from the center of the transparent container. The cylinder volume is calculated by subtracting the length of the previous column at the same height from the cylinder volume calculated by the current column length, which is the liquid pixel volume occupied by the current column. Finally, the pixel volumes calculated for each column are summed to obtain the pixel volume of the liquid to be tested. This pixel volume value is a dimensionless numerical value.
[0046] The pixel volume of the liquid to be tested is calculated as follows:
[0047]
[0048] Where: V pixel R represents the volume of the liquid pixel calculated using pixel values, R represents the radius of the liquid pixel inside the transparent container in the image, r represents the different pixel positions of the liquid inside, and H(r) represents the height of the liquid pixel corresponding to the different pixel positions.
[0049] The volume of the liquid to be measured is calculated based on the pixel-to-object mapping relationship as follows:
[0050] V = V oixel ·L pixel 3 ;
[0051] Where: V represents the volume of the liquid to be measured, L pixel L represents the actual length of a pixel. pixel 3 This represents the actual volume represented by one pixel, using a square pixel for the camera.
[0052] Compared with the prior art, the advantages of the present invention are as follows:
[0053] (1) The width of the liquid portion in a binary image is the inner diameter of the container. Due to the presence of menisci, the volume cannot be directly calculated from the height. However, the above-mentioned technical solution of the present invention proposes a method for calculating the liquid volume based on the integration of a binary liquid image, which greatly improves the accuracy and convenience of measurement.
[0054] (2) The acquisition of liquid images in this invention is accomplished by various high-performance image sensors, which can meet the diverse needs of measuring different types of liquids;
[0055] (3) According to the high-precision non-contact transparent container liquid volume measuring device and measuring method based on image processing provided by the present invention, by adopting image processing technology, the device realizes high-precision measurement of liquid volume in transparent container without actually contacting the container surface;
[0056] (4) The measuring device of the present invention has automated processing capability, which can automatically identify and divide the liquid part, while fully taking into account the possible bulges at the bottom of the transparent container, thus ensuring accurate measurement of the liquid volume of the transparent container.
[0057] Furthermore, the measuring device of the present invention can also generate a three-dimensional model of the liquid portion, which facilitates further analysis and display. Attached Figure Description
[0058] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0059] Figure 1 This is a schematic diagram of the structure of the high-precision non-contact transparent container liquid volume measurement device based on image processing of the present invention.
[0060] Figure 2 This is a schematic diagram of the steps of the transparent container liquid volume measurement method based on image processing according to the present invention.
[0061] Figure 3 This is a schematic diagram of the process of the high-precision non-contact transparent container liquid volume measurement method based on image processing of the present invention.
[0062] Figure 4 This is a schematic diagram of the signal processing hardware connection of the signal processing unit in an embodiment of the present invention.
[0063] Figure 5 The accompanying drawings illustrate an example of image segmentation of the liquid-containing image portion of the present invention.
[0064] Legend
[0065] 1. Light source;
[0066] 2. Container placement unit;
[0067] 3. Image acquisition equipment;
[0068] 4. Rotating device;
[0069] 5. Signal processing unit;
[0070] 6. Human-computer interaction unit. Detailed Implementation
[0071] To facilitate understanding of the present invention, the present invention will be described more fully and in detail below with reference to the accompanying drawings and preferred embodiments, but the scope of protection of the present invention is not limited to the following specific embodiments.
[0072] It should be noted that when a component is described as being "fixed to, attached to, connected to or connected to" another component, it can be directly fixed to, attached to, connected to or connected to the other component, or it can be indirectly fixed to, attached to, connected to or connected to the other component through other intermediate connectors.
[0073] Unless otherwise defined, all technical terms used herein have the same meaning as commonly understood by those skilled in the art. The technical terms used herein are for the purpose of describing particular embodiments only and are not intended to limit the scope of the invention.
[0074] Unless otherwise specified, all raw materials, reagents, instruments and equipment used in this invention can be purchased from the market or prepared by existing methods.
[0075] One such Figure 1 The apparatus for measuring the volume of liquid in a transparent container according to the present invention includes:
[0076] Light source 1;
[0077] A container placement unit 2 is set on the light path emitted by the light source 1; a transparent container is placed on the container placement unit 2; the container placement unit 2 is arranged in a flat or clamping manner, and a rotating device 4 is provided on the container placement unit 2 to control its rotation; the centers of the light source 1, the transparent container, and the image acquisition device 3 are located on the same line.
[0078] Image acquisition device 3 is used to acquire images of transparent containers under illumination. In this embodiment, the image acquisition device uses an ultraviolet camera, and the wavelength of the light source 1 matches the wavelength acquired by the image acquisition device 3. The spectral receiving range is between 200nm and 400nm; the lens is a 35mm fixed-focus lens. The light source 1 is an ultraviolet light source with a wavelength of 230nm, consisting of a patch LED array and a light-diffusing plate.
[0079] The signal processing unit 5 is used to receive images transmitted by the image acquisition device 3 and perform image processing and calculations; the signal processing unit 5 is used to connect to a computer, and after image processing by computer software, the corresponding liquid volume data, three-dimensional model, and data can be sent to the human-computer interaction unit 6 to display the volume data and images. Figure 4As shown, the signal processing unit 5 includes an ARM microprocessor and a data processing module; the ARM microprocessor is connected to the motor and image acquisition device 3 in the container placement unit 2, and the data processing module receives the signal transmitted by the image acquisition device 3 and is connected to the human-machine interaction unit (6).
[0080] A pixel-object mapping calibration unit is installed in the container placement unit 2 or the human-machine interface unit 6 of the measuring device. It is used to determine the length mapping relationship between the pixels of the image acquisition device 3 and the actual measured object. When the pixel-object mapping calibration unit is installed in the container placement unit 2, it includes a calibration grid set in the container placement unit. The distance between the position of the calibration grid and the image acquisition device 3 is equal to the distance from the center of the transparent container to the image acquisition device 3; and the size of the calibration grid is known in advance.
[0081] When the pixel-object mapping relationship calibration unit is installed in the human-computer interaction unit 6, it includes a mapping relationship calculation unit, which is used to calculate the pixel length of the object size based on the object size of the transparent container input in the human-computer interaction unit 6 and the acquired transparent container image, so as to confirm the pixel-object mapping relationship.
[0082] Using the measuring device described in this embodiment, this embodiment provides a high-precision non-contact method for measuring the volume of liquid in a transparent container based on image processing, such as... Figure 2 , Figure 3 As shown, it includes the following steps:
[0083] Step 1: Start the measuring device of this embodiment. First, perform a power-on operation. The ARM microprocessor is responsible for resetting the system and initializing relevant parameters to ensure that the system is in an operable state.
[0084] Step 2: Place the transparent container sample to be tested in the container placement unit in a horizontal position. Simultaneously, upon system startup, the ARM microprocessor sends instructions to control the horizontal rotation of the transparent container sample. At the same time, the ARM microprocessor controls the image acquisition device to activate the light source, illuminating and acquiring original images of the transparent container containing the liquid, thus obtaining images of the transparent container sample from different angles. Real-time control of the rotation speed and direction by the ARM microprocessor ensures comprehensive and clear image acquisition.
[0085] Step 3: Connect the image acquisition device directly to the computer and transfer the captured image data directly to the computer for subsequent processing. Simultaneously with image data acquisition, the computer begins processing and calculating the acquired images frame by frame.
[0086] Step 4: The computer preprocesses the original image to generate image feature histograms that are correlated with the height of different locations.
[0087] Preprocessing the original image specifically includes: first converting the acquired original image into a grayscale image, and then correcting the tilt of the target object based on the captured image, so that the target object in the original image is aligned in the horizontal or vertical direction.
[0088] Step 4 specifically includes the following operations:
[0089] Step 401: Obtain the image of the transparent container, perform edge detection on the target object, and use the edges of the target object for tilt correction;
[0090] Step 402: Process the edge image using methods such as Hough transform, Radon transform, and principal component analysis to obtain the tilt angle in the edge image;
[0091] Step 403: After obtaining the tilt angle of the image, rotate and correct the image. Use bilinear interpolation during the rotation process to ensure that the pixel values of the rotated image are estimated in the appropriate positions, thus avoiding distortion and homogenization. The size of the rotated image is the same as before rotation.
[0092] It should be noted that the container placement unit is designed with two methods for fixing the container: horizontal placement and clamping. The clamping method is prone to causing the container to tilt, which can easily introduce errors in the overall volume calculation. To achieve high-precision measurement, the aforementioned preprocessing for image tilt correction will greatly improve measurement accuracy.
[0093] Step 5: For the grayscale image obtained in the above steps, calculate the probability density of each grayscale level and find an appropriate threshold to convert the grayscale image into a binary image. By analyzing the number of black pixels in each row of the binary image, generate image feature histograms that are highly correlated with different locations.
[0094] Specifically,
[0095] Step 501: During the shooting process, a light source is placed behind the transparent container. In the image, the liquid portion and the container wall have lower grayscale values compared to the background. Taking full advantage of this characteristic, by statistically analyzing the grayscale values of the entire grayscale image, it can be observed that the background occupies a large proportion, while the grayscale values of the liquid and the container wall show significant differences. Therefore, most grayscale values are concentrated near the maximum value. To fully utilize this observation, this embodiment designs an adaptive threshold acquisition method. First, the probability of each grayscale level appearing in the image is calculated, and the corresponding grayscale level with the highest probability is found. Then, by sorting the probabilities in descending order and analyzing the differences between adjacent grayscale levels, the two categories with the highest grayscale value probabilities are found. Finally, the threshold is obtained by calculating the average of the grayscale levels of the two categories, and this threshold is used to binarize the original grayscale image.
[0096] Step 502: Count the number of black pixels in each row of the binarized image to obtain an image feature histogram that is highly correlated with different positions.
[0097] Step 6: Use unsupervised clustering to divide the histogram data into two classes. By analyzing the boundary line of the clustering results, the image is divided into the upper part of the image without liquid and the lower part of the image with liquid.
[0098] Further statistical analysis of the histogram data within a certain range of the image containing the liquid below can yield the outer diameter width of the transparent container.
[0099] Step 7: Perform image boundary analysis on the portion of the image above that does not contain liquid to obtain the center position data of the transparent container.
[0100] Image boundary analysis specifically includes: first, binarizing and filtering the portion of the image above that does not contain liquid, and then obtaining the range of the transparent container boundary through edge detection; analyzing each row of boundaries within this range, and combining the grayscale value information of the portion of the image above that does not contain liquid within this range to find the extreme value positions of the grayscale values, and determining the positions of the left and right boundary sides of the transparent container; and further determining the center position data information of the transparent container through the positions of the left and right boundary sides.
[0101] More specifically,
[0102] Step 701: Binarize the image using the Otsu method and smooth it by filtering to remove irregular fluctuations that may be caused by noise, so as to ensure that subsequent edge detection and analysis operations are more stable and accurate. Then, perform edge detection using the Sobel operator to obtain the edge information of the image and find the range of the left and right boundaries.
[0103] Step 702: Analyze the left and right boundary ranges, calculate the position of the minimum gray value of the original image within each row boundary range, and the position of the minimum gray value is the position of the row boundary. The overall container boundary position can be calculated by averaging, and the center position of the container can be determined based on the left and right boundaries.
[0104] Step 8: Perform image segmentation on the liquid-containing image below to obtain images including the meniscus, the pure liquid portion, and the bottom of the transparent container.
[0105] The image segmentation process specifically includes: based on the obtained boundary and center position data of the transparent container, the image of the liquid below is segmented into left and right image parts; the segmented images are filtered, the sum of gray values in each row is calculated, and normalized to obtain statistical image A; then binarized, and black pixels are counted row by row to obtain statistical image B; using the lowest point in statistical image A as the starting point, the first boundary position of statistical image B is found downwards to determine the segmentation boundary of the meniscus; statistical image A is cropped using the segmentation boundary position of the meniscus to obtain statistical image C; statistical image C is normalized, and using its minimum value position as the starting point, the first boundary position of statistical image B is found upwards to determine the segmentation boundary of the bottom of the transparent container, such as... Figure 5 As shown, the images on the left and right sides are ultimately segmented into images of the meniscus, the pure liquid portion, and the bottom of the transparent container.
[0106] Specifically,
[0107] Step 801: Based on the calculated center position of the container, extract the left and right halves of the image of the liquid-containing portion below. The processing method for the left and right halves of the image is the same; the following explanations of this part will use the left half image.
[0108] Step 802: Perform Gaussian filtering on the left half of the image, sum the gray values of each row, and normalize to obtain statistical image A. Binarize this part of the image and count the black pixels row by row to obtain statistical image B. Starting from the lowest point found in statistical image A, traverse statistical image B downwards to find the first boundary position of statistical image B as the segmentation boundary position of the meniscus.
[0109] Step 803: Using the found meniscus segmentation boundary position as the basis, crop the statistical graph A, removing the meniscus portion to obtain the cropped statistical graph C. Similarly, re-normalize the cropped statistical graph C, find the position corresponding to the minimum value, and use the lowest point position found in statistical graph C as the starting position to traverse statistical graph B upwards. The first boundary position of statistical graph B is found as the segmentation boundary for the bottom of the transparent container. Finally, the image portions on the left and right sides are divided into three parts: the meniscus portion image, the pure liquid portion image, and the transparent container bottom image.
[0110] Step 9: Perform image processing on the meniscus image and the bottom image of the transparent container to determine the image boundaries of the meniscus image, the pure liquid image, and the bottom image of the transparent container, and obtain binary images of the meniscus image, the pure liquid image, and the bottom image of the transparent container; slice and stitch the binary images to obtain a binary image of the liquid-containing image portion below.
[0111] Image processing of the meniscus portion image includes: filtering and binarizing the image to obtain the boundary position of the binary image; then performing difference processing, and combining the boundary position and the difference value to find local features in the difference array, thereby determining the final position of the meniscus boundary; considering the discontinuity of the boundary position, selecting boundary points for polynomial fitting to obtain the image boundary of the meniscus portion image.
[0112] It is important to note that, due to surface tension and the interaction forces between adjacent solid surfaces, the surface of a liquid in a tiny container typically exhibits a meniscus shape. Surface tension causes the liquid surface to tend to minimize its surface area, and this tendency is even more pronounced at microscales. When a liquid comes into contact with the solid surface of a tiny container, the adjacent solid-liquid interaction forces also participate, resulting in an uneven surface. Therefore, paying attention to the shape of the meniscus is crucial for accurately calculating the liquid volume.
[0113] Specifically,
[0114] Step 901: Smooth the image using a low-pass filter, binarize the image using the Otsu method, and find the boundary positions of the binarized image column by column. Then, perform first-order difference on the original image, starting from the boundary position of each column of the binarized image and traversing upwards for 5-10 pixels to find the position corresponding to the maximum difference value in this region, and update the boundary positions of each column.
[0115] Step 902: After finding the boundaries of each column, since some are discontinuous, a cubic polynomial fitting is performed on these boundary points to confirm the final meniscus boundary.
[0116] Image processing of the transparent container bottom image includes: filtering and binarizing the image to locate boundary positions and determine the vertical and horizontal boundaries of the transparent container bottom image; then binarizing the upper left half of the original image, locating the raised boundary, removing outliers, calculating the raised height, and traversing from the inner boundary of the raised area outwards along different height positions, obtaining the side boundary of each row by finding the local features of the difference groups, and finally confirming the raised height of the transparent container bottom, as well as the image boundaries between the pure liquid portion and the transparent container bottom image. It should be noted that the central area of the bottom of a typical transparent container is usually accompanied by small raised areas, which may affect the accurate detection of liquid volume. These raised areas are usually observable on the left and right sides of the bottom of the container image.
[0117] Specifically,
[0118] Step 903: Low-pass filtering is applied to the original image, and the Otsu method is used to binarize the image to find the first boundary position of each column. Unsupervised clustering is used to calculate the higher and lower boundaries of the edge positions, determining the vertical boundary line of the bottom image; the horizontal boundary line of the bottom image is determined by calculating the mean of the lower part. The horizontal boundary line divides the bottom image into upper and lower parts. The vertical boundary line further divides the upper half of the bottom image into left and right parts. The upper left part of the image contains information about the bottom bulge.
[0119] Step 904: Image processing for the upper left portion: The image is binarized using oust. The boundaries of each column in the binary image are located. Data is filtered at the boundary positions, and the mean and standard deviation of the overall data are calculated. Data with large discrepancies from the mean are deleted. The average value of the boundary positions is calculated, which is the height of the protrusion. Based on the height of the protrusion, the side boundaries of the protrusion are calculated downwards, and the first boundary from right to left in each row is calculated. The difference value of this part of the image is calculated. Starting from the boundary of each row, traverse 3-5 pixels outwards to find the local maximum value of the difference at the corresponding position, thereby determining the column boundary of each row. In the upper left half of the image, the row boundary is the height of the protrusion at the bottom of the container, and the column boundary is the starting point of the protrusion in each row. Starting from the column boundary of each row, the right side of the column boundary is the protruding material part, and the left side of the column boundary is the liquid. The lower half is entirely the container material part.
[0120] The binary images of the obtained meniscus portion, pure liquid portion, and bottom of the transparent container are sliced and stitched together to obtain the binary image of the liquid portion below. Specifically, this involves: representing the three portions using binary images; the liquid portion's pixel size is represented by the number 1, and white is used to represent it; the pure liquid portion in the middle can be directly represented entirely by the number 1. Binarized images of the top meniscus portion and the bottom of the transparent container are generated based on the aforementioned segmentation boundaries. The three generated binary images are then stitched together to obtain the complete binary image of the liquid portion.
[0121] Step 10: This invention can generate a 3D model based on the extracted binary image of the internal liquid. Most transparent containers can be obtained by rotating them along a central axis. Utilizing this characteristic, the left and right halves of the internal liquid binary image are rotated along the central axis of the liquid binary image to obtain a 3D model of the liquid portion. Therefore, based on the obtained binary image of the portion containing the liquid below, a 3D model of the liquid area of the transparent container is generated, and the volume of the liquid to be measured is obtained based on the pixel-object mapping relationship.
[0122] The generation of the 3D model specifically includes: representing pixels with a value of 1 in the liquid region of the binary image in a Cartesian coordinate system according to their positional relationship within the image, with one pixel corresponding to one point in the coordinate system; performing mirroring, translation, and other operations on the 2D image in the coordinate system to uniformly shift the central axis to the y-axis; uniformly rotating the image around the y-axis, setting the number of points to be taken in one rotation, and calculating the corresponding angle; generating the sine value of the corresponding angle using a sine function to ensure coverage of the entire rotation cycle; and generating the 3D model of the liquid region by transforming the coordinates of the points on the 2D plane according to the angle.
[0123] In calculating liquid volume, the presence of curved liquid surfaces makes it impossible to directly represent the liquid height for volume calculation. Therefore, this invention proposes a liquid volume calculation method based on binary images. This method utilizes an image composed of pixel blocks, combining integration and the mapping relationship between pixels and real objects to achieve high-precision liquid volume calculation.
[0124] Specifically,
[0125] Step 1001: The mapping relationship between pixels and real objects can be calculated based on the calibration units in the image. In the human-computer interaction unit, the user can input the data value of the outer diameter of the transparent container. Based on the actual outer diameter and the corresponding outer diameter pixel width calculated in image processing, the ratio between camera pixels and the real object can also be obtained. This allows the user to directly input and calibrate the dimensions in the image.
[0126] The mapping formula is as follows:
[0127]
[0128] Where: L pixel The value represents the actual mapped length of a pixel. The L-label represents the actual length of the calibration unit. The N-label represents the number of pixels contained in the calibration unit length in the image. The L-outer diameter represents the outer diameter length of the transparent container input by the user in the human-computer interaction unit. The N-outer diameter represents the number of pixels corresponding to the measured outer diameter length of the transparent container in the image.
[0129] Step 1002: For calculating the liquid volume, the liquid portion is also divided into left and right halves of the image for processing, with the processing method being the same for both halves. Each column of the binary image is traversed; each column corresponds to a liquid height and a radius corresponding to the distance from the central axis. Using the cylinder volume formula, the volume of the current column is calculated from the current liquid height and the distance of the current column from the center of the container. The cylinder volume calculated for the current column length is subtracted from the cylinder volume calculated for the previous column length at the same height; this gives the liquid pixel volume occupied by the current column. Finally, the pixel volumes calculated for each column are summed to obtain the pixel volume of the liquid portion. This pixel volume value is a dimensionless numerical value.
[0130] The pixel volume of the liquid to be tested is calculated as follows:
[0131]
[0132] Where: V pixel Let H(r) represent the volume of the liquid pixel calculated using pixel values, R represent the radius of the liquid pixel inside the transparent container in the image, r represent the different pixel positions of the liquid inside, and H(r) represent the liquid height corresponding to different pixel positions.
[0133] The volume of the liquid to be measured is calculated based on the pixel-to-object mapping relationship as follows:
[0134] V = V pixel ·L pixel 3 ;
[0135] Where: V represents the actual liquid volume, L pixel L represents the actual length of a pixel. pixel 3 This represents the actual volume represented by one pixel, using a square pixel for the camera.
[0136] The liquid volume of the image is obtained by averaging the liquid volumes obtained from the left and right halves of the image.
[0137] Step 1003: During signal acquisition, images of the transparent container at different angles were obtained. The liquid volume of each image was calculated, and the average of these volume values was taken to obtain the final liquid volume of the transparent container. By combining the liquid volume data from images at various angles, the measurement error of a single angle was eliminated through averaging.
[0138] Step 11: Output Display Process: The calculated liquid volume data and corresponding 3D model are transmitted to the interactive system for clear and intuitive display. This step aims to present accurate liquid volume information to the user through the interactive system and provide a visualized 3D model, allowing the user to fully understand the distribution and volume of the liquid within the transparent container.
[0139] All of the above processes constitute a complete implementation scheme for high-precision non-contact transparent container liquid volume measurement based on image processing.
[0140] The above-mentioned measurement method of the present invention successfully identifies the liquid position and boundary by acquiring images and combining image methods such as filtering, binarization, and unsupervised clustering based on the characteristics of the transparent container and the liquid inside the container. Finally, the liquid volume is calculated from the segmented liquid region by integrating the pixel mapping.
[0141] Example 1:
[0142] According to the above implementation scheme, a visible light camera was used to test transparent reagent bottles, including four groups of bottles with liquid volumes of 1.9814 ml, 1.4157 ml, 0.5400 ml, and 1.1811 ml, respectively. During the test, 20 images of each group of reagent bottles were taken from different angles, totaling 80 images. These images were then processed and calculated using the proposed high-precision non-contact transparent container liquid volume measurement method based on image processing.
[0143] The test results are shown in Table 1. The table shows the average values of the measured images from different angles. The errors between the measured values and the true values are 2.26%, 2.29%, 2.28%, and 2.10%, respectively.
[0144] Example 2:
[0145] According to the above implementation scheme, an infrared camera was used to test transparent reagent bottles, including four groups of bottles with liquid volumes of 1.9814 ml, 1.4157 ml, 0.5400 ml, and 1.1811 ml, respectively. During the test, 20 images of each group of reagent bottles from different angles were captured, totaling 80 images. These images were then processed and calculated using the proposed high-precision non-contact transparent container liquid volume measurement method based on image processing.
[0146] The test results are shown in Table 1. The table shows the average values of the measured images at different angles. The errors between the measured values and the true values are 1.01%, 0.70%, 0.70%, and 1.13%, respectively.
[0147] Example 3:
[0148] According to the above implementation scheme, a UV camera was used to test transparent reagent bottles, including four groups of bottles with liquid volumes of 1.9814 ml, 1.4157 ml, 0.5400 ml, and 1.1811 ml, respectively. During the test, 20 images of each group of bottles were taken from different angles, totaling 80 images. These images were then processed and calculated using the proposed high-precision non-contact transparent container liquid volume measurement method based on image processing.
[0149] The test results are shown in Table 1. The table shows the average values of the measured images from different angles. The errors between the measured values and the true values are 1.36%, 1.08%, 1.65%, and 0.85%, respectively.
[0150] Example 4:
[0151] According to the above implementation scheme, a polarization camera was used to test transparent reagent bottles, including four groups of bottles with liquid volumes of 1.9814 ml, 1.4157 ml, 0.5400 ml, and 1.1811 ml, respectively. During the test, 20 images of each group of reagent bottles were taken from different angles, totaling 80 images. These images were then processed and calculated using the proposed high-precision non-contact transparent container liquid volume measurement method based on image processing.
[0152] The test results are shown in Table 1. The table shows the average values of the measured images from different angles. The errors between the measured values and the true values are 3.08%, 3.41%, 4.39%, and 1.96%, respectively.
[0153] Example 5:
[0154] According to the above implementation scheme, a terahertz camera was used to test transparent reagent bottles, including four groups of bottles with liquid volumes of 1.9814 ml, 1.4157 ml, 0.5400 ml, and 1.1811 ml, respectively. During the test, 20 images from different angles were captured for each group of bottles, totaling 80 images. These images were then processed and calculated using the proposed high-precision non-contact transparent container liquid volume measurement method based on image processing.
[0155] The test results are shown in Table 1. The table shows the average values of the measured images from different angles. The errors between the measured values and the true values are 1.74%, 1.73%, 3.70%, and 2.51%, respectively.
[0156] Example 6:
[0157] According to the above implementation scheme, a Raman camera was used to test transparent reagent bottles, including four groups of bottles with liquid volumes of 1.9814 ml, 1.4157 ml, 0.5400 ml, and 1.1811 ml, respectively. During the test, 20 images of each group of bottles were taken from different angles, totaling 80 images. These images were then processed and calculated using the proposed high-precision non-contact transparent container liquid volume measurement method based on image processing.
[0158] The test results are shown in Table 1. The table shows the average values of the measured images from different angles after calculation. The errors between the measured values and the true values are 2.30%, 2.02%, 1.72%, and 1.04%, respectively.
[0159] Example 7:
[0160] According to the above implementation scheme, a multispectral camera was used to test transparent reagent bottles, including four groups of bottles with liquid volumes of 1.9814 ml, 1.4157 ml, 0.5400 ml, and 1.1811 ml, respectively. During the test, 20 images from different angles were captured for each group of bottles, totaling 80 images. These images were then processed and calculated using the proposed high-precision non-contact transparent container liquid volume measurement method based on image processing.
[0161] The test results are shown in Table 1. The table shows the average values of the measured images from different angles. The errors between the measured values and the true values are 1.84%, 1.99%, 2.28%, and 3.01%, respectively.
[0162] Example 8:
[0163] According to the above implementation scheme, a hyperspectral camera was used to test transparent reagent bottles, including four groups of bottles with liquid volumes of 1.9814 ml, 1.4157 ml, 0.5400 ml, and 1.1811 ml, respectively. During the test, 20 images from different angles were captured for each group of bottles, totaling 80 images. These images were then processed and calculated using the proposed high-precision non-contact transparent container liquid volume measurement method based on image processing.
[0164] The test results are shown in Table 1. The table shows the average values of the measured images from different angles. The errors between the measured values and the true values are 1.08%, 1.19%, 2.03%, and 2.11%, respectively.
[0165] Example 9:
[0166] According to the above implementation scheme, an infrared spectroscopy camera was used to test transparent reagent bottles, including four groups of bottles with liquid volumes of 1.9814 ml, 1.4157 ml, 0.5400 ml, and 1.1811 ml, respectively. During the test, 20 images from different angles were captured for each group of bottles, totaling 80 images. These images were then processed and calculated using the proposed high-precision non-contact transparent container liquid volume measurement method based on image processing.
[0167] The test results are shown in Table 1. The table shows the average values of the measured images from different angles. The errors between the measured values and the true values are 0.61%, 0.87%, 1.80%, and 0.54%, respectively.
[0168] Example 10:
[0169] According to the above implementation scheme, a UV spectroscopy camera was used to test transparent reagent bottles, including four groups of bottles with liquid volumes of 1.9814 ml, 1.4157 ml, 0.5400 ml, and 1.1811 ml, respectively. During the test, 20 images from different angles were captured for each group of bottles, totaling 80 images. These images were then processed and calculated using the proposed high-precision non-contact transparent container liquid volume measurement method based on image processing.
[0170] The test results are shown in Table 1. The table shows the average values of the measured images from different angles. The errors between the measured values and the true values are 1.05%, 1.74%, 2.56%, and 1.12%, respectively.
[0171] Example 11:
[0172] According to the above implementation scheme, a terahertz spectral camera was used to test transparent reagent bottles, including four groups of bottles with liquid volumes of 1.9814 ml, 1.4157 ml, 0.5400 ml, and 1.1811 ml, respectively. During the test, 20 images from different angles were captured for each group of bottles, totaling 80 images. These images were then processed and calculated using the proposed high-precision non-contact transparent container liquid volume measurement method based on image processing.
[0173] The test results are shown in Table 1. The table shows the average values of the measured images at different angles. The errors between the measured values and the true values are 2.12%, 2.98%, 3.43%, and 2.16%, respectively.
[0174] Example 12:
[0175] According to the above implementation scheme, Raman spectroscopy cameras were used to test transparent reagent bottles, including four groups of bottles with liquid volumes of 1.9814 ml, 1.4157 ml, 0.5400 ml, and 1.1811 ml, respectively. During the test, 20 images from different angles were captured for each group of bottles, totaling 80 images. These images were then processed and calculated using the proposed high-precision non-contact transparent container liquid volume measurement method based on image processing.
[0176] The test results are shown in Table 1. The table shows the average values of the measured images from different angles. The errors between the measured values and the true values are 1.73%, 2.20%, 0.68%, and 0.99%, respectively.
[0177] Example 13:
[0178] According to the above implementation scheme, X-ray cameras were used to test transparent reagent bottles, including four sets of bottles with liquid volumes of 1.9814 ml, 1.4157 ml, 0.5400 ml, and 1.1811 ml, respectively. During the test, 20 images from different angles were captured for each set of bottles, totaling 80 images. These images were then processed and calculated using the proposed high-precision non-contact transparent container liquid volume measurement method based on image processing.
[0179] The test results are shown in Table 1. The table shows the average values of the measured images from different angles after calculation. The errors between the measured values and the true values are 0.33%, 0.20%, 0.65%, and 0.44%, respectively.
[0180] Table 1: Comparison of liquid volume measurement errors after different cameras were applied to the method of the present invention in various embodiments.
[0181]
Claims
1. A method for measuring the volume of a liquid in a transparent container based on image processing, characterized in that, Includes the following steps: Step a: Acquire the original image of the transparent container filled with liquid by illuminating it with a light source, and preprocess the original image to generate image feature histograms that are correlated with different height positions; Step b: Use an unsupervised clustering method to divide the image feature histogram data into an upper part of the image without liquid and a lower part of the image with liquid. Step c: Perform image boundary analysis on the portion of the image above that does not contain liquid to obtain the boundary and center position data of the transparent container; Step d: Based on the boundary and center position data of the transparent container, and combined with the statistical features of the image of the liquid below, the image is segmented to obtain an image of the meniscus, an image of the pure liquid, and an image of the bottom of the transparent container. Step e: Perform image processing on the meniscus image and the bottom image of the transparent container to determine the image boundaries of the meniscus image, the pure liquid image, and the bottom image of the transparent container, and obtain binary images of the meniscus image, the pure liquid image, and the bottom image of the transparent container. The binary image slices are stitched together to obtain a binary image of the liquid-containing portion below; Step f: Based on the obtained binary image of the liquid-containing portion below, generate a 3D model of the liquid area in the transparent container, and determine the volume of the liquid to be tested based on the pixel-to-object mapping relationship; the calculation of the volume of the liquid to be tested includes the following steps: In the binary image containing the liquid below, each column of the image is traversed, and each column corresponds to a liquid height. The volume of the current column is calculated based on the current liquid height and the distance of the current column from the center of the transparent container according to the cylinder volume formula. The cylinder volume calculated by the current column length is subtracted from the cylinder volume calculated by the previous column length at the same height, which gives the liquid pixel volume occupied by the current column. Finally, the pixel volumes calculated for each column are summed to obtain the pixel volume of the liquid to be tested. The pixel volume of the liquid to be tested is calculated as follows: ; in: This represents the volume of the liquid pixel calculated using pixel values, where R represents the radius of the liquid pixel inside the transparent container in the image, and r represents the different pixel positions of the liquid inside. H (r) represents the height of the liquid pixel at different pixel positions; The volume of the liquid to be measured is calculated based on the pixel-to-object mapping relationship as follows: ; in:, Indicates the volume of the liquid to be measured. This represents the actual length of a pixel. This represents the actual volume represented by one pixel, using a square pixel for the camera.
2. The method for measuring the volume of liquid in a transparent container according to claim 1, characterized in that, In step a, the preprocessing of the original image specifically includes: first converting the original image into a grayscale image, then performing tilt correction to align the target objects in the original image in the horizontal or vertical direction; then calculating the probability density of each grayscale level, and based on the corresponding threshold, realizing the conversion of the grayscale image into a binary image; finally, generating the image feature histogram by analyzing the number of black pixels in each row of the binary image.
3. The method for measuring the liquid volume in a transparent container according to claim 1, characterized in that, In step c, the image boundary analysis specifically includes: first, binarizing and filtering the upper part of the image without liquid, and obtaining the range of the transparent container boundary through edge detection; analyzing each row of boundaries within this range, and combining the gray value information of the upper part of the image without liquid within this range to find the extreme value position of the gray value, and determining the positions of the left and right boundary positions of the transparent container; and further determining the center position data information of the transparent container through the positions of the left and right boundary positions.
4. The method for measuring the liquid volume in a transparent container according to claim 1, characterized in that, In step d, the image segmentation process specifically includes: based on the obtained boundary and center position data of the transparent container, the image portion containing the liquid below is segmented into left and right image portions; the segmented images are filtered, the sum of gray values in each row is calculated, and normalized to obtain statistical image A; then binarized, and black pixels are counted row by row to obtain statistical image B; using the lowest point in statistical image A as the starting point, the first boundary position of statistical image B is found downwards to determine the segmentation boundary of the meniscus portion; statistical image A is cropped using the segmentation boundary position of the meniscus portion to obtain statistical image C; statistical image C is normalized, and using its minimum value position as the starting point, the first boundary position of statistical image B is found upwards to determine the segmentation boundary of the bottom of the transparent container, and finally the left and right image portions are segmented into meniscus portion image, pure liquid portion image, and transparent container bottom image.
5. The method for measuring the liquid volume in a transparent container according to claim 4, characterized in that, In step e, image processing of the meniscus portion image includes: filtering and binarizing the image to obtain the boundary position of the binary image; then performing difference processing, and combining the boundary position and the difference value to find local features in the difference array, thereby determining the final position of the meniscus boundary; and performing polynomial fitting on the selected boundary points to obtain the image boundary of the meniscus portion image.
6. The method for measuring the liquid volume in a transparent container according to claim 4, characterized in that, In step e, image processing of the bottom image of the transparent container includes: filtering and binarizing the image, finding boundary positions to determine the vertical and horizontal dividing lines of the bottom image of the transparent container; then binarizing the upper left half of the original image, finding the protrusion boundary, removing abnormal data, calculating the protrusion height, and traversing from the inner boundary of the protrusion outward along different height positions, obtaining the side boundary of each row by finding the local features of the difference group, and finally confirming the protrusion height of the bottom of the transparent container, as well as the image boundaries between the pure liquid part image and the bottom image of the transparent container.
7. The method for measuring the liquid volume in a transparent container according to any one of claims 1-6, characterized in that, In step f, the generation of the three-dimensional model specifically includes: representing the liquid region in the binary image of the liquid-containing image portion below in a Cartesian coordinate system, with one pixel corresponding to one point in the coordinate system; uniformly rotating the image around the y-axis, setting the number of points taken in one rotation, and calculating the corresponding angle, generating the sine value of the corresponding angle using a sine function to ensure coverage of the entire rotation cycle; and generating a three-dimensional model of the liquid region by transforming the coordinates of the points on the two-dimensional plane according to the angle.
8. The method for measuring the liquid volume in a transparent container according to any one of claims 1-6, characterized in that, In step f, the pixel-object mapping relationship is calculated through the following steps: A pixel object mapping relationship calibration unit is installed in a container placement unit (2), which includes a calibration grid set in the container placement unit. The distance between the position of the calibration grid and the image acquisition device (3) is equal to the distance from the center of the transparent container to the image acquisition device (3); and the size of the calibration grid is known in advance; the pixel object mapping relationship is obtained according to the acquired image and the size of the calibration grid. The mapping formula for the pixel-object mapping relationship is as follows: ; in: This represents the actual mapped length of a pixel. Indicates the actual length of the calibration unit. This indicates the number of pixels contained in the calibration unit length of the acquired image.
9. The method for measuring the liquid volume in a transparent container according to any one of claims 1-6, characterized in that, In step f, the pixel-object mapping relationship is calculated through the following steps: The pixel-object mapping relationship calibration unit is installed in the human-computer interaction unit (6). The real value of the outer diameter of the transparent container is input into the human-computer interaction unit (6). The pixel-object mapping relationship is obtained based on the real value of the outer diameter and the outer diameter pixel width in the acquired transparent container image. The outer diameter pixel width is obtained by statistically analyzing the feature histogram data of the liquid-containing image part below in step b. The mapping formula for the pixel-object mapping relationship is as follows: ; in: This represents the actual mapped length of a pixel. This represents the outer diameter length of the transparent container input by the user in the human-computer interaction unit. This represents the number of pixels corresponding to the measured outer diameter length of the transparent container in the image.
10. A measuring device for measuring the volume of liquid in a transparent container, used in the method for measuring the volume of liquid in a transparent container according to any one of claims 1-9, characterized in that, include: Light source (1); A container placement unit (2) is set in the light path emitted by the light source (1); a transparent container can be placed on the container placement unit (2); Image acquisition device for acquiring images of transparent containers under illumination (3); The signal processing unit (5) is used to receive the image transmitted by the image acquisition device (3) and perform image processing and calculation; A pixel-object mapping relationship calibration unit is installed in the container placement unit (2) or the human-computer interaction unit (6) of the measuring device to determine the length mapping relationship between the pixels of the image acquisition device (3) and the actual measured object.
11. The measuring device according to claim 10, characterized in that, When the pixel physical mapping relationship calibration unit is installed in the container placement unit (2), it includes a calibration grid set in the container placement unit. The distance between the position of the calibration grid and the image acquisition device (3) is equal to the distance from the center of the transparent container to the image acquisition device (3); and the size of the calibration grid is known in advance. When the pixel-object mapping relationship calibration unit is installed in the human-computer interaction unit (6), it includes a mapping relationship calculation unit, which is used to calculate the pixel length of the object size based on the object size of the transparent container input in the human-computer interaction unit (6) and the collected transparent container image, so as to confirm the pixel-object mapping relationship.
12. The measuring device according to claim 10, characterized in that, The image acquisition device (3) includes one or more of the following: visible light camera, infrared camera, polarization camera, ultraviolet camera, terahertz camera, Raman camera, spectral camera, and X-ray camera. The wavelength of the light source (1) matches the wavelength acquired by the image acquisition device (3).
13. The measuring device according to claim 10, characterized in that, The container placement unit (2) is laid flat or clamped. The container placement unit (2) is equipped with a rotating device (4) that can control its rotation. The centers of the light source (1), the transparent container, and the image acquisition device (3) are located on the same line.
14. The measuring device according to claim 10, characterized in that, The signal processing unit (5) includes an ARM microprocessor and a data processing module; the ARM microprocessor is connected to the motor and image acquisition device (3) in the container placement unit (2), and the data processing module receives the signal transmitted by the image acquisition device (3) and is connected to the human-machine interaction unit (6).