Application and Innovation of Machine Vision Technology in Pharmaceutical Bottle Packaging Inspection
Automated, high-precision visual inspection systems for pharmaceutical bottles are becoming a key technological support for ensuring the quality of pharmaceutical packaging.
In the pharmaceutical industry, the quality of drug packaging directly relates to patient safety. Traditional manual inspection methods suffer from low efficiency, poor consistency, and fatigue, making it difficult to meet the demands of large-scale production. With the development of machine vision technology, computer vision-based automatic inspection systems have become an effective way to solve this problem.
Machine vision technology uses an optoelectronic imaging system to acquire images of the target object. These images are then digitally processed by a computer or dedicated image processing module. Based on information such as pixel distribution, brightness, and color, the system performs recognition of size, shape, and color, greatly improving the flexibility and automation of the production process inspection.
1. System Composition of Pharmaceutical Bottle Visual Inspection
A pharmaceutical bottle visual inspection system typically consists of two parts: a hardware platform and a software system. The hardware platform includes a light source, industrial camera, sensors, image acquisition card, industrial computer, and rejection mechanism.
In the hardware configuration, lighting technology is particularly crucial, as it directly affects the quality of image acquisition. Appropriate lighting can highlight the features of the pharmaceutical bottle and reduce reflections and shadows. The choice of industrial camera should be determined according to the required detection accuracy; generally, high-resolution cameras can capture more subtle defects.
The software system is the core of visual inspection, responsible for image processing, feature extraction, and defect identification. Currently, widely used machine vision software includes HALCON, EVISION, and XCALIPER. These software packages provide a wealth of image processing tools, such as Blob analysis, morphological operations, pattern recognition, and measurement algorithms.
The system's workflow is roughly as follows: When a pharmaceutical bottle reaches the inspection station via a conveyor belt, a sensor triggers the camera to acquire an image. The image data is then transmitted to the industrial computer for processing and analysis, and finally, the rejection mechanism is controlled based on the results.
2. Key Technologies of Pharmaceutical Bottle Visual Inspection
Image processing algorithms are the core technology of pharmaceutical bottle visual inspection. Typical image processing procedures include image grayscale conversion, noise reduction, enhancement, segmentation, and morphological operations. Some specialized technologies are also needed to address the specific requirements of pharmaceutical bottle inspection.
Curved surface imaging technology is particularly important for the inspection of cylindrical pharmaceutical bottles. Because the labels on cylindrical pharmaceutical bottles have a curved surface structure, direct imaging can lead to image deformation and distortion. To solve this problem, researchers have developed multi-camera collaborative imaging systems. By using four industrial cameras positioned in pairs at 90° angles, label images can be captured from different viewing angles. Image stitching technology is then used to achieve comprehensive surface reconstruction of cylindrical labels.
Deep learning technology has shown great potential in pharmaceutical bottle defect detection. Systems based on advanced object detection models such as YOLO11 can automatically identify various defects on the surface of pharmaceutical bottles, such as cracks, stains, and deformations.
These models significantly improve detection accuracy and speed through improved network structures, such as the C3k2 module, DWR dynamic weight adjustment mechanism, and DRB feature fusion structure.
Three-dimensional vision detection technology uses industrial cameras and line laser scanners to synchronously acquire data, combining 2D images and 3D point cloud information to achieve precise detection of defects on the surface of pharmaceutical bottles. This method can capture the 3D morphological features of the bottle, which is particularly effective for detecting 3D defects such as dents and protrusions.
3. Typical Applications of Pharmaceutical Bottle Visual Inspection
Liquid Volume Detection
Liquid volume detection essentially involves measuring the liquid level in the bottle. Machine vision-based detection systems determine the liquid level height by analyzing the grayscale transition point between the bottle opening and the liquid surface.
The system uses grayscale morphological algorithms to segment and analyze real-time images. By creating a measurement area, finding boundary transition points, and measuring the relative position of the liquid level, it determines whether the liquid volume is qualified.
Bottle Cap Sealing and Position Detection
The visual inspection system can detect whether the bottle cap is present, whether it is properly pressed into place, and whether the bottle opening is damaged. A graphic matching tool is used to determine if the bottle opening is damaged, and a linear tool measures the change in the bottle cap and liquid level in the Y-axis direction to determine if the bottle cap is properly installed.
This type of detection usually involves measuring relative positions, so it is not affected by slight vibrations of the bottle on the conveyor belt.
Label Detection
Label detection includes detecting the presence or absence of the label, whether its position is correct, and whether the content is clear and legible. For cylindrical pharmaceutical bottles, label detection faces special challenges.
Advanced detection systems use multi-camera imaging and image stitching technology to obtain complete label images, and then use Blob analysis and machine learning technology to intelligently detect label defects.
Detection content includes various defect types such as label soiling, damage, burrs, wrinkles, and tilting. Batch Number and Production Date Inspection
The batch number and production date on drug packaging are crucial information and must be clearly legible and accurate. The visual inspection system uses OCR (Optical Character Recognition) technology to read and identify each digit in the batch number.
The OCR recognition process includes steps such as image acquisition, preprocessing, character segmentation, and recognition. By training an OCR classifier to create a template, the real-time image is compared with the template to determine whether the batch number and production date are acceptable.
4. Technical Challenges and Innovative Solutions
Visual inspection of drug bottles faces several technical challenges, and researchers have proposed corresponding innovative solutions.
Imaging curved labels is a major challenge. Unfolding the label of a cylindrical drug bottle into a flat plane results in image distortion, making it difficult for traditional methods to obtain complete information. One study proposed a solution based on spatial coordinate calculation: determining the observation range of each camera based on the spatial relative position of the 3D points of the drug bottle label and the four camera focal points, and achieving high-precision reconstruction of the cylindrical label through an optimal observation camera selection algorithm.
Small target defect detection is another challenge. Subtle defects such as cracks and scratches on the surface of drug bottles often occupy only a small area of the image, making them difficult to detect. Deep learning-based solutions improve network structure, such as introducing multi-scale feature fusion and attention mechanisms, to enhance the detection capabilities of small targets.
Uneven lighting also affects detection results. One study proposed an adaptive surface fitting method that automatically selects appropriate surface basis functions for fitting based on the curvature characteristics of different areas of the drug bottle surface, adapting to the complex and diverse surface shapes of drug bottles.
5. Technological Development Trends and Future Outlook
Drug bottle visual inspection technology is developing towards a more intelligent, faster, and more accurate direction. With the continuous advancement of deep learning technology, deep learning-based detection methods will gradually replace traditional image processing algorithms, achieving higher detection accuracy and adaptability.
The application of 3D vision technology will also expand. 3D vision can provide richer surface information and has significant advantages in detecting complex-shaped drug bottles and 3D defects. In the future, 3D visual inspection systems will be more widely used in the pharmaceutical industry.
System integration will continue to improve. Future visual inspection systems will achieve higher integration, and data interaction with other systems on the production line will be closer, forming a complete intelligent manufacturing quality control system.
Detection speed will also continue to increase. With the improvement of hardware performance and optimization of algorithms, the processing speed of visual inspection systems will continuously increase, meeting the real-time inspection needs of higher-speed production lines.
With the promotion and deepening of GMP in China, the continuous improvement of production automation and scale, and the increasing emphasis on quality issues by users, machine vision technology will be more widely applied and developed in pharmaceutical production.
The advancement of visual inspection systems has not only improved the quality control level of pharmaceutical packaging but also enabled pharmaceutical companies to achieve higher production efficiency and lower production costs. In the future, with the integration of new technologies such as artificial intelligence and the Internet of Things, visual inspection of pharmaceutical bottles will continue to develop towards a more intelligent and precise direction.

