Image recognition liquid level measurement method and system for an arrayed graduated cylinder

CN122708902APending Publication Date: 2026-09-08DALIAN UNIV OF TECH
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611015204.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-07-09
Publication Date
2026-09-08

AI Technical Summary

Technical Problem

[0008]针对背景技术中所述阵列式量筒密集排布场景下现有图像识别液位测量方案存在的现场标定繁琐、缺乏视角偏移补偿、极端液位精度不足三方面技术难点,本发明提出一种阵列式量筒的图像识别液位测量方法与系统

Benefits of technology

(1)本发明通过采集阵列式量筒组的整体图像并自动识别各量筒液位,实现量筒液位的全自动测量,避免了人工逐管读数与数据誊录环节。针对一组规模为N个的阵列式量筒(典型 N=64~144),测量耗时由人工方式的约30~60分钟降低至30秒以内(效率提升约60倍以上);同时彻底规避了人工读数与人工记录引入的随机误差,单管液位测量精度达到±0.5mm以内。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122708902A_ABST
    Figure CN122708902A_ABST
Patent Text Reader

Abstract

The present application belongs to the technical field of machine vision measurement, and relates to an image recognition liquid level measurement method and system for an array type measuring cylinder. In the present application, a characteristic marker line is arranged at the edge of the array type measuring cylinder, so that camera calibration information and liquid level measurement information are acquired simultaneously in single imaging; by matching feature points between a to-be-measured image and a pre-established template image, the offset angle and offset position of an imaging device relative to the coordinate system of the measuring cylinder are solved online, and the calculation results of the liquid level height of each measuring cylinder are error compensated. The array type measuring cylinder group and the edge characteristic marker line thereof are imaged at a tilted visual angle, and image preprocessing such as color space standardization, illumination non-uniformity correction and liquid surface edge enhancement is sequentially completed, and the preprocessed image is subjected to adaptive threshold binarization to separate the liquid surface from the background; and a threshold adaptive iterative adjustment mechanism is provided. The present application realizes full-automatic, rapid and high-precision measurement of the liquid level of the array type measuring cylinder, and can be directly used for nozzle spraying uniformity detection.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of machine vision measurement technology, specifically relating to an image recognition liquid level measurement method and system for an array-type graduated cylinder, which can be used to realize automatic liquid level detection in industrial production and scientific experimental scenarios. Background Technology

[0002] In the development of industrial production and laboratory spray systems, it is usually necessary to test the uniformity of spraying to evaluate the performance of the spray device. Traditional testing methods often use an array of graduated cylinders to collect liquid. By capturing the liquid distribution in the field through the array of graduated cylinders, the mass or volume of liquid in each cylinder is then manually measured to calculate the spray density distribution. This method is a key means of determining the core performance of nozzles and spray devices.

[0003] However, in existing technologies, liquid level measurement for array-type graduated cylinder groups still relies on manual operation: experimenters need to read the liquid level scale of each graduated cylinder individually, or calculate the liquid level by weighing the liquid mass, and then manually record and organize the liquid level data of all graduated cylinders to analyze the liquid distribution effect of the nozzle. This measurement method has many technical drawbacks. First, the array-type graduated cylinder group has a large number of measurement points, and the manual measurement process is cumbersome, time-consuming, and extremely inefficient, making it difficult to meet the needs of batch testing in industrial settings and rapid laboratory experiments. Second, manual readings are easily affected by visual errors and reading habits, and human errors are also prone to occur during the recording and data organization process, resulting in large liquid level measurement errors, which directly affect the accuracy of the nozzle liquid distribution detection results. Third, manual measurement requires static operation after the experiment, making it impossible to achieve real-time liquid level acquisition and difficult to capture the dynamic changes in liquid level during nozzle spraying.

[0004] While there are a few attempts at liquid level measurement based on image recognition in the current technology, most of the relevant solutions are designed for single graduated cylinders and are not adapted to the structural characteristics of array graduated cylinder groups with multiple measurement points and dense arrangement. Furthermore, they do not take into account practical issues such as changes in lighting conditions and camera shooting angle shifts in industrial laboratories. As a result, the measurement accuracy and scene adaptability are poor, and they cannot be directly applied to array graduated cylinder liquid level detection for nozzle liquid distribution testing.

[0005] Further analysis of existing image recognition liquid level measurement technology reveals the following unresolved core technical challenges: Firstly, there is a lack of simplified on-site calibration methods for densely arranged array-type graduated cylinders. Existing solutions generally rely on offline camera calibration using checkerboard or Zhang Zhengyou calibration methods. The calibration process is cumbersome, time-consuming, and requires high camera positioning accuracy, making it unsuitable for spray test sites where frequent changes in testing conditions are required. Secondly, it lacks the ability to compensate for shooting perspective shifts online. Once there is a difference between the camera position and the offline calibration during actual shooting, the liquid level readings of the entire array of graduated cylinders will be subject to systematic deviations. The amount of deviation varies depending on the position of the graduated cylinder in the image, and graduated cylinders located at the edge of the image or in positions with severe perspective distortion are particularly affected. Third, the binarization threshold of existing image recognition liquid level measurement schemes has significantly reduced accuracy in extreme liquid level scenarios (liquid level close to the upper and lower limits of the range) or abnormal liquid level distribution scenarios (outliers caused by uneven spraying), and cannot adapt to the various working conditions that may occur at the spraying test site. Fourth, existing image recognition liquid level measurement solutions generally lack a physical length reference built into the image; in order to convert the identified pixel-level liquid level readings into physical lengths (millimeters), it is necessary to perform checkerboard offline calibration or pre-input parameters such as camera focal length and sensor pixel size; once the camera position, focal length, or lens changes, offline calibration must be re-performed, which further increases the implementation cost at the spray test site.

