Visual Liquid Level Detection Technology: Principles, Methods, and Industrial Applications
Introduction
Liquid level detection is a critical measurement task widely used in industrial production, process control, and daily life. From monitoring petroleum and chemical storage tanks to filling production lines in the food and beverage industry, and from liquid level control in medical equipment to water level management in smart homes, accurate and reliable liquid level detection is essential for ensuring security, improving efficiency, and optimizing resource utilization. With the rapid development of computer vision technology, visual liquid level detection, as a non-contact, high-precision, and intelligent detection method, is gradually replacing traditional contact measurement approaches such as float-type, pressure-type, and capacitive methods, becoming a research hotspot in the field of industrial automation.
1. Basic Principles of Visual Liquid Level Detection Technology
1.1 Technology Overview
Visual liquid level detection utilizes image sensors (such as CCD or CMOS cameras) to capture images of the liquid inside a container. Through image processing and analysis algorithms, it identifies the interface between the liquid and air (or between different liquid layers) to determine the liquid level height. This method offers advantages such as non-contact measurement, a wide measurement range, and the ability to obtain rich information (such as liquid surface fluctuations and foreign object detection).
1.2 Optical Imaging System Components
A typical visual liquid level detection system generally includes the following core components:
Lighting System: Provides stable and uniform illumination, including LED light sources, laser light sources, etc.
Image Acquisition Device: Industrial cameras, lenses, and filters.
Image Processing Unit: Industrial computers, embedded systems, or dedicated image processors.
Algorithm Software: Image processing and analysis algorithms.
Result Display and Communication Interface: Human-machine interface, data storage, and transmission modules.
1.3 Detection Principle Classification
Based on the imaging method and detection principles, visual liquid level detection can be mainly divided into:
Direct Imaging Method: The camera directly captures the liquid surface, determining the liquid level by identifying the boundary between the liquid and air. This method is suitable for transparent or semi-transparent containers, allowing direct observation of the liquid surface.
Indirect Imaging Method: Determines the liquid level by measuring indirect parameters related to it, such as:
Float Marker Detection: Places a special marker on the liquid surface and tracks its position to determine the liquid level.
Connected Vessel Method: Uses a transparent connected tube on the side of the container to measure the liquid level in the tube.
Reflection Imaging Method: Determines the liquid level by detecting the reflection of a specific marker on the liquid surface.
2. Key Technologies in Visual Liquid Level Detection
2.1 Image Preprocessing Technology
Image preprocessing is a critical step in improving detection accuracy and robustness, mainly including:
Image Enhancement: Improves image contrast and highlights edge features of the liquid surface.
Noise Suppression: Uses methods such as median filtering and Gaussian filtering to remove image noise.
Illumination Compensation: Corrects grayscale changes caused by uneven lighting.
Image Correction: Corrects geometric distortions caused by camera angles or lens distortions.
2.2 Liquid Surface Feature Extraction and Recognition
Effective extraction of liquid surface features is key to visual liquid level detection. Common methods include:
Edge Detection Method: Uses edge features generated at the contact point between the liquid surface and the container wall. Edge detection operators such as Canny, Sobel, and Laplacian are employed to extract the liquid surface boundary.
Threshold Segmentation Method: Segments the liquid surface area based on grayscale differences between the liquid surface region and the background, using global threshold, local threshold, or adaptive threshold methods.
Feature Matching Method: Presets feature markers at the liquid surface position and tracks their location using methods such as template matching and feature point matching.
Machine Learning-Based Methods: Uses machine learning algorithms like Support Vector Machines (SVM) and neural networks to train liquid surface recognition models, improving robustness against complex backgrounds and interference.
Deep Learning Methods: Employs deep learning models such as Convolutional Neural Networks (CNN), U-Net, and YOLO for end-to-end liquid surface detection and segmentation.
2.3 Liquid Level Calculation and Calibration
Converting image coordinates to actual physical coordinates is a core issue in visual measurement, requiring solutions for:
Camera Calibration: Determines the camera's internal parameters (focal length, principal point coordinates, distortion coefficients, etc.) and external parameters (camera position and orientation) to establish the mapping relationship between image coordinates and world coordinates.
Perspective Transformation: When the camera is not perpendicular to the liquid surface, perspective transformation correction is required to convert the liquid surface position from an inclined view to the vertical liquid level height.
Scale Calibration: Establishes the proportional relationship between pixel distance in the image and actual physical distance, typically calibrated using reference objects of known dimensions.
Nonlinear Compensation: For curved container walls (such as cylindrical storage tanks), the nonlinear relationship between the liquid level and image position must be considered, requiring curve fitting and compensation.
3. Algorithm Implementation for Visual Liquid Level Detection
3.1 Traditional Image Processing Algorithm Workflow
A typical traditional visual liquid level detection algorithm generally includes the following steps:
Image acquisition and preprocessing
Region of Interest (ROI) selection
Liquid surface edge detection and enhancement
Edge connection and liquid surface line fitting
Liquid level height calculation
Result verification and output
3.2 Deep Learning-Based Detection Algorithms
In recent years, deep learning-based visual liquid level detection methods have made significant progress:
Semantic Segmentation-Based Methods: Uses segmentation networks such as U-Net and DeepLab to segment the liquid surface area in the image, then calculates the liquid level.
Object Detection-Based Methods: Treats liquid surface detection as an object detection problem, using detection networks like Faster R-CNN and YOLO to locate the liquid surface position.
End-to-End Regression Methods: Directly maps input images to liquid level height, avoiding error accumulation from intermediate processing steps.
3.3 Algorithm Performance Optimization Strategies
To improve the real-time performance and accuracy of visual liquid level detection, the following optimization strategies are often employed:
Multi-Scale Detection: Detects the liquid surface at different scales to improve robustness.
Multi-Frame Fusion: Uses temporal continuity to fuse information from multiple frames, enhancing detection stability.
Adaptive Algorithms: Dynamically adjusts algorithm parameters based on environmental conditions (lighting, temperature, etc.).
Hardware Acceleration: Uses hardware such as GPUs and FPGAs to accelerate image processing.
4. Industrial Application Case Studies
4.1 Liquid Level Detection in Storage Tanks in the Petroleum and Chemical Industry
In large storage tank liquid level detection, vision systems are typically installed on the top or side of the tank. The liquid level is determined by measuring the position of the meniscus where the liquid surface contacts the tank wall. Challenges in this application include:
Large tank dimensions and wide measurement ranges
Complex environments with interference such as steam and foam
High safety requirements, necessitating explosion-proof design
Solutions typically involve high-resolution cameras, long-focal-length lenses, infrared lighting to reduce steam interference, and multi-sensor fusion to improve reliability.
4.2 Liquid Level Detection in Filling Lines in the Food and Beverage Industry
On beverage filling production lines, vision systems detect the liquid level height in bottles in real time to ensure filling volumes meet standards. Key features include:
High detection speed to meet the demands of high-speed production lines
Diverse container types, requiring adaptation to bottles of different shapes and materials
High hygiene standards, requiring food-grade compliance
High-speed line scan cameras or multi-camera systems are typically used, combined with high-brightness LED lighting for simultaneous multi-bottle detection.
4.3 Ampoule Liquid Level Detection in the Pharmaceutical Industry
In the pharmaceutical industry, precise control of the liquid volume in ampoules is critical for drug quality. Visual detection systems must meet:
High precision requirements, typically achieving detection accuracy of 0.1 mm
Small-size detection, as ampoule diameters are often only a few millimeters
High hygiene standards, requiring operation in clean environments
High-magnification telecentric lenses are commonly used, combined with backlighting to clearly capture the liquid surface edge.
5. Technical Challenges and Development Trends
5.1 Current Major Challenges
Although visual liquid level detection technology has made significant progress, it still faces numerous challenges in practical applications:
Environmental Interference: Changes in ambient lighting, steam, foam, and deposits on the inner container walls can affect detection performance.
Complex Liquid Surfaces: Liquid surface fluctuations, bubbles, and multiphase liquid interfaces increase detection difficulty.
Container Characteristics: Special requirements such as refraction in transparent containers, perspective distortion in curved containers, and inner wall detection in opaque containers.
Real-Time Requirements: Increasing demands for detection speed on high-speed production lines, requiring algorithms to meet real-time performance while ensuring accuracy.
System Stability: Long-term stability challenges posed by vibration, temperature changes, and electromagnetic interference in industrial environments.
5.2 Technology Development Trends
Future visual liquid level detection technology will exhibit the following development trends:
Intelligence and Adaptability: Combines artificial intelligence technologies to enable systems to autonomously learn and adapt to different working conditions, automatically adjusting parameters to optimize detection performance.
Multi-Sensor Fusion: Integrates visual information with data from other sensors such as ultrasonic, radar, and pressure sensors to improve detection reliability and robustness.
3D Visual Detection: Uses 3D imaging technologies such as structured light, Time of Flight (TOF), and binocular vision to directly obtain 3D information of the liquid surface, avoiding perspective errors in 2D images.
Embedded and Edge Computing: Deploys algorithms to embedded devices for real-time processing at the edge, reducing dependence on central servers and improving system response speed.
Cloud Platforms and Big Data: Uploads detection data to cloud platforms, optimizing production processes through big data analysis, enabling predictive maintenance, and intelligent decision-making.
Standardization and Modularization: Develops standardized visual liquid level detection modules to reduce application difficulty and cost, promoting technology adoption.
6. Conclusion
Visual liquid level detection technology, as an important application of machine vision in the field of industrial measurement, has been widely adopted in numerous industries such as petroleum and chemicals, food and beverages, pharmaceuticals, and water treatment due to its advantages of being non-contact, high-precision, and capable of obtaining rich information. With advancements in image sensor technology, increased computing power, and the development of artificial intelligence algorithms, the accuracy, speed, and adaptability of visual liquid level detection will continue to improve, and its application scope will further expand.
In the future, visual liquid level detection technology will continue to evolve toward greater intelligence, integration, and connectivity. It will deeply integrate with other sensing technologies and information technologies, providing more reliable and intelligent liquid level detection solutions for industrial automation, smart manufacturing, and IoT applications. At the same time, as the technology matures and costs decrease, visual liquid level detection will expand from industrial applications to civilian use, playing a greater role in smart homes, agricultural irrigation, environmental monitoring, and other fields, bringing more convenience and security to people's production and daily lives.

