Technical Solution and Implementation of a Vision Inspection System for PET Bottle Capping, Liquid Level, and Inkjet Coding
Abstract
Production lines for PET-bottled beverages operate at high speeds and continuously; therefore, inspecting the quality of bottle capping, the height of the liquid contents, and the information printed via inkjet on the bottle body constitutes a critical link in ensuring product compliance, safety, and brand image. Traditional manual sampling methods suffer from low efficiency, high labor intensity, and a susceptibility to visual fatigue and misjudgment. Automated inspection technology based on machine vision—which integrates precision imaging, real-time image processing, and intelligent decision-making—enables high-precision, high-speed, and comprehensive online inspection of PET bottle capping, liquid levels, and inkjet coding. It serves as an indispensable core component for quality control in modern, intelligent beverage production lines. This paper systematically elucidates the composition, operating principles, key technologies, and implementation essentials of this inspection system.
I. System Inspection Objectives and Requirements
1. Capping Inspection:
Objective: To detect whether the bottle cap is tightened securely and correctly seated, and to identify anomalies such as tilted caps, raised caps, skipped threads, or incomplete seating.
Requirements:The system must accurately identify the relative position of the cap's top surface with respect to the bottle neck threads, and determine whether the capping height falls within the specified tolerance (typically ±0.5 mm). It must be capable of distinguishing between caps of different colors and materials, while effectively mitigating interference caused by slight bottle vibrations or reflections from bottle labels.
2. Liquid Level Inspection:
Objective:To verify whether the liquid level of the beverage inside the bottle falls within the standard range, thereby ensuring consistent filling volumes and preventing under-filling (shortage) or over-filling.
Requirements: For transparent or semi-transparent PET bottles, the system must clearly capture the liquid-gas interface (i.e., the liquid surface line). It must overcome interference caused by bubbles, foam, product sedimentation, optical refraction from the curved bottle surface, and label backgrounds to accurately measure the distance between the liquid surface and the bottle neck datum line.
3. Inkjet Coding Inspection:
Objective: To verify the presence of—and inspect the clarity, accuracy, completeness, and precise positioning of—information inkjet-printed on the bottle body (or cap), such as production dates, expiration dates, batch numbers, and QR codes.
Requirements:
▪ Presence Detection: To determine whether inkjet coding is present within a specified inspection zone.
▪ Character Recognition: Performs OCR on characters such as dates and batch numbers; compares them against pre-set information or a database to verify their accuracy.
▪ Quality Assessment: Evaluates the clarity and contrast of the printed code, and checks for defects such as broken lines, blurring, smudging, or contamination.
▪ Position and Integrity: Verifies that the printed code falls within the specified inspection zone, and confirms that any QR codes or barcodes can be successfully decoded.
II. System Overview
A complete vision inspection system for PET bottle caps, liquid levels, and printed codes typically comprises the following subsystems:
1. Imaging Unit:
Industrial Camera: Depending on the production line speed (e.g., 600 bottles/minute, 1200 bottles/minute), a global shutter or rolling shutter area-scan camera—or a high-frame-rate line-scan camera—is selected. The resolution must be sufficiently high to resolve fine details (such as the dot matrix patterns of the printed code). Typically, a 2-megapixel to 5-megapixel CCD or CMOS camera is employed.
Industrial Lens:A fixed-focal-length lens with appropriate focal length, aperture, and depth of field is selected to ensure clear, distortion-free images across the entire field of view. Liquid level detection may require the use of a telecentric lens to minimize perspective errors.
Light Source and Illumination System: This is critical to the success of the vision inspection process. Different illumination techniques are selected based on the specific features being inspected:
▪ Backlighting: Commonly used for liquid level detection; light is projected from behind the bottle to create a high-contrast silhouette of the liquid surface.
▪ Coaxial Lighting: Used to inspect planar features on the top surface of the bottle cap—such as printed codes or scratches—by minimizing glare and reflections.
▪ Bar Lights, Dome Lights, and Low-Angle Lights: Used to highlight the textures and characters on the bottle cap threads, body labels, and printed codes; these techniques eliminate the influence of ambient light and enhance feature contrast.
Optical Filters: Such as polarizers, which effectively suppress specular reflections (glare) generated by the bottle body or the liquid surface.
2. Processing and Control Unit:
Industrial PC / Vision Controller:Equipped with a high-performance CPU and GPU, this unit runs the vision inspection software and is responsible for image acquisition, processing, analysis, and decision-making. ◦ **Vision Processing Software:** Integrates mature machine vision algorithm libraries (e.g., Halcon, VisionPro, OpenCV) or utilizes custom-developed proprietary software. It provides a graphical programming interface to facilitate the configuration of inspection regions, parameters, and logic.
3. Execution and Communication Units:
Rejection Mechanism:Typically consists of pneumatic push rods, swing arms, or air-blowing devices; upon receiving an "NG" (Non-Good/Reject) signal from the vision system, it accurately separates defective products from the production line.
Encoder/Trigger: Synchronizes with the production line to trigger the camera to capture an image precisely when a PET bottle reaches the designated inspection position, thereby ensuring image consistency.
Human-Machine Interface (HMI): A touchscreen or monitor used for parameter configuration, status monitoring, data display (e.g., pass rates, defect type statistics), and alarm notifications.
Communication Interfaces: Connects to the production line's PLC, MES (Manufacturing Execution System), or SCADA (Supervisory Control and Data Acquisition) systems via protocols such as Ethernet, PROFIBUS, PROFINET, or EtherCAT, enabling data uploading and system-wide interoperation.
III. Inspection Principles and Algorithm Workflow
The inspection process follows a closed-loop cycle: "Triggering – Acquisition – Processing – Judgment – Execution."
1. Image Acquisition and Preprocessing:
Synchronous Triggering: An encoder provides real-time feedback on the conveyor belt's position; when a bottle reaches the point directly beneath the camera, a trigger signal is issued, prompting the camera to capture a precise snapshot.
Image Enhancement: The captured raw images undergo filtering (e.g., median filtering, Gaussian filtering) to remove noise, followed by operations such as grayscale conversion, contrast stretching, and histogram equalization to improve overall image quality.
2. Feature Extraction and Inspection Algorithms:
Cap Inspection:
▪ Localization: First, template matching or Blob analysis is employed to precisely locate the bottle neck region within the image.
▪ Measurement: One or more inspection "ROIs" (Regions of Interest) are defined within the bottle neck area. Edge detection techniques (e.g., the Canny operator) are then applied to identify the distinct edges—specifically, the lower rim (or top surface) of the bottle cap and the upper rim of the bottle neck threads.
▪ Calculation and Judgment: The pixel distance between the two identified edge lines is calculated and subsequently converted into a real-world physical distance through system calibration. This distance is compared against a preset acceptable range (e.g., the standard capping height value ± tolerance); if the measurement falls outside this range, the bottle is classified as defective—specifically as having a "tilted cap," "high cap," or similar fault.
Liquid Level Detection:
▪ ROI Configuration: A narrow, vertically oriented rectangular Region of Interest (ROI) is defined in the middle section of the bottle body (specifically avoiding the label area).
▪ Edge Detection: Within this ROI, a vertical grayscale projection or line scan is performed. Due to the difference in refractive indices between the liquid and the air above it, a distinct step-change in grayscale values occurs at the liquid surface. The position of the liquid level is determined by identifying this specific step-point (edge).
▪ Reference Comparison: The pixel distance from the liquid surface to a designated baseline (either the bottle mouth or the bottle bottom) is measured and converted into an actual physical height. This measured height is then compared against a preset standard liquid level height and its allowable deviation. In instances where foam is present, more sophisticated algorithms—such as dynamic thresholding or regional grayscale statistical analysis—may be employed.
Coding/Printing Inspection:
▪ Localization and Segmentation: First, the specific area containing the printed code is located (this can be achieved by referencing its relative position to the bottle body or label, or by utilizing specific positioning markers).
▪ OCR Recognition: The characters within the designated area undergo binarization, character segmentation, and normalization; they are then identified using either pre-trained character templates or a deep learning-based OCR model. The recognition results are compared against the standard information transmitted from the MES (Manufacturing Execution System)—or against preset rules (e.g., verifying that a date code falls in the future).
▪ Quality Assessment: The overall contrast and clarity (measurable via edge sharpness) of the printed area are calculated; additionally, the binarized characters are inspected for any defects such as breaks or adhesions. For 2D barcodes (e.g., QR codes), a dedicated decoding algorithm is invoked directly; the code is deemed "acceptable" only if it can be successfully decoded and its content is verified as correct.
▪ Presence Detection: The number of feature points or the average grayscale value within the designated printing area is calculated and compared against the background area (where no code is expected) to determine whether the code is actually present.
3. Result Determination and Output:
The vision system synthesizes the inspection results from all sub-modules—including capping, liquid level, and coding—to render a final verdict of "Acceptable" or "Unacceptable" for each individual bottle.
The final verdict (including details such as the specific defect type/NG category, timestamp, and location) is transmitted in real-time to the rejection mechanism and the higher-level management system. Rejection Mechanism: Upon the arrival of a "NG" (non-conforming) bottle at the designated rejection point, the mechanism executes a precise action to push it off the main conveyor line.
IV. Key Considerations and Challenges in System Implementation
1. High Speed and Stability: The production line operates at extremely high speeds, requiring the system to process a single image within a very short timeframe (typically <50 ms). Furthermore, the system must maintain continuous, stable operation 24/7 and possess robust resistance to external interference.
2. Adaptability to Complex Environments:
Bottle Variety: The system must be capable of rapidly switching between inspection programs for different bottle shapes and cap types, incorporating a comprehensive "recipe management" function.
Liquid Characteristics: Factors such as bubbles in carbonated beverages, turbidity in fruit juices, and liquid residue adhering to the inner walls of dairy containers (wall-clinging) increase the complexity of liquid level detection; this necessitates the optimization of both lighting schemes and algorithms.
Background Interference: Distractions such as colored labels, reflections, fluctuations in ambient light, the conveyor belt background, and water droplets on the bottle surface must be effectively mitigated through careful lighting design and image pre-processing techniques.
3. Lighting Scheme Design: This constitutes the cornerstone of the project's success. The lighting scheme must be meticulously designed and subjected to rigorous iterative testing to address specific inspection features (e.g., transparent liquid surfaces, reflective cap tops, black inkjet codes). The objective is to select the optimal light source type, color, angle, and intensity to capture images in which the target features are maximally distinct and the background is maximally clean.
4. Precise Calibration: Accurately converting image pixel coordinates into real-world physical dimensions within a global coordinate system is of critical importance. This requires the use of high-precision calibration plates and the application of lens distortion correction techniques to ensure measurement accuracy reaches the 0.1 mm level.
5. Algorithm Robustness: The algorithms employed must possess inherent fault tolerance and adaptive capabilities, enabling them to accommodate minor individual variations (e.g., color discrepancies in cap printing, minute deformations in bottle bodies) and thereby prevent false positives. Deep learning technologies are currently demonstrating significant advantages in the classification of complex defects (e.g., categorizing the severity of inkjet code blurriness).
6. System Integration and Communication: Seamless synchronization with the production line's PLC, precise calculation of rejection delay timings, and data exchange with the Manufacturing Execution System (MES) all require meticulous fine-tuning to ensure that the entire inspection system is seamlessly embedded into the overall production workflow. V. Summary and Outlook
The PET Cap, Liquid Level, and Code Printing Visual Inspection System seamlessly integrates the "keen vision" of machine vision with the "swift hands" of automation. It achieves 100% online inspection of critical quality attributes in beverage packaging, thereby significantly boosting production efficiency and product quality consistency, while simultaneously reducing labor costs and mitigating the risks of false positives and missed defects. This system represents a pivotal component in the beverage industry's journey toward Industry 4.0 and the realization of intelligent manufacturing.
Looking ahead, driven by technological advancements, this system is poised to evolve along the following trends: higher speeds and resolutions to meet the demands of ultra-high-speed production lines; the application of 3D vision technology to enable more precise measurement of cap height and liquid volume; the deep integration of AI deep learning algorithms, empowering the system to autonomously learn and identify increasingly complex and variable defect types, thereby elevating its level of intelligence; and the utilization of cloud platforms and big data analytics to facilitate the aggregation and in-depth analysis of quality data across multiple production lines and factories, providing robust decision support for process optimization and predictive maintenance.
In conclusion, the PET Cap, Liquid Level, and Code Printing Visual Inspection System serves not only as a "steadfast guardian" of product quality but also as a core technological asset driving the beverage manufacturing sector toward enhanced quality, increased efficiency, reduced costs, and comprehensive digital transformation.