[0006] The aforementioned technical challenges mean that while existing image recognition liquid level measurement schemes are feasible in principle, they have poor adaptability in practical engineering applications of spray testing. There is an urgent need for an image recognition liquid level measurement method that can avoid cumbersome on-site calibration, automatically compensate for viewing angle shifts, and be robust to extreme liquid level scenarios, especially for scenarios with dense arrays of graduated cylinders.

[0007] Therefore, in response to the actual needs of spray distribution testing of spray devices, an automatic liquid level measurement method is developed that is compatible with array-type graduated cylinder groups, can avoid the defects of manual operation, and balances measurement efficiency and accuracy. This method enables rapid, accurate, and automated detection of liquid levels in array-type graduated cylinders, reduces human intervention, and has significant engineering application value for improving the overall efficiency of nozzle performance testing and ensuring the accuracy of test results. Summary of the Invention

[0008] To address the three technical challenges of existing image recognition liquid level measurement schemes in scenarios with densely arranged array graduated cylinders as described in the background art—namely, cumbersome on-site calibration, lack of viewpoint offset compensation, and insufficient accuracy in extreme liquid level scenarios—this invention proposes an image recognition liquid level measurement method and system for array graduated cylinders.

[0009] The core improvement of this invention lies in: (1) By setting feature marking lines with known geometric parameters on the edge of the array-type graduated cylinder, the camera calibration information (the mapping relationship between the image coordinate system and the physical coordinate system of the graduated cylinder) and the liquid level measurement information are acquired simultaneously in a single imaging process, which eliminates the offline camera calibration step required by the traditional scheme. The feature marking lines essentially constitute "on-site calibration reference objects that enter the imaging field of view along with the array-type graduated cylinder". (2) By matching the feature points of the image to be measured obtained by each shooting with the pre-acquired template image, the offset angle and offset position parameters of the imaging device relative to the measuring cylinder coordinate system are calculated online, and the error compensation is performed on the calculation results of the liquid level height of each measuring cylinder based on these parameters; thus, this method no longer requires the imaging device to be precisely positioned before each measurement, and the liquid level reading of each measuring cylinder in the array measuring cylinder group (regardless of whether it is in the center or the edge position in the image) is incorporated into a unified, quantifiable, and compensable geometric model of perspective offset, eliminating the systematic position-related measurement deviation caused by perspective distortion; (3) To address extreme liquid levels (close to the upper and lower limits of the measuring cylinder range) and abnormal liquid level distribution (outliers caused by uneven spraying) that may occur at the spray test site, an adaptive iterative adjustment mechanism for the binarization threshold is set up so that the method can maintain stable measurement accuracy under various working conditions.

[0010] The feature marking line scheme described in (1) and the template comparison scheme described in (2) complement each other to form the core technical route of the present invention. The feature marking line provides the geometric reference for establishing the graduated cylinder coordinate system, and the template comparison provides the online quantification result of the viewpoint offset. Together, they achieve high-precision automatic measurement of the liquid level of each graduated cylinder in a densely arranged array of graduated cylinders without relying on offline calibration or requiring precise camera positioning.

[0011] The technical solution of the present invention is as follows: A method for measuring liquid level using an array-type graduated cylinder based on image recognition includes the following steps: Step S1: Using an imaging device, take an image of the array of graduated cylinders containing feature marking lines at an angle that simultaneously brings the graduated cylinder mouth and the graduated cylinder side wall scale into the field of view, and obtain the image to be processed; wherein, during the shooting, adjust the angle between the optical axis of the imaging device and the central axis of the array of graduated cylinders, and make the feature marking lines, graduated cylinder scale and the edge of the liquid surface of each graduated cylinder simultaneously within the imaging field of view. Step S2: Preprocess the image to be processed. The preprocessing includes color space normalization, illumination non-uniformity correction, and liquid surface edge enhancement. The preprocessing is performed in the order of color space normalization, illumination non-uniformity correction, and liquid surface edge enhancement, and outputs a corrected and enhanced image for binarization processing. Step S3: Perform adaptive threshold binarization on the preprocessed image to obtain a binary image in which the liquid level region and the background are separated; wherein, the adaptive threshold binarization automatically determines the segmentation threshold based on the grayscale distribution of the preprocessed image, and uses the segmentation threshold to distinguish the liquid level region, the graduated cylinder scale region and the background region. Step S4: Compare the features of the binary image with the pre-established template image to obtain the offset parameters of the imaging device relative to the graduated cylinder coordinate system; the offset parameters include the offset angle determined by the rotation matrix R and the offset position determined by the translation vector T. Step S5: Compensate the liquid level height calculation results of each graduated cylinder according to the offset parameters; wherein, the compensation includes: based on the rotation matrix R and translation vector T obtained in step S4, back-projecting the pixel position of the liquid surface of each graduated cylinder in the image to be processed to the graduated cylinder coordinate system, and correcting the liquid level height calculation results according to the graduated cylinder coordinates obtained by back-projection to obtain the compensated liquid level height. Step S6: Output the liquid level height distribution of the array-type graduated cylinder group; wherein, the liquid level height distribution includes at least the number of each graduated cylinder, the position of each graduated cylinder in the array, and the corresponding compensated liquid level height.

