A liquid level indicating instrument reading recognition method based on image recognition
By adopting an image recognition-based liquid level indicator reading recognition method, the problems of reflection, bubbles, and distortion interference in liquid level detection are solved, achieving high-precision and adaptive liquid level measurement, which is suitable for high-risk scenarios.
Patent Information
- Application Number
- CN202511696275.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-11-19
- Publication Date
- 2026-08-25
- Estimated Expiration
- 2045-11-19
AI Technical Summary
Existing liquid level detection technologies suffer from reflection, bubbles, and distortion interference in high-risk scenarios, resulting in high misjudgment rates, low efficiency, and poor safety, making it impossible to achieve non-contact, high-precision measurement.
A liquid level indicator reading recognition method based on image recognition is adopted. Through image preprocessing, liquid level segmentation and feature calibration, combined with U-Net model and dynamic calibration, it realizes intelligent anti-reflection, automatic calibration of installation deviation, reduces bubble interference and improves measurement accuracy.
The reading accuracy under strong light is greater than 92%, the liquid level continuity rate reaches 98%, and the adaptive compensation for installation tilt error improves the system's adaptability and accuracy.
Smart Images

Figure CN121527748B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of automated identification of industrial instruments, and in particular to a method for identifying readings of liquid level indicators based on image recognition. Background Technology
[0002] Automatic liquid level recognition technology belongs to the field of industrial vision inspection and is mainly used for liquid level monitoring in scenarios such as storage tanks and pipelines, replacing the traditional manual reading method.
[0003] Current mainstream solutions include instrument sensor detection (such as float-type and capacitive type) and image recognition technology. Sensor solutions require contact with liquids, are easily corroded and damaged, and have high maintenance costs. Image recognition solutions rely on ordinary cameras combined with image processing algorithms (such as edge detection), which have three major drawbacks: feature loss due to reflective interference (false positive rate >30%); measurement distortion caused by lens distortion (edge error >8%); and interference from bubbles / impurities in recognition (fracture rate >40%).
[0004] In high-risk scenarios (such as chemical plants and nuclear power plants), manual operation is still required, which poses problems such as safety risks (personnel coming into contact with corrosive / flammable media), low efficiency (single-point detection takes ≥2 minutes), and subjective errors (the influence of light / viewing angle causes reading deviations of ±10%).
[0005] Existing technical solutions cannot simultaneously solve industry technical bottlenecks such as dynamic anti-interference (reflection, bubbles, distortion), adaptive installation (supporting tilt, inverted installation, and other scenarios), and non-contact high precision (millimeter-level error).
[0006] Therefore, this invention proposes a method for recognizing liquid level indicator readings based on image recognition. Summary of the Invention
[0007] The purpose of this invention is to address the shortcomings of existing technologies by proposing a method for recognizing liquid level indicator readings based on image recognition.
[0008] To achieve the above objectives, the present invention adopts the following technical solution: A method for recognizing readings of a liquid level indicator based on image recognition includes the following steps: S1: Image Data Acquisition and Preprocessing: Use a camera to photograph the liquid level gauge and obtain the raw image. The original image is then subjected to illumination equalization and geometric correction processes sequentially to obtain the preprocessed image. ; S2: Liquid Level Segmentation and Feature Marking: The preprocessed image... Input to the pre-trained liquid level segmentation model Perform liquid level region segmentation, generate liquid level segmentation mask, and extract key coordinates of liquid level boundaries. Simultaneously, the calibration parameters loaded from the database are dynamically verified and corrected based on the liquid level segmentation mask to obtain the corrected coordinates of the top reference point. Bottom reference point coordinates Physical range and range direction; S3: Liquid Level Position Calculation and Reading Generation: Based on the range direction, calculate the key coordinates of the liquid level boundary. Transformed into normalized coordinates in the virtual slot using the corresponding mapping matrix. The liquid level reading is calculated based on standardized coordinates, physical range, and selected coordinate components, and alarm flags and confidence levels are generated in combination with predefined alarm rules.
[0009] Preferably, in step S1, the illumination equalization process specifically includes: S111: Partition Statistics: This involves analyzing the original image... Divide the area into 5×5 local windows, and for each window centered at pixel coordinates (x, y), independently calculate the average gray value of its local region. and local standard deviation , ; S112: Dynamic Range Compression: The image is enhanced using the following transformation equation to obtain an image with equalized illumination. ,in =0.01 is a small constant to prevent division by zero errors. This is the dynamic contrast enhancement factor. =128±20 is the target brightness reference value.
[0010] Preferably, the geometric correction process in step S1 includes: S121: Distortion Modeling: Radial Distortion Coefficients Obtained from Camera Calibration and tangential distortion coefficient The original distorted coordinates (x, y) are corrected to obtain the corrected coordinates. , The formula for radial distortion correction is: ; The formula for tangential distortion correction is: ; in It indicates the distance of a pixel from the optical center. The distance; S122: Calibration parameter acquisition: By capturing multi-angle images of the checkerboard calibration board and minimizing reprojection error. To solve for the distortion coefficient , ,in These are the actual extracted corner coordinates. These are the theoretical corner coordinates.
[0011] Preferably: the liquid level segmentation model in step S2 This is a convolutional neural network based on the U-Net architecture, whose output is the probability that a pixel (x, y) belongs to the liquid level region. Generate liquid level segmentation mask The process is achieved through threshold processing. , where the threshold =0.5.
[0012] Preferably: In step S2, the key coordinates of the liquid level boundary are extracted. The steps are as follows: morphological closing operation is performed on the liquid level segmentation mask to eliminate micro-holes, followed by contour detection and calculation of the minimum bounding rectangle of the liquid level region. The critical coordinates of the liquid level boundary are taken from the center point of this rectangle. ,in These are the vertex coordinates of the bounding box of the liquid level region.
[0013] Preferably, the specific process of dynamically verifying and correcting the calibration parameters based on the liquid level segmentation mask in step S2 includes the following steps: S221: Calculate the intersection-union ratio (IoU) between the liquid level region corresponding to the liquid level segmentation mask and the theoretical calibration region; S222: When IoU < 0.7, dynamic correction is triggered, and the coordinates of the top reference point are corrected according to the following formula. ,in: The coordinates of the theoretical top reference point are loaded. This represents the offset between the centroid of the liquid level segmentation mask and the centroid of the theoretically calibrated region. To correct the weights.
[0014] Preferably: In step S3, the process of mapping the critical coordinates of the liquid level boundary to the standardized coordinates of the virtual tank dynamically selects the mapping matrix according to the range direction: When the range direction is vertical, vertical range mapping is used: ; When the range direction is horizontal, horizontal range mapping is used: .
[0015] Preferably, in step S3, the formula for calculating the liquid level reading is: The selection rule for coordinate component C is as follows: If the range direction is vertical, then ; If the range direction is horizontal, then .
[0016] Preferably, in step S3, the rule for generating the alarm flag is: Define the upper limit of the green safe zone as The upper limit of the yellow alert zone is Confidence threshold ; The alarm status is determined as follows: .
[0017] An electronic device includes a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to implement the steps of a liquid level indicator reading recognition method based on image recognition.
[0018] The beneficial effects of this invention are as follows: Intelligent anti-reflective processing: By partitioning the image and independently calculating the brightness / contrast of each block, the interference of liquid surface reflection is effectively eliminated, making the reading accuracy greater than 92% under strong light at night, and achieving 100% visibility of the liquid level line under strong light.
[0019] Reduce bubble interference: By using AI (U-Net model) to segment the liquid surface and combining it with morphological processing to intelligently fill the air bubbles, it can still accurately identify the liquid surface even when it contains 30% air bubbles, and the liquid level continuity rate reaches 98%.
[0020] Automatic calibration of installation deviation: Through a mask-assisted dynamic calibration mechanism (IoU<0.7 triggers dynamic correction), it can adaptively compensate for the drift of the reference point caused by installation tilt (such as a 10° tilt angle), so that the calibration drift error is reduced to zero, thereby improving the adaptability and accuracy of the system. Attached Figure Description
[0021] Figure 1 This is a flowchart of a liquid level indicator reading recognition method based on image recognition proposed in this invention. Detailed Implementation
[0022] The technical solution of the present invention will be further described in detail below with reference to specific embodiments.
[0023] In the description of this invention, it should be noted that, unless otherwise explicitly specified and limited, the terms "installation," "connection," "linking," and "setting" should be interpreted broadly. For example, they can refer to a fixed connection or setting, a detachable connection or setting, or an integral connection or setting. Those skilled in the art can understand the specific meaning of the above terms in this invention according to the specific circumstances.
[0024] Example 1: A method for recognizing readings of a liquid level indicator based on image recognition includes the following steps: S1: Image Data Acquisition and Preprocessing: Use a camera to photograph the liquid level gauge and obtain the raw image. The original image is then subjected to illumination equalization and geometric correction processes sequentially to obtain the preprocessed image. ; S2: Liquid Level Segmentation and Feature Marking: The preprocessed image... Input to the pre-trained liquid level segmentation model Perform liquid level region segmentation, generate liquid level segmentation mask, and extract key coordinates of liquid level boundaries. Simultaneously, the calibration parameters loaded from the database are dynamically verified and corrected based on the liquid level segmentation mask to obtain the corrected coordinates of the top reference point. Bottom reference point coordinates Physical range and range direction; S3: Liquid Level Position Calculation and Reading Generation: Based on the range direction, calculate the key coordinates of the liquid level boundary. Transformed into normalized coordinates in the virtual slot using the corresponding mapping matrix. The liquid level reading is calculated based on standardized coordinates, physical range, and selected coordinate components, and alarm flags and confidence levels are generated in combination with predefined alarm rules.
[0025] In step S1, the illumination equalization process specifically includes: S111: Partition Statistics: This involves analyzing the original image... Divide the area into 5×5 local windows, and for each window centered at pixel coordinates (x, y), independently calculate the average gray value of its local region. and local standard deviation , ; S112: Dynamic Range Compression: The image is enhanced using the following transformation equation to obtain an image with equalized illumination. ,in =0.01 is a small constant to prevent division by zero errors. This is the dynamic contrast enhancement factor. =128±20 is the target brightness reference value.
[0026] The geometric correction process in step S1 includes: S121: Distortion Modeling: Radial Distortion Coefficients Obtained from Camera Calibration and tangential distortion coefficient The original distorted coordinates (x, y) are corrected to obtain the corrected coordinates. , The formula for radial distortion correction is: ; The formula for tangential distortion correction is: ; in It indicates the distance of a pixel from the optical center. The distance; S122: Calibration parameter acquisition: By capturing multi-angle images of the checkerboard calibration board and minimizing reprojection error. To solve for the distortion coefficient , ,in These are the actual extracted corner coordinates. These are the theoretical corner coordinates.
[0027] The liquid level segmentation model in step S2 This is a convolutional neural network based on the U-Net architecture, whose output is the probability that a pixel (x, y) belongs to the liquid level region. Generate liquid level segmentation mask The process is achieved through threshold processing. , where the threshold =0.5.
[0028] In step S2, the key coordinates of the liquid level boundary are extracted. The steps are as follows: morphological closing operation is performed on the liquid level segmentation mask to eliminate micro-holes, followed by contour detection and calculation of the minimum bounding rectangle of the liquid level region. The critical coordinates of the liquid level boundary are taken from the center point of this rectangle. ,in These are the vertex coordinates of the bounding box of the liquid level region.
[0029] The specific process of dynamically verifying and correcting the calibration parameters based on the liquid level segmentation mask in step S2 includes the following steps: S221: Calculate the intersection-union ratio (IoU) between the liquid level region corresponding to the liquid level segmentation mask and the theoretical calibration region; S222: When IoU < 0.7, dynamic correction is triggered, and the coordinates of the top reference point are corrected according to the following formula. ,in: The coordinates of the theoretical top reference point are loaded. This represents the offset between the centroid of the liquid level segmentation mask and the centroid of the theoretically calibrated region. To correct the weights.
[0030] In step S3, the process of mapping the critical coordinates of the liquid level boundary to the standardized coordinates of the virtual tank dynamically selects the mapping matrix according to the range direction: When the range direction is vertical, vertical range mapping is used: ; When the range direction is horizontal, horizontal range mapping is used: .
[0031] In step S3, the formula for calculating the liquid level reading is: The selection rule for coordinate component C is as follows: If the range direction is vertical, then ; If the range direction is horizontal, then .
[0032] In step S3, the rule for generating alarm flags is as follows: Define the upper limit of the green safe zone as The upper limit of the yellow alert zone is Confidence threshold ; The alarm status is determined as follows: .
[0033] Example 2: An electronic device includes a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the program, it implements the steps of a liquid level indicator reading recognition method based on image recognition according to Embodiment 1.
[0034] The above description is only a preferred embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any equivalent substitutions or modifications made by those skilled in the art within the scope of the technology disclosed in the present invention, based on the technical solution and inventive concept of the present invention, should be covered within the scope of protection of the present invention.
Claims
1. A method for recognizing readings of a liquid level indicator based on image recognition, characterized in that, Includes the following steps: S1: Image Data Acquisition and Preprocessing: Use a camera to photograph the liquid level gauge and obtain the raw image. The original image is then subjected to illumination equalization and geometric correction processes sequentially to obtain the preprocessed image. ; S2: Liquid Level Segmentation and Feature Calibration: The preprocessed image... Input to the pre-trained liquid level segmentation model Perform liquid level region segmentation, generate liquid level segmentation mask, and extract key coordinates of liquid level boundaries. Simultaneously, the calibration parameters loaded from the database are dynamically verified and corrected based on the liquid level segmentation mask to obtain the corrected coordinates of the top reference point. Bottom reference point coordinates Physical range and range direction; S3: Liquid Level Position Calculation and Reading Generation: Based on the range direction, calculate the key coordinates of the liquid level boundary. Transformed into normalized coordinates in the virtual slot using the corresponding mapping matrix. The liquid level reading is calculated based on standardized coordinates, physical range, and selected coordinate components, and alarm flags and confidence levels are generated in combination with predefined alarm rules. In step S1, the illumination equalization process specifically includes: S111: Partition Statistics: This involves analyzing the original image... Divide the area into 5×5 local windows. For each window centered at pixel coordinates (x, y), independently calculate the average gray value of its local region. and local standard deviation , ; S112: Dynamic Range Compression: The image is enhanced using the following transformation equation to obtain an image with equalized illumination. ,in =0.01 is a small constant to prevent division by zero errors. This is the dynamic contrast enhancement factor. =128±20 is the target brightness reference value; In step S2, the key coordinates of the liquid level boundary are extracted. The steps are as follows: morphological closing operation is performed on the liquid level segmentation mask to eliminate micro-holes, followed by contour detection and calculation of the minimum bounding rectangle of the liquid level region. The critical coordinates of the liquid level boundary are taken from the center point of this rectangle. ,in These are the vertex coordinates of the bounding box of the liquid level region; The specific process of dynamically verifying and correcting the calibration parameters based on the liquid level segmentation mask in step S2 includes the following steps: S221: Calculate the intersection-union ratio (IoU) between the liquid level region corresponding to the liquid level segmentation mask and the theoretical calibration region; S222: When IoU < 0.7, dynamic correction is triggered, and the coordinates of the top reference point are corrected according to the following formula. ,in: The coordinates of the theoretical top reference point are loaded. This represents the offset between the centroid of the liquid level segmentation mask and the centroid of the theoretically calibrated region. To correct the weights.
2. The method for recognizing liquid level indicator readings based on image recognition according to claim 1, characterized in that, The geometric correction process in step S1 includes: S121: Distortion Modeling: Radial Distortion Coefficients Obtained from Camera Calibration and tangential distortion coefficient The original distorted coordinates (x, y) are corrected to obtain the corrected coordinates. , The formula for radial distortion correction is: ; The formula for tangential distortion correction is: ; in It indicates the distance of a pixel from the optical center. The distance; S122: Calibration parameter acquisition: By capturing multi-angle images of the checkerboard calibration board and minimizing reprojection error. To solve for the distortion coefficient , ,in These are the actual extracted corner coordinates. These are the theoretical corner coordinates.
3. The method for recognizing liquid level indicator readings based on image recognition according to claim 1, characterized in that, The liquid level segmentation model in step S2 This is a convolutional neural network based on the U-Net architecture, whose output is the probability that a pixel (x, y) belongs to the liquid level region. Generate liquid level segmentation mask The process is achieved through threshold processing. , where the threshold =0.
5.
4. The method for recognizing liquid level indicator readings based on image recognition according to claim 1, characterized in that, In step S3, the process of mapping the critical coordinates of the liquid level boundary to the standardized coordinates of the virtual tank dynamically selects the mapping matrix according to the range direction: When the range direction is vertical, vertical range mapping is used: ; When the range direction is horizontal, horizontal range mapping is used: .
5. The method for recognizing liquid level indicator readings based on image recognition according to claim 1, characterized in that, In step S3, the formula for calculating the liquid level reading is: The selection rule for coordinate component C is as follows: If the measuring direction is vertical, then ; If the range direction is horizontal, then .
6. The method for recognizing liquid level indicator readings based on image recognition according to claim 1, characterized in that, In step S3, the rule for generating alarm flags is as follows: Define the upper limit of the green safe zone as The upper limit of the yellow alert zone is Confidence threshold ; The alarm status is determined as follows: 。 7. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the program, it implements the steps of a liquid level indicator reading recognition method based on image recognition as described in any one of claims 1 to 6.
Citation Information
Patent Citations
Reading identification method and device for liquid level meter
CN112036409A
Code reader distortion image correcting and decoding method and system based on machine vision
CN120318130A