[0012] Furthermore, the tilt angle mentioned in step S1 specifically refers to a tilt angle of 15° to 45° between the optical axis of the imaging device and the central axis of the array of graduated cylinders; the shooting distance is 1.2 to 1.5 times the height of the graduated cylinders. The setting of the shooting angle and distance ensures panoramic shooting of the entire array of graduated cylinders while avoiding mutual obstruction between the graduated cylinders, which would affect the image recognition of the liquid level.

[0013] Furthermore, the feature marking lines mentioned in step S1 are set on the array of graduated cylinders and extend along the height direction of the graduated cylinders, covering the entire range of the graduated cylinder scale. The color of the feature marking lines contrasts significantly with the color of the graduated cylinders and the background, making them stably identifiable in the captured image and used to establish the mapping relationship between the physical coordinate system of the graduated cylinders and the image pixel coordinate system. The number, width, and specific material of the feature marking lines are not limited: they can be single continuous markings or multiple scattered markings, and can be implemented using adhesive tape, spray coating, printed stripes, etc. Preferably, a single continuous dark-colored tape (such as black tape) is attached along the transverse center of the array of graduated cylinders, so as to provide a stable geometric registration reference while covering the minimum number of cylinders.

[0014] Furthermore, in step S1, a transparent scale is additionally provided on the outermost side of the array of graduated cylinders. This transparent scale is attached along the height of the graduated cylinders and covers the entire range of the graduated cylinder scale. The transparent scale and the feature marking lines together constitute the "array-based calibration reference" of this invention: the feature marking lines provide a geometric registration reference for image recognition, and the transparent scale provides a physical length reference for image recognition. In the error compensation step of step S5, pixel-to-physical length calibration is further performed based on the geometric information of the transparent scale in the captured image, so that the calculated liquid level height of each graduated cylinder is directly output in physical length units (e.g., millimeters), without the need for subsequent offline length calibration.

[0015] Furthermore, in step S2, the color space normalization is to convert the RGB image to the CIELAB color space via the XYZ intermediate color space according to the CIE 1931 standard; the illumination non-uniformity correction is a white balance correction based on the gray-level histogram, wherein the white balance correction uses the center position of the cumulative gray-level distribution of the three color channels of the image as the gray-level reference for each channel, and calculates the linear mapping coefficient of each channel accordingly; the liquid surface edge enhancement adopts the Unsharp Masking algorithm, and the sharpening coefficient is dynamically selected according to the image contrast.

[0016] Furthermore, the adaptive threshold binarization in step S3 uses the Otsu algorithm to maximize the variance between foreground and background classes as the threshold selection criterion. The optimal threshold is adaptively obtained from the grayscale distribution of the image itself, without the need for manual specification, and adapts to the image segmentation requirements under different liquid levels and lighting conditions.

[0017] Furthermore, the adaptive processing for abnormal liquid level conditions in step S3 includes: when the liquid level of any graduated cylinder exceeds a preset upper limit proportion of the graduated cylinder's scale range, iteratively adjusting the inter-class variance weights of the adaptive threshold binarization algorithm and re-performing binarization; when outliers are detected in the liquid level distribution of the array of graduated cylinders, the threshold selection is readjusted and the liquid level measurement is performed again. Preferably, the preset upper limit proportion is 90% of the graduated cylinder's scale range. This mechanism ensures that the method maintains stable measurement accuracy under various operating conditions that may occur at the spray test site.

[0018] Further, the feature comparison in step S4 includes: extracting scale-invariant feature points from the image to be processed and the template image respectively, and obtaining the descriptors corresponding to each scale-invariant feature point. The descriptors are feature vectors used to characterize the gray-level or gradient distribution of the neighborhood of the corresponding feature point; calculating the nearest neighbor distance and the second nearest neighbor distance between the feature point descriptors in the image to be processed and the candidate feature point descriptors in the template image respectively. When the ratio of the nearest neighbor distance to the second nearest neighbor distance is less than a preset distance ratio threshold, the corresponding candidate feature point is used as a matching point to establish an initial set of matching point pairs; removing feature point pairs with matching errors greater than a preset statistical threshold, the preset statistical threshold being determined based on the standard deviation of the matching errors of all matching points, preferably twice the standard deviation; when the number of effective matching points is lower than a preset lower limit or the overall matching error exceeds the preset statistical threshold, the imaging device is triggered to automatically retake the image, and an upper limit is set on the number of retakes. Based on the filtered matching point pairs, the geometric transformation matrix between the image to be processed and the template image is solved, and the rotation matrix R and translation vector T of the imaging device relative to the graduated cylinder coordinate system are determined by the geometric transformation matrix.

[0019] This invention also discloses an image recognition liquid level measurement system for an array of graduated cylinders, used to implement the above method. The system includes: an imaging module configured to capture images of the array of graduated cylinders at the tilted angle, the imaging module including an adjustable tilt bracket; a preprocessing module configured to perform color space normalization, illumination non-uniformity correction, and liquid surface edge enhancement on the images acquired by the imaging module; and an image analysis module configured to perform adaptive threshold binarization, feature comparison, error compensation, and output liquid level height distribution data. Preferably, the vertical deviation between the rotation axis of the adjustable tilt bracket of the imaging module and the central axis of the array of graduated cylinders is ≤0.5mm.

[0020] The present invention has the following beneficial effects: (1) This invention achieves fully automatic measurement of the liquid level of the graduated cylinders by acquiring an overall image of the array of graduated cylinders and automatically identifying the liquid level of each cylinder, thus avoiding the manual reading and data transcription process. For an array of N graduated cylinders (typically N=64~144), the measurement time is reduced from about 30~60 minutes by manual method to less than 30 seconds (efficiency is improved by more than 60 times); at the same time, the random errors introduced by manual reading and recording are completely avoided, and the liquid level measurement accuracy of a single cylinder reaches within ±0.5mm.

[0021] (2) This invention enables camera calibration and liquid level measurement to be completed simultaneously in a single imaging operation by setting feature marking lines on the edge of the array-type graduated cylinder, thus eliminating the need for offline camera calibration. Compared with existing image recognition liquid level measurement schemes that rely on checkerboard or Zhang Zhengyou calibration, the preparation time for a single experiment of this invention is reduced from about 20 minutes to less than 2 minutes, and there is no need to retain the offline calibration environment at the testing site, which significantly improves the working efficiency and site flexibility of spray testing.

[0022] (3) This invention calculates the offset angle and offset position of the imaging device online by comparing template images, and compensates for the error in the liquid level calculation results of each measuring cylinder accordingly, thus eliminating the systematic measurement deviation caused by the different positions of the measuring cylinders in the image in the dense array arrangement scenario. Under the condition that the imaging device has a viewing angle offset of ±5°, the measurement error of the measuring cylinder located at the edge of the image (the position with the most severe perspective distortion) is reduced from about ±3mm in the uncompensated state to within ±0.5mm, and the difference in measurement accuracy between the array center position and the edge position is reduced from about 5 times to within 1.5 times.

[0023] (4) The present invention sets an adaptive iterative mechanism for the binarization threshold for extreme liquid level and abnormal liquid level distribution scenarios, so that the method remains stable under various working conditions. Under extreme working conditions where the liquid level reaches more than 90% of the measuring cylinder range, the liquid level recognition accuracy of the present invention can still be maintained within ±0.5mm, which is a significant improvement compared to the approximately ±2mm error of the fixed threshold binarization method.

[0024] (5) This invention does not require modification of the original structure of the nozzle, spraying device and array of measuring cylinders. It can be implemented by simply adding feature marking lines to the edge of the measuring cylinder. It has good scene adaptability and engineering practicality and can be directly applied to scenarios such as nozzle performance testing in industrial production and laboratory spraying system development. The test results are output in the form of structured tables, which can be directly connected to the subsequent liquid distribution analysis work, reducing the workload of data processing.

[0025] (6) This invention incorporates a transparent scale ruler attached to the outermost side of the array of graduated cylinders, embedding the physical length calibration reference within the imaging field of view. This allows the method to simultaneously complete geometric calibration (based on feature marker lines) and length calibration (based on the transparent scale ruler) in a single imaging session. Compared to existing solutions that require additional checkerboard offline calibration or pre-input of camera focal length / pixel size and other parameters to convert image pixel readings into physical lengths, this invention further reduces on-site implementation time by approximately 5-10 minutes and eliminates the workload of re-offline calibration after changes in camera parameters (such as lens replacement or focal length adjustment). Attached Figure Description

[0026] Figure 1 This is a flowchart illustrating an image recognition liquid level measurement method for an array-type graduated cylinder according to the present invention.

[0027] Figure 2 This is a schematic diagram of an array-type graduated cylinder group for an image recognition liquid level measurement method of an array-type graduated cylinder according to the present invention.

[0028] Figure 3 This is a schematic diagram of an industrial camera used in the image recognition liquid level measurement method for an array-type graduated cylinder according to the present invention.

[0029] Figure 4 This is a schematic diagram of the feature marker line setting of an image recognition liquid level measurement method for an array-type graduated cylinder according to the present invention.

[0030] Figure 5 This is a schematic diagram of the geometric relationship between the imaging device coordinate system and the measuring cylinder coordinate system in the image recognition liquid level measurement method of an array-type measuring cylinder according to the present invention.

[0031] Figure 6 This is a schematic diagram of the template image comparison and offset parameter calculation process of an image recognition liquid level measurement method for an array-type graduated cylinder according to the present invention. Detailed Implementation

[0032] The specific embodiments of the present invention will be further described below with reference to the accompanying drawings and technical solutions.

[0033] The present invention provides an image recognition liquid level measurement method for an array-type graduated cylinder, the basic process of which is as follows: Figure 1 As shown.

[0034] As a further requirement of the present invention, for the panoramic detection requirement of liquid distribution testing of the spray device, the method for acquiring the RGB image including the array of graduated cylinders as the first image in step S1 is as follows: like Figure 2 , Figure 3 As shown, the optical axis of the industrial camera forms a tilt angle of 15°–45° with the central axis of the array of graduated cylinders, and the shooting distance is 1.2–1.5 times the height of the graduated cylinders, thereby capturing a photograph of the entire array of graduated cylinders and obtaining an RGB image of the entire area. In this shooting step, the position and tilt angle of the imaging device are first adjusted so that the outermost graduated cylinder, the feature marking line, the transparent scale, and the edges of the liquid surfaces of each graduated cylinder are all within the same shooting field of view; then the exposure parameters are fixed and an RGB image is acquired, which serves as the input for subsequent preprocessing steps.

[0035] As a further requirement of the present invention, in step S2, to reduce the interference of invalid image information on subsequent calculations, the photo is cropped using an image processing algorithm, retaining only the area containing the array of graduated cylinders and feature marking lines. Specifically, during cropping, the boundary of the region of interest can be determined based on the outer contour of the array of graduated cylinders, the position of the feature marking lines, or the position of the transparent scale, and the image area containing all the edges of the graduated cylinder liquid surfaces and scale reference information is retained. The cropped image continues to be used for color space conversion, white balance correction, and edge enhancement.

[0036] like Figure 4 As shown, in this embodiment, the feature marking line is a single strip of black tape attached to the transverse center of the array of graduated cylinders. The black tape extends from the bottom to the top along the height of the graduated cylinders, covering the entire range of the graduated cylinder scale. The width of the black tape is preferably 0.8 to 2 times the width of a single graduated cylinder. Too narrow a tape will affect the stability of image recognition, while too wide a tape will obscure too many adjacent graduated cylinders. It should be noted that the specific implementation of the feature marking line is not limited to a single strip of black tape: in other embodiments, multiple dispersed thin marking lines can be used (e.g., evenly spaced on both sides of the array or the edge of the graduated cylinders), or any form that can provide a stable image registration reference, such as a sprayed coating or printed stripes with a clear contrast to the background. This invention does not limit the number, width, or material of the feature marking lines.

[0037] In this embodiment, a transparent scale is attached to the outermost side of the array of graduated cylinders (e.g., the rightmost or leftmost end of the array). The transparent scale extends from the bottom to the top along the height of the graduated cylinder, covering the entire range of the graduated cylinder's scale. Without obstructing the identification of the liquid level inside the graduated cylinder, the transparent scale provides a geometric reference of a known physical length (e.g., a scale interval of 1 mm or 5 mm) in the captured image.

[0038] The transparent scale and the feature marking lines together constitute the "array-based calibration reference" of this invention: the feature marking lines provide a geometric registration benchmark for the image processing algorithm—the viewing angle offset parameters of the imaging device are calculated via template comparison; the transparent scale provides the algorithm with a conversion relationship from pixels to physical length—by identifying the pixel distance between two or more known scale points on the transparent scale in the image, and after compensation with the viewing angle offset parameters, the physical length corresponding to each pixel in the image is obtained. The synergistic effect of both allows this method to simultaneously complete geometric calibration and length calibration during a single imaging process without any offline calibration steps, further simplifying the operational procedures at the spray test site.

[0039] Meanwhile, by mapping the geometric information of the feature marker lines in the image to the pixel coordinates, a projection matrix from three-dimensional space to the image plane is established, and the calibration results are directly used for offset angle calculation and liquid level height correction.

[0040] As a further requirement of the present invention, in step S2, image correction is performed on the cropped image, including color space conversion, white balance correction and edge sharpening.

[0041] The RGB image is converted to the LAB color space to achieve standardized color representation and reduce the impact of light color temperature changes on liquid level recognition. The specific steps are as follows: After the conversion, white balance correction and edge enhancement are performed on the brightness channel of the LAB color space to obtain an image with corrected brightness distribution and enhanced contrast at the liquid surface edge; this image is used as the input image for adaptive threshold binarization in step S3.

[0042] Color space standardization: The cropped image is mapped from the RGB color space to the XYZ color space according to the two-step mapping relationship defined by the CIE 1931 standard, and then transformed from the XYZ color space to the CIELAB color space through a non-linear mapping. The specific transformation matrix, white point parameters, and non-linear mapping formulas are all performed according to the CIE 1931 standard. The white point parameters can be selected from different standard light sources defined by CIE 1931 (such as D50, D55, D65, D75, or A light sources, etc.) according to the lighting characteristics of the actual shooting environment. In this embodiment, the D65 standard light source is preferred, with corresponding white point parameters Xn=95.047, Yn=100.0, and Zn=108.883.

[0043] The reason why this invention converts the RGB image to the CIELAB color space before binarization, rather than directly processing the RGB channels, is based on the following technical considerations: (1) The luminance channel L and chrominance channels a and b in CIELAB space are mathematically independent, so that subsequent white balance correction only acts on the luminance channel without introducing color distortion, thus avoiding the cross-channel color problem that may occur in white balance under RGB space. (2) CIELAB space is closer to a uniform color space in visual perception. The liquid surface and scale line in the measuring cylinder have a more significant contrast in the L channel than any single channel of RGB, which is beneficial for the stable recognition of the liquid surface edge in the subsequent binarization stage. (3) CIELAB space is more robust to changes in light color temperature than RGB space and can be adapted to images taken under different illuminance conditions at the spray test site.

[0044] Illumination non-uniformity correction: A white balance correction method based on gray-level histograms is used to eliminate the influence of ambient light color temperature variations on the image. Specifically, white balance correction is performed channel-independently: gray-level histograms and cumulative distribution functions are established for the B, G, and R channels of the image, and the center position of the cumulative distribution for each channel is used as the gray-level reference for that channel; then, a linear mapping coefficient (i.e., white balance coefficient) based on this gray-level reference is applied to each channel to make the gray-level distribution centers of the three channels tend to be consistent; finally, the three channels are merged to obtain the color-balanced image.

[0045] The grayscale reference corresponding to the above white balance correction can stably converge to the equilibrium point of the three channels under normal indoor testing lighting conditions (typical illuminance range of 200~400 lux). When the on-site illuminance deviates significantly from this typical range, the correction effect can be maintained by adjusting the grayscale reference positioning strategy (such as changing to the histogram peak position).

[0046] The reason why this step uses the cumulative distribution center position as the grayscale reference instead of simply taking the channel mean is to avoid the large area of ​​background pulling the mean even when the liquid surface area in the graduated cylinder occupies a small proportion of the image. This processing method can effectively eliminate the image color shift caused by the color temperature of the ambient light source deviating from white light, and prevent this color shift from being incorrectly identified as the edge of the liquid surface in the subsequent binarization stage.

[0047] Liquid surface edge enhancement: An unsharp mask is applied to the L channel of the white-balance corrected image to enhance the edge gradient of the liquid surface, scale lines, and feature marker lines. The grayscale values ​​of the image after unsharp masking are shown below. S Determined by the following formula: In the formula, L This is the original luminance channel image. G To L Image after applying Gaussian blur, k This refers to the sharpening factor. k The gradient magnitude at the edge of the liquid surface in the sharpened image is dynamically selected based on the image contrast, so that it is significantly higher than the gradient magnitude in the background area; preferably, k The value range is 0.1 to 0.5.

[0048] The standard deviation of the Gaussian blur kernel is matched with the image resolution and the pixel width occupied by the graduated cylinder in the image. If the kernel width is too small, it will not be able to effectively suppress the noise of the original image, resulting in false edges after sharpening. If the kernel width is too large, it will blur the true boundary of the liquid surface. At the shooting resolution of this embodiment, the standard deviation of the Gaussian kernel is set to 1.0~2.0 pixels, which can simultaneously take into account the edge enhancement effect and noise suppression.

[0049] In step S3, adaptive threshold binarization involves determining the binarization threshold for the image after color space normalization, white balance correction, and edge enhancement using the Otsu algorithm on the L channel. The Otsu algorithm uses the maximization of the inter-class variance of grayscale values ​​between foreground and background pixels as the threshold selection criterion, adaptively deriving the optimal threshold from the image's own grayscale distribution without manual specification. Specifically, the Otsu threshold is calculated based on the grayscale histogram of the luminance channel. Pixels whose grayscale values ​​meet the foreground determination criteria are marked as candidate liquid level regions, while the remaining pixels are marked as background regions. Subsequently, connected component filtering or morphological denoising is performed on the binary image to retain candidate regions corresponding to the edge positions of the liquid surface in the graduated cylinder, thereby determining the pixel row positions of each graduated cylinder's liquid surface in the image.

[0050] The Otsu algorithm was chosen because, after the aforementioned preprocessing, the liquid surface pixels and background pixels formed a significant bimodal grayscale distribution, which perfectly matches the optimal operating condition of the Otsu algorithm. The advantage of this method over the fixed threshold method is that it can provide matching thresholds for images under different measuring cylinders, liquid levels, and lighting conditions in the spray test, avoiding batch errors caused by manually specifying thresholds.

[0051] To address the issue that the Otsu threshold may deviate from the true boundary under extreme operating conditions (liquid level close to the upper or lower limit of the measuring range), this invention sets up a threshold adaptive iterative adjustment mechanism: when the liquid level height of any measuring cylinder is higher than the preset upper limit of the measuring range (preferably 90%) or an outlier is detected, the inter-class variance weights of the Otsu algorithm are iteratively adjusted, and re-binarization is performed to obtain a more accurate liquid surface boundary.

[0052] like Figure 6As shown, the offset parameter calculation is as follows: the feature comparison in step S4 is based on scale-invariant feature point matching. Scale-invariant feature points (SIFT features are used in this embodiment) are extracted from the template image and the binarized image to be processed, respectively, and an initial set of matching point pairs is established according to the nearest neighbor distance ratio of the descriptors; then, feature point pairs with matching errors greater than a preset statistical threshold are removed (the preset statistical threshold is twice the standard deviation of the matching errors of all matching points); if the number of effective matching points is lower than a preset lower limit or the overall matching error exceeds the statistical threshold, the automatic re-shooting mechanism of the imaging device is triggered, and the maximum number of re-shooting times is set to 3. Specifically, the descriptor is the feature vector of the scale-invariant feature point; for each feature point to be matched, the distance between its descriptor and the descriptors of each candidate feature point in the template image is calculated, and the nearest neighbor distance d1 and the second nearest neighbor distance d2 are selected. When d1 / d2 is less than the preset distance ratio threshold, the matching point pair is retained; otherwise, the matching point pair is removed.

[0053] like Figure 5 As shown, based on the selected feature point matching pairs, the offset angle of the imaging device relative to the graduated cylinder coordinate system is calculated according to the following camera extrinsic parameter model. With offset position The camera extrinsic model takes the selected matching point pairs as input and obtains the rotation matrix R and translation vector T by solving the spatial geometric transformation between the template image coordinate system and the image coordinate system to be processed; where R is used to characterize the attitude offset of the imaging device relative to the graduated cylinder coordinate system, and T is used to characterize the position offset of the imaging device relative to the graduated cylinder coordinate system.

[0054] in, The coordinates of the point in the imaging device's coordinate system. These are the coordinates of the corresponding point in the graduated cylinder coordinate system; For the camera coordinate system to rotate around the measuring cylinder coordinate system X , Y , Z The axis rotates in sequence ω , , κ The 3×3 rotation matrix corresponding to the angle is represented by the following elements: R ij ( i , j (∈{1, 2, 3}). The three rotation angles can be solved inversely from the elements of the rotation matrix: Obtain the rotation matrix R With translation vector TThen, the position of the optical center of the imaging device in the graduated cylinder coordinate system is further calculated. : in, The fixed position of the optical center of the imaging device in the camera coordinate system (obtained from factory calibration, considered a known quantity in this step). Liquid level calculation and error compensation: Liquid level height in a single graduated cylinder. H The liquid level is calculated by back-projecting the pixel row position of the liquid surface in the image onto the graduated cylinder coordinate system and then combining it with the camera's optical center coordinates. Under a small offset angle approximation, the compensated liquid level height satisfies the following: In specific compensation, the initial liquid level height H0 is first obtained based on the uncompensated liquid surface pixel row position. Then, the height correction amount ΔH caused by the viewing angle offset is calculated using R and T obtained in step S4, and the compensated liquid level height is obtained according to H=H0-ΔH. When using a transparent scale to convert pixels to physical length, the height correction amount ΔH is simultaneously multiplied by the pixel length conversion factor to obtain the compensation result in millimeters.

[0055] The above formula is obtained by solving step S4. R and T The key improvement of this invention, which distinguishes it from existing methods for detecting liquid levels in single graduated cylinder images, is the compensation for viewpoint shift errors. By establishing a full-field graduated cylinder coordinate system using feature marker lines and using offset parameters obtained from template comparison, the liquid level readings of each cylinder in the array are incorporated into a unified, quantifiable geometric model that compensates for viewpoint shift. This eliminates the systematic measurement deviation caused by the different image positions of the cylinders in densely arranged array scenarios. In other words, the compensation is not a simple addition or subtraction of a fixed amount to the liquid level height, but rather a calculation of the corresponding height correction based on the position of each cylinder in the image and the spatial geometric relationship determined by R and T, thereby performing position-related compensation for cylinders at the center and edge of the array.

[0056] As a further limitation of the present invention, in step S6, in response to the actual needs of spray liquid distribution analysis, all collected graduated cylinder liquid level height data are structured and output as a final liquid level height distribution table in tabular form. This table includes information such as the number of each graduated cylinder, the corresponding liquid level height, and the location of the field. It can be directly imported into the data analysis system for nozzle liquid distribution uniformity calculation without the need for manual secondary processing, greatly improving the overall efficiency of nozzle testing. During output, the number of each graduated cylinder, the array row and column position, the compensated liquid level height, the liquid level height unit, and the anomaly marker field are combined to form the liquid level height distribution table. When the effective liquid surface area of ​​a certain graduated cylinder is not stably identified or the compensation calculation exceeds the preset error range, a verification mark is recorded in the anomaly marker field for subsequent data analysis to remove or verify.

Claims

1. A method for measuring liquid level using image recognition of an array-type graduated cylinder, characterized in that, Includes the following steps: Step S1: Using an imaging device, take an image of the array of graduated cylinders containing feature marking lines at an angle that simultaneously brings the graduated cylinder mouth and the graduated cylinder side wall scale into the field of view, and obtain the image to be processed; wherein, during the shooting, adjust the angle between the optical axis of the imaging device and the central axis of the array of graduated cylinders, and make the feature marking lines, graduated cylinder scale and the edge of the liquid surface of each graduated cylinder simultaneously within the imaging field of view. Step S2: Preprocess the image to be processed. The preprocessing includes color space normalization, illumination non-uniformity correction, and liquid surface edge enhancement. The preprocessing is performed in the order of color space normalization, illumination non-uniformity correction, and liquid surface edge enhancement, and outputs a corrected and enhanced image for binarization processing. Step S3: Perform adaptive threshold binarization on the preprocessed image to obtain a binary image in which the liquid level region and the background are separated; wherein, the adaptive threshold binarization automatically determines the segmentation threshold based on the grayscale distribution of the preprocessed image, and uses the segmentation threshold to distinguish the liquid level region, the graduated cylinder scale region and the background region. Step S4: Compare the features of the binary image with the pre-established template image to obtain the offset parameters of the imaging device relative to the graduated cylinder coordinate system; the offset parameters include the offset angle determined by the rotation matrix R and the offset position determined by the translation vector T. Step S5: Compensate the liquid level height calculation results of each graduated cylinder according to the offset parameters; wherein, the compensation includes: based on the rotation matrix R and translation vector T obtained in step S4, back-projecting the pixel position of the liquid surface of each graduated cylinder in the image to be processed to the graduated cylinder coordinate system, and correcting the liquid level height calculation results according to the graduated cylinder coordinates obtained by back-projection to obtain the compensated liquid level height. Step S6: Output the liquid level height distribution of the array-type graduated cylinder group; wherein, the liquid level height distribution includes at least the number of each graduated cylinder, the position of each graduated cylinder in the array, and the corresponding compensated liquid level height.

2. The image recognition liquid level measurement method for an array-type graduated cylinder according to claim 1, characterized in that, The tilt angle mentioned in step S1 is specifically a tilt angle of 15° to 45° between the optical axis of the imaging device and the central axis of the array of graduated cylinders; the shooting distance is 1.2 to 1.5 times the height of the graduated cylinder.

3. The image recognition liquid level measurement method for an array-type graduated cylinder according to claim 1, characterized in that, The feature marking line mentioned in step S1 is set on the array of graduated cylinders and extends along the height direction of the graduated cylinders, covering the entire range of the graduated cylinder scale; the color of the feature marking line is significantly contrasted with the color of the graduated cylinder and the background, so that it can be stably identified in the captured image and used to establish the mapping relationship between the physical coordinate system of the graduated cylinder and the image pixel coordinate system.

4. The image recognition liquid level measurement method for an array-type graduated cylinder according to claim 1, characterized in that, In step S1, a transparent scale is additionally provided on the outermost side of the array of graduated cylinders. The transparent scale is attached along the height direction of the graduated cylinders and covers the entire range of the graduated cylinder scale. In the error compensation step in step S5, the pixel-to-physical length calibration is further performed based on the geometric information of the transparent scale in the captured image, so that the calculation result of the liquid level height of each graduated cylinder is directly output in physical length units without the need for subsequent offline length calibration.

5. The image recognition liquid level measurement method for an array-type graduated cylinder according to claim 1, characterized in that, In step S2, the color space normalization is to convert the RGB image to the CIELAB color space via the XYZ intermediate color space according to the CIE 1931 standard; the illumination non-uniformity correction is a white balance correction based on the gray-level histogram. The white balance correction uses the center position of the cumulative gray-level distribution of the three color channels of the image as the gray-level reference for each channel, and calculates the linear mapping coefficient of each channel accordingly; the liquid surface edge enhancement adopts the Unsharp Masking algorithm, and the sharpening coefficient is dynamically selected according to the image contrast.

6. The image recognition liquid level measurement method for an array-type graduated cylinder according to claim 1, characterized in that, The adaptive threshold binarization in step S3 uses the Otsu algorithm, which takes maximizing the variance between foreground and background classes as the threshold selection criterion, and adaptively obtains the optimal threshold based on the grayscale distribution of the image itself.

7. The image recognition liquid level measurement method for an array-type graduated cylinder according to claim 1, characterized in that, The adaptive processing for abnormal liquid level conditions in step S3 includes: when the liquid level height of any graduated cylinder is higher than the preset upper limit ratio of the graduated cylinder scale range, the inter-class variance weight of the adaptive threshold binarization algorithm is iteratively adjusted and binarization is re-executed; when outliers are detected in the liquid level distribution of the array graduated cylinder group, the threshold selection is readjusted and the liquid level measurement is re-performed.

8. The image recognition liquid level measurement method for an array-type graduated cylinder according to claim 1, characterized in that, The feature comparison in step S4 includes: extracting scale-invariant feature points and their descriptors from the image to be processed and the template image, respectively, wherein the descriptor is a feature vector representing the gray level or gradient distribution of the neighborhood of the corresponding feature point; filtering matching points according to the ratio of the nearest neighbor distance to the second nearest neighbor distance of the descriptor to establish a feature point matching relationship; eliminating feature point pairs with matching errors greater than a preset statistical threshold; solving the geometric transformation matrix between the image to be processed and the template image according to the filtered feature point matching relationship, and determining the rotation matrix R and translation vector T of the imaging device relative to the graduated cylinder coordinate system by the geometric transformation matrix; when the number of effective matching points is lower than a preset lower limit or the overall matching error exceeds a preset statistical threshold, triggering the imaging device to automatically retake the image, and setting an upper limit on the number of retakes.

9. An image recognition liquid level measurement system for an array-type graduated cylinder, used to implement the method described in any one of claims 1-8, characterized in that, The system includes: An imaging module is configured to capture images of an array of graduated cylinders at the tilted angle, and the imaging module includes an adjustable tilt bracket. The preprocessing module is configured to perform color space normalization, illumination non-uniformity correction, and liquid surface edge enhancement on the image acquired by the imaging module; The image analysis module is configured to perform the adaptive threshold binarization, the feature comparison, the error compensation, and the output of the liquid level height distribution data.

10. The image recognition liquid level measurement system for an array-type graduated cylinder according to claim 9, characterized in that, The vertical deviation between the rotation axis of the adjustable tilt bracket of the imaging module and the central axis of the array-type measuring cylinder group is ≤0.5mm.